public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
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: Alistair Francis <alistair23@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Carlos O'Donell <carlos@redhat.com>,
	Stepan Golosunov <stepan@golosunov.pp.ru>,
	Andreas Schwab <schwab@suse.de>, Zack Weinberg <zackw@panix.com>,
	Siddhesh Poyarekar <siddhesh@redhat.com>,
	Lukasz Majewski <lukma@denx.de>
Subject: [RFC 2/6] y2038: stat: {f}stat{at}64_time64 redirection to be used on Y2038 systems
Date: Sat,  5 Dec 2020 00:36:00 +0100	[thread overview]
Message-ID: <20201204233604.7430-3-lukma@denx.de> (raw)
In-Reply-To: <20201204233604.7430-1-lukma@denx.de>

---
 io/Versions   |  4 +++
 io/sys/stat.h | 80 +++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/io/Versions b/io/Versions
index 15616b68f3..ce34180e30 100644
--- a/io/Versions
+++ b/io/Versions
@@ -148,5 +148,9 @@ libc {
     __fstat64;
     __ppoll64;
     __utime64;
+    __stat64_time64;
+    __fstat64_time64;
+    __lstat64_time64;
+    __fstatat64_time64;
   }
 }
diff --git a/io/sys/stat.h b/io/sys/stat.h
index b3f2f0da99..b89b7b1b7d 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -210,20 +210,45 @@ extern int stat (const char *__restrict __file,
 extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
 #else
 # ifdef __REDIRECT_NTH
+#  ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
+                                    struct stat *__restrict __buf),
+                           __stat64_time64) __nonnull ((1, 2));
+extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf),
+                           __fstat64_time64) __nonnull ((2));
+#  else
 extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
 				  struct stat *__restrict __buf), stat64)
      __nonnull ((1, 2));
 extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
      __nonnull ((2));
+#  endif
 # else
-#  define stat stat64
-#  define fstat fstat64
+#  ifdef __USE_TIME_BITS64
+#   define stat __stat64_time64
+#   define fstat __fstat64_time64
+#  else
+#   define stat stat64
+#   define fstat fstat64
+#  endif
 # endif
 #endif
 #ifdef __USE_LARGEFILE64
 extern int stat64 (const char *__restrict __file,
 		   struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
 extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (stat64, (const char *__restrict __file,
+                                    struct stat64 *__restrict __buf),
+                           __stat64_time64) __nonnull ((1, 2));
+extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
+                           __fstat64_time64) __nonnull ((2));
+#  else
+#   define stat64 __stat64_time64
+#   define fstat64 __fstat64_time64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_ATFILE
@@ -236,19 +261,39 @@ extern int fstatat (int __fd, const char *__restrict __file,
      __THROW __nonnull ((2, 3));
 # else
 #  ifdef __REDIRECT_NTH
+#   ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
+                                     struct stat *__restrict __buf, int __flag),
+                           __fstatat64_time64) __nonnull ((2, 3));
+#   else
 extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
 				     struct stat *__restrict __buf,
 				     int __flag),
 			   fstatat64) __nonnull ((2, 3));
+#   endif /* __USE_TIME_BITS64 */
 #  else
-#   define fstatat fstatat64
+#   ifdef __USE_TIME_BITS64
+#    define fstatat __fstatat64_time64
+#   else
+#    define fstatat fstatat64
+#   endif
 #  endif
-# endif
+# endif /* __USE_FILE_OFFSET64 */
 
 # ifdef __USE_LARGEFILE64
 extern int fstatat64 (int __fd, const char *__restrict __file,
 		      struct stat64 *__restrict __buf, int __flag)
      __THROW __nonnull ((2, 3));
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (fstatat64,
+                           (int __fd, const char *__restrict __file,
+                            struct stat64 *__restrict __buf, int __flag),
+                           __fstatat64_time64) __nonnull ((2, 3));
+#   else
+#    define fstatat64 __fstatat64_time64
+#   endif
+#  endif /* __USE_TIME_BITS64 */
 # endif
 #endif
 
@@ -260,19 +305,38 @@ extern int lstat (const char *__restrict __file,
 		  struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
 # else
 #  ifdef __REDIRECT_NTH
+#   ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (lstat, (const char *__restrict __file,
+                                   struct stat *__restrict __buf),
+                           __lstat64_time64) __nonnull ((1, 2));
+#   else
 extern int __REDIRECT_NTH (lstat,
 			   (const char *__restrict __file,
 			    struct stat *__restrict __buf), lstat64)
      __nonnull ((1, 2));
+#   endif /* __USE_TIME_BITS64 */
 #  else
-#   define lstat lstat64
-#  endif
-# endif
+#   ifdef __USE_TIME_BITS64
+#    define lstat __lstat64_time64
+#   else
+#    define lstat lstat64
+#   endif
+#  endif /* __REDIRECT_NTH */
+# endif /* __USE_FILE_OFFSET64 */
 # ifdef __USE_LARGEFILE64
 extern int lstat64 (const char *__restrict __file,
 		    struct stat64 *__restrict __buf)
      __THROW __nonnull ((1, 2));
-# endif
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file,
+                                     struct stat64 *__restrict __buf),
+                           __lstat64_time64) __nonnull ((1, 2));
+#   else
+#    define lstat64 __lstat64_time64
+#   endif
+#  endif /* __USE_TIME_BITS64 */
+# endif /* __USE_LARGEFILE64 */
 #endif
 
 /* Set file access permissions for FILE to MODE.
-- 
2.20.1


  parent reply	other threads:[~2020-12-04 23:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 23:35 [RFC 0/6] y2038: Prepare glibc to be Y2038 safe for 32 bit ports Lukasz Majewski
2020-12-04 23:35 ` [RFC 1/6] y2038: Introduce _TIME_BITS flag to support 64 bit time on 32 bit systems Lukasz Majewski
2020-12-05  0:12   ` Joseph Myers
2020-12-07 13:00     ` Lukasz Majewski
2020-12-04 23:36 ` Lukasz Majewski [this message]
2020-12-05  0:04   ` [RFC 2/6] y2038: stat: {f}stat{at}64_time64 redirection to be used on Y2038 systems Joseph Myers
2020-12-07 10:28     ` Lukasz Majewski
2020-12-07 18:07       ` Joseph Myers
2020-12-04 23:36 ` [RFC 3/6] y2038: Export struct_stat_time64_helper.h with Y2038 safe stat{64} content Lukasz Majewski
2020-12-29 10:30   ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 4/6] y2038: Enhance struct msqid_ds to support 64 bit time Lukasz Majewski
2020-12-29 10:34   ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 5/6] msqid: Provide internal copy of struct __msqid64_ds Lukasz Majewski
2020-12-29 10:54   ` Lukasz Majewski
2020-12-04 23:36 ` [RFC 6/6] msg: provide glibc local copy of struct msqid_ds Lukasz Majewski
2020-12-05  0:01 ` [RFC 0/6] y2038: Prepare glibc to be Y2038 safe for 32 bit ports Joseph Myers
2020-12-07 10:22   ` Lukasz Majewski
2020-12-07 18:01     ` Joseph Myers
2020-12-08 10:07       ` Lukasz Majewski
2020-12-08 15:25         ` Joseph Myers
2020-12-13 11:49           ` Lukasz Majewski

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204233604.7430-3-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=arnd@arndb.de \
    --cc=carlos@redhat.com \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --cc=siddhesh@redhat.com \
    --cc=stepan@golosunov.pp.ru \
    --cc=zackw@panix.com \
    /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).