Browse Source

preadv/pwritev: bugfix preadv/pwritev syscall should be 5 args

The current uclibc-ng use 4 arguments, and this will cause
ltp-testsuite's preadv/pwritev case failed.

The syscall of preadv/pwritev in current linux-kernel is 5 arguments:

linux/fs/read_write.c:

SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
	unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
	unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)

So just update to 5-args-syscall, and off_t could be 32bit or 64bit.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Guo Ren 6 years ago
parent
commit
8b233f2491
2 changed files with 12 additions and 2 deletions
  1. 6 1
      libc/sysdeps/linux/common/preadv.c
  2. 6 1
      libc/sysdeps/linux/common/pwritev.c

+ 6 - 1
libc/sysdeps/linux/common/preadv.c

@@ -23,6 +23,11 @@
 ssize_t
 preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
-  return INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
+  unsigned long pos_l, pos_h;
+
+  pos_h = (unsigned long)((long long)offset >> 32);
+  pos_l = (unsigned long)((long long)offset);	
+
+  return INLINE_SYSCALL (preadv, 5, fd, vector, count, pos_l, pos_h);
 }
 #endif

+ 6 - 1
libc/sysdeps/linux/common/pwritev.c

@@ -23,6 +23,11 @@
 ssize_t
 pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
-  return INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
+  unsigned long pos_l, pos_h;
+
+  pos_h = (unsigned long)((long long)offset >> 32);
+  pos_l = (unsigned long)((long long)offset);
+
+  return INLINE_SYSCALL (pwritev, 5, fd, vector, count, pos_l, pos_h);
 }
 #endif