about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/preadv.c10
-rw-r--r--sysdeps/unix/sysv/linux/pwritev.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
index 0d4a6c3803..72722ebc0d 100644
--- a/sysdeps/unix/sysv/linux/preadv.c
+++ b/sysdeps/unix/sysv/linux/preadv.c
@@ -37,6 +37,10 @@
 # define OFF_T off_t
 #endif
 
+#define LO_HI_LONG(val) \
+  (off_t) val,								\
+  (off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
+
 #ifndef __ASSUME_PREADV
 static ssize_t PREADV_REPLACEMENT (int, __const struct iovec *,
 				   int, OFF_T) internal_function;
@@ -55,15 +59,13 @@ PREADV (fd, vector, count, offset)
 
   if (SINGLE_THREAD_P)
     result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
-			     (off_t) ((off64_t) offset >> 32),
-			     (off_t) (offset & 0xffffffff));
+			     LO_HI_LONG (offset));
   else
     {
       int oldtype = LIBC_CANCEL_ASYNC ();
 
       result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
-			       (off_t) ((off64_t) offset >> 32),
-			       (off_t) (offset & 0xffffffff));
+			       LO_HI_LONG (offset));
 
       LIBC_CANCEL_RESET (oldtype);
     }
diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
index 5c30eae51f..2e9cbb2536 100644
--- a/sysdeps/unix/sysv/linux/pwritev.c
+++ b/sysdeps/unix/sysv/linux/pwritev.c
@@ -37,6 +37,10 @@
 # define OFF_T off_t
 #endif
 
+#define LO_HI_LONG(val) \
+  (off_t) val,								\
+  (off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
+
 #ifndef __ASSUME_PWRITEV
 static ssize_t PWRITEV_REPLACEMENT (int, __const struct iovec *,
 				    int, OFF_T) internal_function;
@@ -55,15 +59,13 @@ PWRITEV (fd, vector, count, offset)
 
   if (SINGLE_THREAD_P)
     result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
-			     (off_t) ((off64_t) offset >> 32),
-			     (off_t) (offset & 0xffffffff));
+			     LO_HI_LONG (offset));
   else
     {
       int oldtype = LIBC_CANCEL_ASYNC ();
 
       result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
-			       (off_t) ((off64_t) offset >> 32),
-			       (off_t) (offset & 0xffffffff));
+			     LO_HI_LONG (offset));
 
       LIBC_CANCEL_RESET (oldtype);
     }