@@ -1,11 +1,13 @@
#include "kvm/read-write.h"
+#include <sys/syscall.h>
#include <sys/types.h>
-#include <sys/uio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <asm/unistd.h>
+
/* Same as read(2) except that this function never returns EAGAIN or EINTR. */
ssize_t xread(int fd, void *buf, size_t count)
{
@@ -247,26 +249,36 @@ ssize_t writev_in_full(int fd, const struct iovec *iov, int iovcnt)
return total;
}
+static inline ssize_t sys_preadv(int fd, const struct iovec *iovec, int count, off_t offset)
+{
+ return syscall(__NR_preadv, fd, iovec, count, offset);
+}
+
/* Same as preadv(2) except that this function never returns EAGAIN or EINTR. */
ssize_t xpreadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
ssize_t nr;
restart:
- nr = preadv(fd, iov, iovcnt, offset);
+ nr = sys_preadv(fd, iov, iovcnt, offset);
if ((nr < 0) && ((errno == EAGAIN) || (errno == EINTR)))
goto restart;
return nr;
}
+static inline ssize_t sys_pwritev(int fd, const struct iovec *iovec, int count, off_t offset)
+{
+ return syscall(__NR_pwritev, fd, iovec, count, offset);
+}
+
/* Same as pwritev(2) except that this function never returns EAGAIN or EINTR. */
ssize_t xpwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
ssize_t nr;
restart:
- nr = pwritev(fd, iov, iovcnt, offset);
+ nr = sys_pwritev(fd, iov, iovcnt, offset);
if ((nr < 0) && ((errno == EAGAIN) || (errno == EINTR)))
goto restart;