source: trunk/packages/xen-common/xen-common/tools/libaio/harness/cases/common-7-8.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 876 bytes
Line 
1/* common-7-8.h
2*/
3#include "aio_setup.h"
4
5#include <unistd.h>
6
7#define SIZE    512
8
9int test_main(void)
10{
11        char *buf;
12        int rwfd;
13        int status = 0, res;
14        long long limit;
15
16        rwfd = open(FILENAME, O_RDWR);          assert(rwfd != -1);
17        res = ftruncate(rwfd, 0);                       assert(res == 0);
18        buf = malloc(SIZE);                             assert(buf != NULL);
19        memset(buf, 0, SIZE);
20
21        limit = LIMIT;
22
23        SET_RLIMIT(limit);
24
25        status |= attempt_rw(rwfd, buf, SIZE,   limit-SIZE, WRITE, SIZE);
26        status |= attempt_rw(rwfd, buf, SIZE,   limit-SIZE,  READ, SIZE);
27
28        status |= attempt_rw(rwfd, buf, SIZE, 1+limit-SIZE, WRITE, SIZE-1);
29        status |= attempt_rw(rwfd, buf, SIZE, 1+limit-SIZE,  READ, SIZE-1);
30
31        status |= attempt_rw(rwfd, buf, SIZE,        limit, WRITE, -EFBIG);
32        status |= attempt_rw(rwfd, buf, SIZE,        limit,  READ,      0);
33        status |= attempt_rw(rwfd, buf,    0,        limit, WRITE,      0);
34
35        return status;
36}
37
Note: See TracBrowser for help on using the repository browser.