public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/azanella/y2038-preliminaries] Make second argument of gettimeofday as 'void *' Date: Tue, 10 Sep 2019 17:20:00 -0000 [thread overview] Message-ID: <20190910172033.62621.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3a123f1a0681dcf7f7f2f5f4f3cc9aeefb8adc3f commit 3a123f1a0681dcf7f7f2f5f4f3cc9aeefb8adc3f Author: Zack Weinberg <zackw@panix.com> Date: Mon Aug 19 13:51:25 2019 -0400 Make second argument of gettimeofday as 'void *' Also make the public prototype of gettimeofday declare its second argument with type "void *" unconditionally, consistent with POSIX. It is also consistent with POSIX. * time/sys/time.h (__timezone_ptr_t): Delete. (gettimeofday): Always declare second argument with type "void *". (settimeofday): Improve commentary. * include/sys/time.h (__gettimeofday) * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c * sysdeps/unix/sysv/linux/x86/gettimeofday.c * time/gettimeofday.c (gettimeofday): Declare second argument with type "void *". Diff: --- include/sys/time.h | 2 +- sysdeps/unix/sysv/linux/aarch64/gettimeofday.c | 5 ++--- sysdeps/unix/sysv/linux/powerpc/gettimeofday.c | 5 ++--- sysdeps/unix/sysv/linux/x86/gettimeofday.c | 3 +-- time/gettimeofday.c | 4 ++-- time/sys/time.h | 23 ++++++++++++----------- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/include/sys/time.h b/include/sys/time.h index b6710bd..6e3fd20 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -21,7 +21,7 @@ # ifndef _ISOMAC extern int __gettimeofday (struct timeval *__tv, - struct timezone *__tz); + void *__tz); extern int __settimezone (const struct timezone *__tz) attribute_hidden; extern int __adjtime (const struct timeval *__delta, diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c index 44626db..5056e24 100644 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c @@ -29,8 +29,7 @@ /* Used as a fallback in the ifunc resolver if VDSO is not available and for libc.so internal __gettimeofday calls. */ int -__gettimeofday_vsyscall (struct timeval *restrict tv, - struct timezone *restrict tz) +__gettimeofday_vsyscall (struct timeval *restrict tv, void *restrict tz) { return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } @@ -49,7 +48,7 @@ libc_ifunc (__gettimeofday, vdso_gettimeofday ?: (void *) __gettimeofday_vsyscall) #else int -__gettimeofday (struct timeval *restrict tv, struct timezone *restrict tz) +__gettimeofday (struct timeval *restrict tv, void *restrict tz) { return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); } diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index 78cc52f..20a0cb8 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -23,8 +23,7 @@ #ifdef SHARED int -__gettimeofday_syscall (struct timeval *restrict tv, - struct timezone *restrict tz) +__gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) { return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } @@ -40,7 +39,7 @@ libc_ifunc (__gettimeofday, : (void *) __gettimeofday_syscall); #else int -__gettimeofday (struct timeval *restrict tv, struct timezone *restrict tz) +__gettimeofday (struct timeval *restrict tv, void *restrict tz) { return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); } diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c index b0c99ac..fd5a6a3 100644 --- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c @@ -22,8 +22,7 @@ #include <sysdep-vdso.h> int -__gettimeofday_syscall (struct timeval *restrict tv, - struct timezone *restrict tz) +__gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz) { return INLINE_SYSCALL_CALL (gettimeofday, tv, tz); } diff --git a/time/gettimeofday.c b/time/gettimeofday.c index c4f6426..5bc91fc 100644 --- a/time/gettimeofday.c +++ b/time/gettimeofday.c @@ -23,10 +23,10 @@ If *TZ is not NULL, clear it. Returns 0 on success, -1 on errors. */ int -___gettimeofday (struct timeval *tv, struct timezone *tz) +___gettimeofday (struct timeval *restrict tv, void *restrict tz) { if (__glibc_unlikely (tz != 0)) - memset (tz, 0, sizeof *tz); + memset (tz, 0, sizeof (struct timezone)); struct timespec ts; if (__clock_gettime (CLOCK_REALTIME, &ts)) diff --git a/time/sys/time.h b/time/sys/time.h index 5dbc7fc..3b70962 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -54,23 +54,24 @@ struct timezone int tz_minuteswest; /* Minutes west of GMT. */ int tz_dsttime; /* Nonzero if DST is ever in effect. */ }; - -typedef struct timezone *__restrict __timezone_ptr_t; -#else -typedef void *__restrict __timezone_ptr_t; #endif -/* Get the current time of day and timezone information, - putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. - Returns 0 on success, -1 on errors. - NOTE: This form of timezone information is obsolete. - Use the functions and variables declared in <time.h> instead. */ +/* Get the current time of day, putting it into *TV. + If TZ is not null, *TZ must be a struct timezone, and both fields + will be set to zero. + Calling this function with a non-null TZ is obsolete; + use localtime etc. instead. + This function itself is semi-obsolete; + most callers should use time or clock_gettime instead. */ extern int gettimeofday (struct timeval *__restrict __tv, - __timezone_ptr_t __tz) __THROW __nonnull ((1)); + void *__restrict __tz) __THROW __nonnull ((1)); #ifdef __USE_MISC /* Set the current time of day and timezone information. - This call is restricted to the super-user. */ + This call is restricted to the super-user. + Setting the timezone in this way is obsolete, but we don't yet + warn about it because it still has some uses for which there is + no alternative. */ extern int settimeofday (const struct timeval *__tv, const struct timezone *__tz) __THROW;
next reply other threads:[~2019-09-10 17:20 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-10 17:20 Adhemerval Zanella [this message] 2019-10-25 11:26 Adhemerval Zanella
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=20190910172033.62621.qmail@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /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: linkBe 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).