public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls
@ 2020-10-13 13:16 Lukasz Majewski
  2020-10-13 13:16 ` [PATCH 2/2] y2038: Remove not used __fstatat_time64 define Lukasz Majewski
  2020-10-13 22:17 ` [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls Joseph Myers
  0 siblings, 2 replies; 6+ messages in thread
From: Lukasz Majewski @ 2020-10-13 13:16 UTC (permalink / raw)
  To: Joseph Myers, Paul Eggert, Adhemerval Zanella
  Cc: Alistair Francis, Arnd Bergmann, Alistair Francis, GNU C Library,
	Florian Weimer, Carlos O'Donell, Stepan Golosunov,
	Andreas Schwab, Zack Weinberg, Lukasz Majewski

When glibc port with __WORDSIZE==32 and __TIMESIZE!=64 (e.g. armv7) will
use redirected calls to {f}stat{at}64_time64 functions, it will accept
the struct __stat64_t64 as its argument.

To avoid errors related to proper data placement after casting from
struct __stat64_t64 to struct stat{64} it is necessary to add some missing
padding and update type of {__}st_ino member.


By adding the unsigned int pads there is a possibility to extend struct
stat from: sysdeps/unix/sysv/linux/bits/struct_stat.h
with:
     unsigned short int __pad1;
+#ifdef __USE_TIME_BITS64
+    unsigned short int __timepad1;
+#endif

To have it binary compatible with struct __stat64_t64
---
 sysdeps/unix/sysv/linux/struct_stat_time64.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/struct_stat_time64.h b/sysdeps/unix/sysv/linux/struct_stat_time64.h
index b85385b6f3..ca3f06c077 100644
--- a/sysdeps/unix/sysv/linux/struct_stat_time64.h
+++ b/sysdeps/unix/sysv/linux/struct_stat_time64.h
@@ -43,12 +43,14 @@
 struct __stat64_t64
   {
     __dev_t st_dev;			/* Device.  */
-    __ino64_t st_ino;			/* file serial number.	*/
+    unsigned int __pad1;
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
     __mode_t st_mode;			/* File mode.  */
     __nlink_t st_nlink;			/* Link count.  */
     __uid_t st_uid;			/* User ID of the file's owner.	*/
     __gid_t st_gid;			/* Group ID of the file's group.*/
     __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned int __pad2;
     __off64_t st_size;			/* Size of file, in bytes.  */
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
@@ -70,6 +72,7 @@ struct __stat64_t64
     __fieldts64 (st_mtime);
     __fieldts64 (st_ctime);
 #   endif /* __USE_XOPEN2K8  */
+    __ino64_t st_ino;			/* file serial number.	*/
   };
 
 #   define _STATBUF_ST_BLKSIZE
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-14 20:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 13:16 [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls Lukasz Majewski
2020-10-13 13:16 ` [PATCH 2/2] y2038: Remove not used __fstatat_time64 define Lukasz Majewski
2020-10-13 13:31   ` Andreas Schwab
2020-10-13 22:17 ` [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls Joseph Myers
2020-10-14  8:47   ` Lukasz Majewski
2020-10-14 13:09     ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).