]> granicus.if.org Git - strace/blob - tests/uio.c
Use printnum_int64 instead of print_loff_t
[strace] / tests / uio.c
1 #ifdef HAVE_CONFIG_H
2 # include "config.h"
3 #endif
4 #include <fcntl.h>
5 #include <unistd.h>
6 #include <sys/uio.h>
7 #include <assert.h>
8
9 int
10 main(void)
11 {
12 #if defined(HAVE_PREADV) && defined(HAVE_PWRITEV)
13         const off_t offset = 0xdefaceddeadbeefLL;
14         int fd;
15         char buf[4];
16         struct iovec iov = { buf, sizeof buf };
17
18         assert((fd = open("/dev/zero", O_RDONLY)) >= 0);
19         assert(pread(fd, buf, sizeof buf, offset) == 4);
20         assert(preadv(fd, &iov, 1, offset) == 4);
21         assert(!close(fd));
22
23         assert((fd = open("/dev/null", O_WRONLY)) >= 0);
24         assert(pwrite(fd, buf, sizeof buf, offset) == 4);
25         assert(pwritev(fd, &iov, 1, offset) == 4);
26         assert(!close(fd));
27
28         return 0;
29 #else
30         return 77;
31 #endif
32 }