From: Lukasz Majewski <lukma@denx.de>
To: Joseph Myers <joseph@codesourcery.com>,
Paul Eggert <eggert@cs.ucla.edu>,
Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Florian Weimer <fweimer@redhat.com>,
GNU C Library <libc-alpha@sourceware.org>,
Andreas Schwab <schwab@suse.de>,
Stepan Golosunov <stepan@golosunov.pp.ru>,
Alistair Francis <alistair.francis@wdc.com>
Subject: [PATCH 1/2] y2038: Adjust struct __stat64_t64 to be usable by redirected {f}stat{at} calls
Date: Tue, 13 Oct 2020 15:16:02 +0200 [thread overview]
Message-ID: <20201013131603.12557-1-lukma@denx.de> (raw)
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
next reply other threads:[~2020-10-13 13:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 13:16 Lukasz Majewski [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201013131603.12557-1-lukma@denx.de \
--to=lukma@denx.de \
--cc=adhemerval.zanella@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=eggert@cs.ucla.edu \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=schwab@suse.de \
--cc=stepan@golosunov.pp.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).