Skip to contentSkip to conversation

package/uclibc: fix preadv/pwritev offset argument type

PATCH New Max Filippov 3 participants 3 messages May 13, 2019 – May 26, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/uclibc: fix preadv/pwritev 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.

Backported from: 423e49023eeb ("preadv/pwritev: fix offset argument type")

---
 ...3-preadv-pwritev-fix-offset-argument-type.patch | 70 ++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch
package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch new file +70 -0
new file mode 100644
index 000000000000..2a20aecc8d20
@@ -0,0 +1,70 @@
+From 1077d5bebffacfd4b09896ed890fb45a5b3c6dc6 Mon Sep 17 00:00:00 2001
+From: Max Filippov <[email protected]>
+Date: Fri, 10 May 2019 07:13:19 -0700
+Subject: [PATCH] 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 <[email protected]>
+---
+ include/sys/uio.h                   | 4 ++--
+ libc/sysdeps/linux/common/preadv.c  | 2 +-
+ libc/sysdeps/linux/common/pwritev.c | 2 +-
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/include/sys/uio.h b/include/sys/uio.h
+index aa766f9b1187..330426fec492 100644
+--- a/include/sys/uio.h
++++ b/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
+diff --git a/libc/sysdeps/linux/common/preadv.c b/libc/sysdeps/linux/common/preadv.c
+index fd9dde4b999c..6a07d5df87e0 100644
+--- a/libc/sysdeps/linux/common/preadv.c
++++ b/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;
+ 
+diff --git a/libc/sysdeps/linux/common/pwritev.c b/libc/sysdeps/linux/common/pwritev.c
+index bef5bcf69b46..f07c40e6de3c 100644
+--- a/libc/sysdeps/linux/common/pwritev.c
++++ b/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;
+ 
+-- 
+2.11.0
+
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 package/uclibc: fix preadv/pwritev offset argument type

Hello Max,

Thanks for the patch and all the investigation around this issue!

Quoted 6 lines · On Mon, 13 May 2019 11:48:11 -0700 Max Filippov <[email protected]> wrote:

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.

Backported from: 423e49023eeb ("preadv/pwritev: fix offset argument type")

This Backported tag is not really relevant inside the Buildroot commit
log: indeed it refers to an upstream uClibc-ng commit. So I have moved this line...

Quoted 14 lines
---
 ...3-preadv-pwritev-fix-offset-argument-type.patch | 70 ++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch
package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch new file +2 -0
new file mode 100644
index 000000000000..2a20aecc8d20
@@ -0,0 +1,70 @@
+From 1077d5bebffacfd4b09896ed890fb45a5b3c6dc6 Mon Sep 17 00:00:00 2001
+From: Max Filippov <[email protected]>

package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch line 12

Quoted 10 lines
package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch new file +10 -0
+Date: Fri, 10 May 2019 07:13:19 -0700
+Subject: [PATCH] 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.
+

... here.

package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch line 13

Quoted 1 line
package/uclibc/0003-preadv-pwritev-fix-offset-argument-type.patch new file +1 -0
+Signed-off-by: Max Filippov <[email protected]>

And applied to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/uclibc: fix preadv/pwritev offset argument type

In reply to Max Filippov
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Max" == Max Filippov <[email protected]> writes:

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.

Backported from: 423e49023eeb ("preadv/pwritev: fix offset argument type")

Committed to 2019.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard