summaryrefslogtreecommitdiff
path: root/libgcompat/uio.c
blob: 797cb3aae7b44deaf6de38b748783275ebe12d60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <sys/syscall.h>
#include <sys/uio.h>		/* iovec, pwritev, preadv */
#include <errno.h>		/* errno */
#include <unistd.h>		/* syscall */

ssize_t pwritev64v2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
{
	if (flags != 0) {
		errno = ENOTSUP;
		return -1;
	}

	if (ofs == -1) {
		return writev(fd, iov, count);
	}

	return syscall(__NR_pwritev2, fd, iov, count, ofs);
}

ssize_t preadv64v2(int fd, const struct iovec *iov, int count, off_t ofs, int flags)
{
	if (flags != 0) {
		errno = ENOTSUP;
		return -1;
	}

	if (ofs == -1) {
		return readv(fd, iov, count);
	}

	return syscall(__NR_preadv2, fd, iov, count, ofs);
}