1#include <fcntl.h>
2#include <unistd.h>
3#include <sys/uio.h>
4#include <assert.h>
5
6int
7main(void)
8{
9	const off_t offset = 0xdefaceddeadbeefLL;
10	int fd;
11	char buf[4];
12	struct iovec iov = { buf, sizeof buf };
13
14	assert((fd = open("/dev/zero", O_RDONLY)) >= 0);
15	assert(pread(fd, buf, sizeof buf, offset) == 4);
16	assert(preadv(fd, &iov, 1, offset) == 4);
17	assert(!close(fd));
18
19	assert((fd = open("/dev/null", O_WRONLY)) >= 0);
20	assert(pwrite(fd, buf, sizeof buf, offset) == 4);
21	assert(pwritev(fd, &iov, 1, offset) == 4);
22	assert(!close(fd));
23
24	return 0;
25}
26