Browse Source

preadv/pwritev: fix offset argument type

preadv/pwritev don't provide separate version for 64-bit wide off_t,
and default to 32-bit wide off_t, which results in a mismatch between
declaration and definition for user programs built with
-D_FILE_OFFSET_BITS=64.
Make offset argument of both functions __off64_t.
This fixes test misc/tst-preadvwritev on xtensa.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Max Filippov 5 years ago
parent
commit
423e49023e
3 changed files with 4 additions and 4 deletions
  1. 2 2
      include/sys/uio.h
  2. 1 1
      libc/sysdeps/linux/common/preadv.c
  3. 1 1
      libc/sysdeps/linux/common/pwritev.c

+ 2 - 2
include/sys/uio.h

@@ -59,7 +59,7 @@ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count);
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
-		       off_t __offset) __wur;
+		       __off64_t __offset) __wur;
 
 /* Write data pointed by the buffers described by IOVEC, which is a
    vector of COUNT 'struct iovec's, to file descriptor FD at the given
@@ -71,7 +71,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
-			off_t __offset) __wur;
+			__off64_t __offset) __wur;
 #endif	/* Use misc.  */
 
 __END_DECLS

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

@@ -21,7 +21,7 @@
 
 #ifdef __NR_preadv
 ssize_t
-preadv (int fd, const struct iovec *vector, int count, off_t offset)
+preadv (int fd, const struct iovec *vector, int count, __off64_t offset)
 {
   unsigned long pos_l, pos_h;
 

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

@@ -21,7 +21,7 @@
 
 #ifdef __NR_pwritev
 ssize_t
-pwritev (int fd, const struct iovec *vector, int count, off_t offset)
+pwritev (int fd, const struct iovec *vector, int count, __off64_t offset)
 {
   unsigned long pos_l, pos_h;