y2038: Redirect to 64 bit time functions when __USE_TIME_BITS64 is defined

Message ID 20201209121802.21497-1-lukma@denx.de
State New
Headers show
Series
  • y2038: Redirect to 64 bit time functions when __USE_TIME_BITS64 is defined
Related show

Commit Message

Lukasz Majewski Dec. 9, 2020, 12:18 p.m.
Exported headers have been modified to provide redirections to 64 bit
functions when __USE_TIME_BITS64 is defined - this exported flag is set
only when _TIME_BITS=64 and _FILE_OFFSET_BITS=64 are set on compilation
time.
For example, when __USE_TIME_BIT64 is defined - calls to clock_settime
are redirected to clock_settime64, which supports setting 64 bit time
in glibc ports with __WORDSIZE==32 and __TIMESIZE != 64.

This patch is the preparatory one for addressing Y2038 issue and as such
will be inactive until support for _TIME_BITS exported flag is added,
which in turn causes definition of __USE_TIME_BITS64.
---
 io/sys/poll.h                         |  11 ++
 io/sys/stat.h                         |  20 ++++
 io/utime.h                            |  10 ++
 misc/sys/select.h                     |  27 +++++
 posix/sched.h                         |   9 ++
 posix/sys/wait.h                      |  20 ++++
 resolv/netdb.h                        |  11 ++
 resource/sys/resource.h               |  10 ++
 rt/aio.h                              |  25 ++++-
 rt/mqueue.h                           |  25 +++++
 signal/signal.h                       |  12 +++
 socket/sys/socket.h                   |  11 ++
 sysdeps/nptl/pthread.h                | 117 +++++++++++++++++++++
 sysdeps/pthread/semaphore.h           |  23 ++++
 sysdeps/pthread/threads.h             |  33 ++++++
 sysdeps/unix/sysv/linux/bits/time.h   |  10 ++
 sysdeps/unix/sysv/linux/sys/timerfd.h |  22 ++++
 sysdeps/unix/sysv/linux/sys/timex.h   |  37 ++++++-
 sysvipc/sys/msg.h                     |  10 ++
 sysvipc/sys/sem.h                     |  21 ++++
 sysvipc/sys/shm.h                     |  10 ++
 time/sys/time.h                       |  91 ++++++++++++++++
 time/time.h                           | 146 ++++++++++++++++++++++++++
 23 files changed, 705 insertions(+), 6 deletions(-)

-- 
2.20.1

Comments

Lukasz Majewski Dec. 29, 2020, 10:27 a.m. | #1
Dear Community,

I do know that the "freeze" time for glibc release is coming, but I
would be very happy to receive feedback on this patch.

It is the attempt to divide the Y2038 support to smaller chunks, so it
would be easier to review.

> Exported headers have been modified to provide redirections to 64 bit

> functions when __USE_TIME_BITS64 is defined - this exported flag is

> set only when _TIME_BITS=64 and _FILE_OFFSET_BITS=64 are set on

> compilation time.

> For example, when __USE_TIME_BIT64 is defined - calls to clock_settime

> are redirected to clock_settime64, which supports setting 64 bit time

> in glibc ports with __WORDSIZE==32 and __TIMESIZE != 64.

> 

> This patch is the preparatory one for addressing Y2038 issue and as

> such will be inactive until support for _TIME_BITS exported flag is

> added, which in turn causes definition of __USE_TIME_BITS64.


To emphasize - this patch set will not introduce any harm, as
__USE_TIME_BITS64 will be NOT defined until the support for 64 bit time
is added to glibc.

> ---

>  io/sys/poll.h                         |  11 ++

>  io/sys/stat.h                         |  20 ++++

>  io/utime.h                            |  10 ++

>  misc/sys/select.h                     |  27 +++++

>  posix/sched.h                         |   9 ++

>  posix/sys/wait.h                      |  20 ++++

>  resolv/netdb.h                        |  11 ++

>  resource/sys/resource.h               |  10 ++

>  rt/aio.h                              |  25 ++++-

>  rt/mqueue.h                           |  25 +++++

>  signal/signal.h                       |  12 +++

>  socket/sys/socket.h                   |  11 ++

>  sysdeps/nptl/pthread.h                | 117 +++++++++++++++++++++

>  sysdeps/pthread/semaphore.h           |  23 ++++

>  sysdeps/pthread/threads.h             |  33 ++++++

>  sysdeps/unix/sysv/linux/bits/time.h   |  10 ++

>  sysdeps/unix/sysv/linux/sys/timerfd.h |  22 ++++

>  sysdeps/unix/sysv/linux/sys/timex.h   |  37 ++++++-

>  sysvipc/sys/msg.h                     |  10 ++

>  sysvipc/sys/sem.h                     |  21 ++++

>  sysvipc/sys/shm.h                     |  10 ++

>  time/sys/time.h                       |  91 ++++++++++++++++

>  time/time.h                           | 146

> ++++++++++++++++++++++++++ 23 files changed, 705 insertions(+), 6

> deletions(-)

> 

> diff --git a/io/sys/poll.h b/io/sys/poll.h

> index 857be0f5ac..4a725ed18e 100644

> --- a/io/sys/poll.h

> +++ b/io/sys/poll.h

> @@ -63,6 +63,17 @@ extern int poll (struct pollfd *__fds, nfds_t

> __nfds, int __timeout); extern int ppoll (struct pollfd *__fds,

> nfds_t __nfds, const struct timespec *__timeout,

>  		  const __sigset_t *__ss);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds,

> +                               const struct timespec *__timeout,

> +                               const __sigset_t *__ss),

> +                       __ppoll64);

> +#  else

> +#  define ppoll __ppoll64

> +#  endif

> +# endif

>  #endif

>  

>  __END_DECLS

> diff --git a/io/sys/stat.h b/io/sys/stat.h

> index 58c3770622..b3f2f0da99 100644

> --- a/io/sys/stat.h

> +++ b/io/sys/stat.h

> @@ -361,11 +361,31 @@ extern int utimensat (int __fd, const char

> *__path, const struct timespec __times[2],

>  		      int __flags)

>       __THROW __nonnull ((2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,

> +                                       const struct timespec

> __times[2],

> +                                       int flags),

> +                           __utimensat64) __nonnull ((2));

> +#  else

> +#  define utimensat __utimensat64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_XOPEN2K8

>  /* Set file access and modification times of the file associated

> with FD.  */ extern int futimens (int __fd, const struct timespec

> __times[2]) __THROW; +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec

> __times[2]),

> +                           __futimens64);

> +#  else

> +#  define futimens __futimens64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> diff --git a/io/utime.h b/io/utime.h

> index 07659016ab..f607bf0aad 100644

> --- a/io/utime.h

> +++ b/io/utime.h

> @@ -45,6 +45,16 @@ extern int utime (const char *__file,

>  		  const struct utimbuf *__file_times)

>       __THROW __nonnull ((1));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utime, (const char *__file,

> +                                   const struct utimbuf

> *__file_times),

> +                           __utime64);

> +# else

> +# define utime __utime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* utime.h */

> diff --git a/misc/sys/select.h b/misc/sys/select.h

> index 29d011c2d5..779a6e81b6 100644

> --- a/misc/sys/select.h

> +++ b/misc/sys/select.h

> @@ -103,6 +103,19 @@ extern int select (int __nfds, fd_set

> *__restrict __readfds, fd_set *__restrict __exceptfds,

>  		   struct timeval *__restrict __timeout);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (select,

> +                       (int __nfds, fd_set *__restrict __readfds,

> +                        fd_set *__restrict __writefds,

> +                        fd_set *__restrict __exceptfds,

> +                        struct timeval *__restrict __timeout),

> +                       __select64);

> +# else

> +#  define select __select64

> +# endif

> +#endif

> +

>  #ifdef __USE_XOPEN2K

>  /* Same as above only that the TIMEOUT value is given with higher

>     resolution and a sigmask which is been set temporarily.  This

> version @@ -115,6 +128,20 @@ extern int pselect (int __nfds, fd_set

> *__restrict __readfds, fd_set *__restrict __exceptfds,

>  		    const struct timespec *__restrict __timeout,

>  		    const __sigset_t *__restrict __sigmask);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pselect,

> +                       (int __nfds, fd_set *__restrict __readfds,

> +                        fd_set *__restrict __writefds,

> +                        fd_set *__restrict __exceptfds,

> +                        const struct timespec *__restrict __timeout,

> +                        const __sigset_t *__restrict __sigmask),

> +                       __pselect64);

> +#  else

> +#   define pselect __pselect64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/posix/sched.h b/posix/sched.h

> index 60c9c3c710..0d9cbc5bb2 100644

> --- a/posix/sched.h

> +++ b/posix/sched.h

> @@ -76,6 +76,15 @@ extern int sched_get_priority_min (int

> __algorithm) __THROW; /* Get the SCHED_RR interval for the named

> process.  */ extern int sched_rr_get_interval (__pid_t __pid, struct

> timespec *__t) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (sched_rr_get_interval,

> +                           (__pid_t __pid, struct timespec *__t),

> +                           __sched_rr_get_interval64);

> +# else

> +# define sched_rr_get_interval __sched_rr_get_interval64

> +# endif

> +#endif

>  

>  #ifdef __USE_GNU

>  /* Access macros for `cpu_set'.  */

> diff --git a/posix/sys/wait.h b/posix/sys/wait.h

> index a42e16c1b0..68ec036b29 100644

> --- a/posix/sys/wait.h

> +++ b/posix/sys/wait.h

> @@ -146,12 +146,32 @@ struct rusage;

>     otherwise don't.  */

>  extern __pid_t wait3 (int *__stat_loc, int __options,

>  		      struct rusage * __usage) __THROWNL;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int

> __options,

> +                                         struct rusage * __usage)

> +                                 __wait3_time64);

> +#  else

> +#  define wait3 __wait3_time64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_MISC

>  /* PID is like waitpid.  Other args are like wait3.  */

>  extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options,

>  		      struct rusage *__usage) __THROWNL;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern __pid_t __REDIRECT_NTHNL (wait4, (__pid_t __pid, int

> *__stat_loc,

> +                                         int __options, struct

> rusage *__usage),

> +                                 __wait4_time64);

> +#  else

> +#  define wait4 __wait4_time64

> +#  endif

> +# endif

>  #endif /* Use misc.  */

>  

>  

> diff --git a/resolv/netdb.h b/resolv/netdb.h

> index 575e416dac..bd0832988f 100644

> --- a/resolv/netdb.h

> +++ b/resolv/netdb.h

> @@ -701,6 +701,17 @@ extern int getaddrinfo_a (int __mode, struct

> gaicb *__list[__restrict_arr], extern int gai_suspend (const struct

> gaicb *const __list[], int __ent, const struct timespec *__timeout);

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (gai_suspend, (const struct gaicb *const

> __list[],

> +                                     int __ent,

> +                                     const struct timespec

> *__timeout),

> +                       __gai_suspend_time64);

> +#  else

> +#   define gai_suspend __gai_suspend_time64

> +#  endif

> +# endif

> +

>  /* Get the error status of the request REQ.  */

>  extern int gai_error (struct gaicb *__req) __THROW;

>  

> diff --git a/resource/sys/resource.h b/resource/sys/resource.h

> index 4edafb50d5..98f05cf1c4 100644

> --- a/resource/sys/resource.h

> +++ b/resource/sys/resource.h

> @@ -86,6 +86,16 @@ extern int setrlimit64 (__rlimit_resource_t

> __resource, and put it in *USAGE.  Returns 0 for success, -1 for

> failure.  */ extern int getrusage (__rusage_who_t __who, struct

> rusage *__usage) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who,

> +                                       struct rusage *__usage),

> +                           __getrusage64);

> +# else

> +# define getrusage __getrusage64

> +# endif

> +#endif

> +

>  /* Return the highest priority of any process specified by WHICH and

> WHO (see above); if WHO is zero, the current process, process group,

> or user (as specified by WHO) is used.  A lower priority number means

> higher diff --git a/rt/aio.h b/rt/aio.h

> index 148d31a0af..2c35f1b04c 100644

> --- a/rt/aio.h

> +++ b/rt/aio.h

> @@ -193,12 +193,17 @@ extern __ssize_t __REDIRECT_NTH (aio_return,

> (struct aiocb *__aiocbp), extern int __REDIRECT_NTH (aio_cancel,

>  			   (int __fildes, struct aiocb *__aiocbp),

>  			   aio_cancel64);

> -

> +#  ifdef __USE_TIME_BITS64

> +extern int __REDIRECT_NTH (aio_suspend,

> +			   (const struct aiocb *const __list[], int

> __nent,

> +			    const struct timespec *__restrict

> __timeout),

> +			   __aio_suspend_time64) __nonnull ((1));

> +#  else

>  extern int __REDIRECT_NTH (aio_suspend,

>  			   (const struct aiocb *const __list[], int

> __nent, const struct timespec *__restrict __timeout),

>  			   aio_suspend64) __nonnull ((1));

> -

> +#  endif

>  extern int __REDIRECT_NTH (aio_fsync,

>  			   (int __operation, struct aiocb *__aiocbp),

>  			   aio_fsync64) __nonnull ((2));

> @@ -210,7 +215,11 @@ extern int __REDIRECT_NTH (aio_fsync,

>  #  define aio_error aio_error64

>  #  define aio_return aio_return64

>  #  define aio_cancel aio_cancel64

> -#  define aio_suspend aio_suspend64

> +#  ifdef __USE_TIME_BITS64

> +#   define aio_suspend __aio_suspend_time64

> +#  else

> +#   define aio_suspend aio_suspend64

> +#  endif

>  #  define aio_fsync aio_fsync64

>  # endif

>  #endif

> @@ -234,6 +243,16 @@ extern int aio_cancel64 (int __fildes, struct

> aiocb64 *__aiocbp) __THROW; extern int aio_suspend64 (const struct

> aiocb64 *const __list[], int __nent, const struct timespec

> *__restrict __timeout) __THROW __nonnull ((1));

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (aio_suspend64,

> +			   (const struct aiocb *const __list[], int

> __nent,

> +			    const struct timespec *__restrict

> __timeout),

> +			   __aio_suspend_time64) __nonnull ((1));

> +#  else

> +#   define aio_suspend64 __aio_suspend_time64

> +#  endif

> +# endif

>  

>  extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)

>    __THROW __nonnull ((2));

> diff --git a/rt/mqueue.h b/rt/mqueue.h

> index a2a2aa1771..e6b8641c62 100644

> --- a/rt/mqueue.h

> +++ b/rt/mqueue.h

> @@ -79,12 +79,37 @@ extern ssize_t mq_timedreceive (mqd_t __mqdes,

> char *__restrict __msg_ptr, const struct timespec *__restrict

> __abs_timeout) __nonnull ((2, 5));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes,

> +                               char *__restrict __msg_ptr,

> +                               size_t __msg_len,

> +                               unsigned int *__restrict __msg_prio,

> +                               const struct timespec *__restrict

> __abs_timeout),

> +                       __mq_timedreceive_time64);

> +#  else

> +#   define mq_timedreceive __mq_timedreceive_time64

> +#  endif

> +# endif

> +

>  /* Add message pointed by MSG_PTR to message queue MQDES, stop

> blocking on full message queue if ABS_TIMEOUT expires.  */

>  extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,

>  			 size_t __msg_len, unsigned int __msg_prio,

>  			 const struct timespec *__abs_timeout)

>    __nonnull ((2, 5));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes,

> +                       const char *__msg_ptr, size_t __msg_len,

> +                       unsigned int __msg_prio,

> +                       const struct timespec *__abs_timeout),

> +     __mq_timedsend_time64);

> +#  else

> +#   define mq_timedsend __mq_timedsend_time64

> +#  endif

> +# endif

>  #endif

>  

>  /* Define some inlines helping to catch common problems.  */

> diff --git a/signal/signal.h b/signal/signal.h

> index effe3d698f..564820e366 100644

> --- a/signal/signal.h

> +++ b/signal/signal.h

> @@ -274,6 +274,18 @@ extern int sigtimedwait (const sigset_t

> *__restrict __set, const struct timespec *__restrict __timeout)

>       __nonnull ((1));

>  

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT)

> +extern int __REDIRECT (sigtimedwait,

> +                       (const sigset_t *__restrict __set,

> +                        siginfo_t *__restrict __info,

> +                        const struct timespec *__restrict __timeout),

> +                       __sigtimedwait64);

> +#   else

> +#    define sigtimedwait __sigtimedwait64

> +#   endif

> +#  endif

> +

>  /* Send signal SIG to the process PID.  Associate data in VAL with

> the signal.  */

>  extern int sigqueue (__pid_t __pid, int __sig, const union sigval

> __val) diff --git a/socket/sys/socket.h b/socket/sys/socket.h

> index 7780c00ecb..2273c52cdf 100644

> --- a/socket/sys/socket.h

> +++ b/socket/sys/socket.h

> @@ -199,6 +199,17 @@ extern ssize_t recvmsg (int __fd, struct msghdr

> *__message, int __flags); extern int recvmmsg (int __fd, struct

> mmsghdr *__vmessages, unsigned int __vlen, int __flags,

>  		     struct timespec *__tmo);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr

> *__vmessages,

> +                                  unsigned int __vlen, int __flags,

> +                                  struct timespec *__tmo),

> +                       __recvmmsg64);

> +#  else

> +#   define recvmmsg __recvmmsg64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h

> index 3a34d82342..982ed32baa 100644

> --- a/sysdeps/nptl/pthread.h

> +++ b/sysdeps/nptl/pthread.h

> @@ -230,6 +230,17 @@ extern int pthread_tryjoin_np (pthread_t __th,

> void **__thread_return) __THROW; extern int pthread_timedjoin_np

> (pthread_t __th, void **__thread_return, const struct timespec

> *__abstime); 

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_timedjoin_np,

> +                       (pthread_t __th, void **__thread_return,

> +                        const struct timespec *__abstime),

> +                       __pthread_timedjoin_np64);

> +#  else

> +#  define pthread_timedjoin_np __pthread_timedjoin_np64

> +#  endif

> +# endif

> +

>  /* Make calling thread wait for termination of the thread TH, but

> only until TIMEOUT measured against the clock specified by CLOCKID.

> The exit status of the thread is stored in *THREAD_RETURN, if

> @@ -240,6 +251,18 @@ extern int pthread_timedjoin_np (pthread_t __th,

> void **__thread_return, extern int pthread_clockjoin_np (pthread_t

> __th, void **__thread_return, clockid_t __clockid,

>  				 const struct timespec *__abstime);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_clockjoin_np,

> +                       (pthread_t __th, void **__thread_return,

> +                        clockid_t __clockid,

> +                        const struct timespec *__abstime),

> +                       __pthread_clockjoin_np64);

> +#  else

> +#  define pthread_clockjoin_np __pthread_clockjoin_np64

> +#  endif

> +# endif

>  #endif

>  

>  /* Indicate that the thread TH is never to be joined with

> PTHREAD_JOIN. @@ -776,6 +799,17 @@ extern int pthread_mutex_lock

> (pthread_mutex_t *__mutex) extern int pthread_mutex_timedlock

> (pthread_mutex_t *__restrict __mutex, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,

> +                             (pthread_mutex_t *__restrict __mutex,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_mutex_timedlock64);

> +#  else

> +#   define pthread_mutex_timedlock __pthread_mutex_timedlock64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -783,6 +817,18 @@ extern int pthread_mutex_clocklock

> (pthread_mutex_t *__restrict __mutex, clockid_t __clockid,

>  				    const struct timespec *__restrict

>  				    __abstime) __THROWNL __nonnull

> ((1, 3)); +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,

> +                             (pthread_mutex_t *__restrict __mutex,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_mutex_clocklock64);

> +#  else

> +#   define pthread_mutex_clocklock __pthread_mutex_clocklock64

> +#  endif

> +# endif

>  #endif

>  

>  /* Unlock a mutex.  */

> @@ -922,6 +968,17 @@ extern int pthread_rwlock_tryrdlock

> (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedrdlock

> (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_timedrdlock64);

> +#   else

> +#    define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64

> +#   endif

> +#  endif

>  # endif

>  

>  # ifdef __USE_GNU

> @@ -929,6 +986,18 @@ extern int pthread_rwlock_clockrdlock

> (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

>  				       const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_clockrdlock64);

> +#   else

> +#    define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Acquire write lock for RWLOCK.  */

> @@ -944,6 +1013,17 @@ extern int pthread_rwlock_trywrlock

> (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedwrlock

> (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_timedwrlock64);

> +#   else

> +#    define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64

> +#   endif

> +#  endif

>  # endif

>  

>  # ifdef __USE_GNU

> @@ -951,6 +1031,18 @@ extern int pthread_rwlock_clockwrlock

> (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

>  				       const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_clockwrlock64);

> +#   else

> +#    define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Unlock RWLOCK.  */

> @@ -1032,6 +1124,18 @@ extern int pthread_cond_timedwait

> (pthread_cond_t *__restrict __cond, const struct timespec *__restrict

> __abstime) __nonnull ((1, 2, 3));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_cond_timedwait,

> +                       (pthread_cond_t *__restrict __cond,

> +                        pthread_mutex_t *__restrict __mutex,

> +                        const struct timespec *__restrict __abstime),

> +                       __pthread_cond_timedwait64);

> +#  else

> +#  define pthread_cond_timedwait __pthread_cond_timedwait64

> +#  endif

> +# endif

> +

>  # ifdef __USE_GNU

>  /* Wait for condition variable COND to be signaled or broadcast until

>     ABSTIME measured by the specified clock. MUTEX is assumed to be

> @@ -1045,6 +1149,19 @@ extern int pthread_cond_clockwait

> (pthread_cond_t *__restrict __cond, __clockid_t __clock_id,

>  				   const struct timespec *__restrict

> __abstime) __nonnull ((1, 2, 4));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_cond_clockwait,

> +                       (pthread_cond_t *__restrict __cond,

> +                        pthread_mutex_t *__restrict __mutex,

> +                        __clockid_t __clock_id,

> +                        const struct timespec *__restrict __abstime),

> +                       __pthread_cond_clockwait64);

> +#   else

> +#   define pthread_cond_clockwait __pthread_cond_clockwait64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Functions for handling condition variable attributes.  */

> diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h

> index 436d21cb08..6a6055fc3a 100644

> --- a/sysdeps/pthread/semaphore.h

> +++ b/sysdeps/pthread/semaphore.h

> @@ -62,6 +62,17 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1));

>  extern int sem_timedwait (sem_t *__restrict __sem,

>  			  const struct timespec *__restrict

> __abstime) __nonnull ((1, 2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (sem_timedwait,

> +                       (sem_t *__restrict __sem,

> +                        const struct timespec *__restrict __abstime),

> +                        __sem_timedwait64);

> +#  else

> +#   define sem_timedwait __sem_timedwait64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -69,6 +80,18 @@ extern int sem_clockwait (sem_t *__restrict __sem,

>  			  clockid_t clock,

>  			  const struct timespec *__restrict

> __abstime) __nonnull ((1, 3));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (sem_clockwait,

> +                       (sem_t *__restrict __sem,

> +                        clockid_t clock,

> +                        const struct timespec *__restrict __abstime),

> +                        __sem_clockwait64);

> +#  else

> +#   define sem_clockwait __sem_clockwait64

> +#  endif

> +# endif

>  #endif

>  

>  /* Test whether SEM is posted.  */

> diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h

> index 0ac489b4a1..acdc7b329a 100644

> --- a/sysdeps/pthread/threads.h

> +++ b/sysdeps/pthread/threads.h

> @@ -91,6 +91,16 @@ extern thrd_t thrd_current (void);

>  extern int thrd_sleep (const struct timespec *__time_point,

>  		       struct timespec *__remaining);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (thrd_sleep, (const struct timespec

> *__time_point,

> +                                    struct timespec *__remaining),

> +                       __thrd_sleep64);

> +# else

> +#  define thrd_sleep __thrd_sleep64

> +# endif

> +#endif

> +

>  /* Terminate current thread execution, cleaning up any thread local

>     storage and freeing resources.  Returns the value specified in

> __RES.  */ extern void thrd_exit (int __res) __attribute__

> ((__noreturn__)); @@ -134,6 +144,17 @@ extern int mtx_lock (mtx_t

> *__mutex); extern int mtx_timedlock (mtx_t *__restrict __mutex,

>  			  const struct timespec *__restrict

> __time_point); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (mtx_timedlock, (mtx_t *__restrict __mutex,

> +                                       const struct timespec

> *__restrict

> +                                       __time_point),

> +                       __mtx_timedlock64);

> +# else

> +#  define mtx_timedlock __mtx_timedlock64

> +# endif

> +#endif

> +

>  /* Try to lock the mutex pointed by __MUTEX without blocking.  If

> the mutex is free the current threads takes control of it, otherwise

> it returns immediately.  */

> @@ -175,6 +196,18 @@ extern int cnd_timedwait (cnd_t *__restrict

> __cond, mtx_t *__restrict __mutex,

>  			  const struct timespec *__restrict

> __time_point); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (cnd_timedwait, (cnd_t *__restrict __cond,

> +                                       mtx_t *__restrict __mutex,

> +                                       const struct timespec

> *__restrict

> +                                       __time_point),

> +                       __cnd_timedwait64);

> +# else

> +#  define cnd_timedwait __cnd_timedwait64

> +# endif

> +#endif

> +

>  /* Destroy condition variable pointed by __cond and free all of its

>     resources.  */

>  extern void cnd_destroy (cnd_t *__COND);

> diff --git a/sysdeps/unix/sysv/linux/bits/time.h

> b/sysdeps/unix/sysv/linux/bits/time.h index e0962744e1..7168ef1948

> 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h

> +++ b/sysdeps/unix/sysv/linux/bits/time.h

> @@ -77,6 +77,16 @@ __BEGIN_DECLS

>  /* Tune a POSIX clock.  */

>  extern int clock_adjtime (__clockid_t __clock_id, struct timex

> *__utx) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id,

> +                                           struct timex *__utx),

> +                           __clock_adjtime64);

> +# else

> +# define clock_adjtime __clock_adjtime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  #endif /* use GNU */

>  

> diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h

> b/sysdeps/unix/sysv/linux/sys/timerfd.h index 0ae60b65bd..cd252476a7

> 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h

> +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h

> @@ -47,9 +47,31 @@ extern int timerfd_settime (int __ufd, int __flags,

>  			    const struct itimerspec *__utmr,

>  			    struct itimerspec *__otmr) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timerfd_settime,

> +                           (int __ufd, int __flags,

> +                            const struct itimerspec *__restrict

> __value,

> +                            struct itimerspec *__restrict __ovalue),

> +                           __timerfd_settime64);

> +# else

> +# define timerfd_settime __timerfd_settime64

> +# endif

> +#endif

> +

>  /* Return the next expiration time of UFD.  */

>  extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd,

> +                                             struct itimerspec

> *__otmr),

> +                           __timerfd_gettime64);

> +# else

> +# define timerfd_gettime __timerfd_gettime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* sys/timerfd.h */

> diff --git a/sysdeps/unix/sysv/linux/sys/timex.h

> b/sysdeps/unix/sysv/linux/sys/timex.h index 6979b86b72..b5271152bb

> 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h

> +++ b/sysdeps/unix/sysv/linux/sys/timex.h

> @@ -57,15 +57,46 @@ __BEGIN_DECLS

>  extern int __adjtimex (struct timex *__ntx) __THROW;

>  extern int adjtimex (struct timex *__ntx) __THROW;

>  

> -#ifdef __REDIRECT_NTH

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),

> +                           ___adjtimex64);

> +# else

> +# define adjtimex ___adjtimex64

> +# endif

> +#endif

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

>  extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> -			   ntp_gettimex);

> +                           __ntp_gettime64);

> +extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),

> +                           __ntp_gettimex64);

> +# else

> +# define ntp_gettime __ntp_gettime64

> +# define ntp_gettimex __ntp_gettimex64

> +# endif

>  #else

> +# ifdef __REDIRECT_NTH

> +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> +			   ntp_gettimex);

> +# else

>  extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;

> -# define ntp_gettime ntp_gettimex

> +#  define ntp_gettime ntp_gettimex

> +# endif

>  #endif

> +

>  extern int ntp_adjtime (struct timex *__tntx) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),

> +                           ___adjtimex64);

> +# else

> +# define ntp_adjtime ___adjtimex64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* sys/timex.h */

> diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h

> index c70cfa582c..f39c153b86 100644

> --- a/sysvipc/sys/msg.h

> +++ b/sysvipc/sys/msg.h

> @@ -60,6 +60,16 @@ __BEGIN_DECLS

>  /* Message queue control operation.  */

>  extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (msgctl,

> +                           (int __msqid, int __cmd, struct msqid_ds

> *__buf),

> +                           __msgctl64);

> +# else

> +# define msgctl __msgctl64

> +# endif

> +#endif

> +

>  /* Get messages queue.  */

>  extern int msgget (key_t __key, int __msgflg) __THROW;

>  

> diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h

> index 4ede2dd6ef..b26c17914c 100644

> --- a/sysvipc/sys/sem.h

> +++ b/sysvipc/sys/sem.h

> @@ -50,6 +50,16 @@ __BEGIN_DECLS

>  /* Semaphore control operation.  */

>  extern int semctl (int __semid, int __semnum, int __cmd, ...)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (semctl,

> +                           (int __semid, int __semnum, int __cmd,

> ...),

> +                           __semctl64);

> +# else

> +# define semctl __semctl64

> +# endif

> +#endif

> +

>  /* Get semaphore.  */

>  extern int semget (key_t __key, int __nsems, int __semflg) __THROW;

>  

> @@ -60,6 +70,17 @@ extern int semop (int __semid, struct sembuf

> *__sops, size_t __nsops) __THROW; /* Operate on semaphore with

> timeout.  */ extern int semtimedop (int __semid, struct sembuf

> *__sops, size_t __nsops, const struct timespec *__timeout) __THROW;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (semtimedop, (int __semid, struct sembuf

> *__sops,

> +                                        size_t __nsops,

> +                                        const struct timespec

> *__timeout),

> +                           __semtimedop64);

> +#  else

> +#  define semtimedop __semtimedop64

> +#  endif

> +# endif

>  #endif

>  

>  __END_DECLS

> diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h

> index 6c58742c4f..8d74911e55 100644

> --- a/sysvipc/sys/shm.h

> +++ b/sysvipc/sys/shm.h

> @@ -48,6 +48,16 @@ __BEGIN_DECLS

>  /* Shared memory control operation.  */

>  extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (shmctl,

> +                           (int __shmid, int __cmd, struct shmid_ds

> *__buf),

> +                           __shmctl64);

> +# else

> +# define shmctl __shmctl64

> +# endif

> +#endif

> +

>  /* Get shared memory segment.  */

>  extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW;

>  

> diff --git a/time/sys/time.h b/time/sys/time.h

> index 21fa9ed451..d3bf1e6588 100644

> --- a/time/sys/time.h

> +++ b/time/sys/time.h

> @@ -66,6 +66,16 @@ struct timezone

>  extern int gettimeofday (struct timeval *__restrict __tv,

>  			 void *__restrict __tz) __THROW __nonnull

> ((1)); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict

> __tv,

> +                                          void *__restrict __tz),

> +                           __gettimeofday64);

> +# else

> +# define gettimeofday __gettimeofday64

> +# endif

> +#endif

> +

>  #ifdef __USE_MISC

>  /* Set the current time of day and timezone information.

>     This call is restricted to the super-user.

> @@ -76,12 +86,33 @@ extern int settimeofday (const struct timeval

> *__tv, const struct timezone *__tz)

>       __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (settimeofday, (const struct timeval *__tv,

> +                                          const struct timezone

> *__tz),

> +                           __settimeofday64);

> +# else

> +# define settimeofday __settimeofday64

> +# endif

> +#endif

> +

>  /* Adjust the current time of day by the amount in DELTA.

>     If OLDDELTA is not NULL, it is filled in with the amount

>     of time adjustment remaining to be done from the last `adjtime'

> call. This call is restricted to the super-user.  */

>  extern int adjtime (const struct timeval *__delta,

>  		    struct timeval *__olddelta) __THROW;

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (adjtime, (const struct timeval *__delta,

> +                                     struct timeval *__olddelta),

> +                           __adjtime64);

> +# else

> +# define adjtime __adjtime64

> +# endif

> +#endif

> +

>  #endif

>  

>  

> @@ -123,6 +154,16 @@ typedef int __itimer_which_t;

>  extern int getitimer (__itimer_which_t __which,

>  		      struct itimerval *__value) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (getitimer, (__itimer_which_t __which,

> +                                       struct itimerval *__value),

> +                           __getitimer64);

> +# else

> +# define getitimer __getitimer64

> +# endif

> +#endif

> +

>  /* Set the timer WHICH to *NEW.  If OLD is not NULL,

>     set *OLD to the old value of timer WHICH.

>     Returns 0 on success, -1 on errors.  */

> @@ -130,19 +171,59 @@ extern int setitimer (__itimer_which_t __which,

>  		      const struct itimerval *__restrict __new,

>  		      struct itimerval *__restrict __old) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (setitimer, (__itimer_which_t __which,

> +                                       const struct itimerval

> *__restrict __new,

> +                                       struct itimerval *__restrict

> __old),

> +                           __setitimer64);

> +# else

> +# define setitimer __setitimer64

> +# endif

> +#endif

> +

>  /* Change the access time of FILE to TVP[0] and the modification

> time of FILE to TVP[1].  If TVP is a null pointer, use the current

> time instead. Returns 0 on success, -1 on errors.  */

>  extern int utimes (const char *__file, const struct timeval __tvp[2])

>       __THROW __nonnull ((1));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utimes, (const char *__file,

> +                                    const struct timeval __tvp[2]),

> +                           __utimes64);

> +# else

> +# define utimes __utimes64

> +# endif

> +#endif

> +

>  #ifdef __USE_MISC

>  /* Same as `utimes', but does not follow symbolic links.  */

>  extern int lutimes (const char *__file, const struct timeval

> __tvp[2]) __THROW __nonnull ((1));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (lutimes, (const char *__file,

> +                                     const struct timeval __tvp[2]),

> +                           __lutimes64);

> +#  else

> +#   define lutimes __lutimes64

> +#  endif

> +# endif

> +

>  /* Same as `utimes', but takes an open file descriptor instead of a

> name.  */ extern int futimes (int __fd, const struct timeval

> __tvp[2]) __THROW; +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval

> __tvp[2]),

> +                           __futimes64);

> +#  else

> +#   define futimes __futimes64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -151,6 +232,16 @@ extern int futimes (int __fd, const struct

> timeval __tvp[2]) __THROW; the current time instead.  Returns 0 on

> success, -1 on errors.  */ extern int futimesat (int __fd, const char

> *__file, const struct timeval __tvp[2]) __THROW;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimesat, (int __fd, const char *__file,

> +                                       const struct timeval

> __tvp[2]),

> +                           __futimesat64);

> +#  else

> +#   define futimesat __futimesat64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/time/time.h b/time/time.h

> index 015bc1c7f3..9a74f01b2f 100644

> --- a/time/time.h

> +++ b/time/time.h

> @@ -74,13 +74,37 @@ extern clock_t clock (void) __THROW;

>  /* Return the current time and put it in *TIMER if TIMER is not

> NULL.  */ extern time_t time (time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64);

> +# else

> +# define time __time64

> +# endif

> +#endif

> +

>  /* Return the difference between TIME1 and TIME0.  */

>  extern double difftime (time_t __time1, time_t __time0)

>       __THROW __attribute__ ((__const__));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t

> __time0),

> +                              __difftime64);

> +# else

> +# define difftime __difftime64

> +# endif

> +#endif

> +

>  /* Return the `time_t' representation of TP and normalize TP.  */

>  extern time_t mktime (struct tm *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64);

> +# else

> +# define mktime __mktime64

> +# endif

> +#endif

>  

>  /* Format TP into S according to FORMAT.

>     Write no more than MAXSIZE characters and return the number

> @@ -118,6 +142,14 @@ extern char *strptime_l (const char *__restrict

> __s, in Universal Coordinated Time (aka Greenwich Mean Time).  */

>  extern struct tm *gmtime (const time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer),

> __gmtime64); +# else

> +# define gmtime __gmtime64

> +# endif

> +#endif

> +

>  /* Return the `struct tm' representation

>     of *TIMER in the local timezone.  */

>  extern struct tm *localtime (const time_t *__timer) __THROW;

> @@ -128,6 +160,16 @@ extern struct tm *localtime (const time_t

> *__timer) __THROW; extern struct tm *gmtime_r (const time_t

> *__restrict __timer, struct tm *__restrict __tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t *__restrict

> __timer,

> +                                            struct tm *__restrict

> __tp),

> +                                 __gmtime64_r);

> +# else

> +# define gmtime_r __gmtime64_r

> +# endif

> +#endif

> +

>  /* Return the `struct tm' representation of *TIMER in local time,

>     using *TP to store the result.  */

>  extern struct tm *localtime_r (const time_t *__restrict __timer,

> @@ -141,6 +183,14 @@ extern char *asctime (const struct tm *__tp)

> __THROW; /* Equivalent to `asctime (localtime (timer))'.  */

>  extern char *ctime (const time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern char *__REDIRECT_NTH (ctime, (const time_t *__timer),

> __ctime64); +# else

> +# define ctime __ctime64

> +# endif

> +#endif

> +

>  #if defined __USE_POSIX || __GLIBC_USE (ISOC2X)

>  /* Reentrant versions of the above functions.  */

>  

> @@ -152,6 +202,16 @@ extern char *asctime_r (const struct tm

> *__restrict __tp, /* Equivalent to `asctime_r (localtime_r (timer,

> *TMP*), buf)'.  */ extern char *ctime_r (const time_t *__restrict

> __timer, char *__restrict __buf) __THROW;

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict

> __timer,

> +                                       char *__restrict __buf),

> __ctime64_r); +# else

> +# define ctime_r __ctime64_r

> +# endif

> +#endif

> +

>  #endif	/* POSIX || C2X */

>  

>  

> @@ -189,6 +249,14 @@ extern long int timezone;

>  /* Like `mktime', but for TP represents Universal Time, not local

> time.  */ extern time_t timegm (struct tm *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);

> +# else

> +# define timegm __timegm64

> +# endif

> +#endif

> +

>  /* Another name for `mktime'.  */

>  extern time_t timelocal (struct tm *__tp) __THROW;

>  

> @@ -205,17 +273,54 @@ extern int dysize (int __year) __THROW

> __attribute__ ((__const__)); extern int nanosleep (const struct

> timespec *__requested_time, struct timespec *__remaining);

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (nanosleep, (const struct timespec

> *__requested_time,

> +                                   struct timespec *__remaining),

> +                       __nanosleep64);

> +#  else

> +#   define nanosleep __nanosleep64

> +#  endif

> +# endif

>  

>  /* Get resolution of clock CLOCK_ID.  */

>  extern int clock_getres (clockid_t __clock_id, struct timespec

> *__res) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id,

> +                                          struct timespec *__res),

> +                           __clock_getres64);

> +# else

> +# define clock_getres __clock_getres64

> +# endif

> +#endif

> +

>  /* Get current value of clock CLOCK_ID and store it in TP.  */

>  extern int clock_gettime (clockid_t __clock_id, struct timespec

> *__tp) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id,

> struct

> +                                           timespec *__tp),

> __clock_gettime64); +# else

> +# define clock_gettime __clock_gettime64

> +# endif

> +#endif

> +

>  /* Set clock CLOCK_ID to value TP.  */

>  extern int clock_settime (clockid_t __clock_id, const struct

> timespec *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id,

> const struct

> +                                           timespec *__tp),

> __clock_settime64); +# else

> +# define clock_settime __clock_settime64

> +# endif

> +#endif

> +

>  # ifdef __USE_XOPEN2K

>  /* High-resolution sleep with the specified clock.

>  

> @@ -225,6 +330,17 @@ extern int clock_nanosleep (clockid_t

> __clock_id, int __flags, const struct timespec *__req,

>  			    struct timespec *__rem);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int

> __flags,

> +                                         const struct timespec

> *__req,

> +                                         struct timespec *__rem),

> +                       __clock_nanosleep_time64);

> +# else

> +# define clock_nanosleep __clock_nanosleep_time64

> +# endif

> +#endif

> +

>  /* Return clock ID for CPU-time clock.  */

>  extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id)

> __THROW; # endif

> @@ -243,10 +359,31 @@ extern int timer_settime (timer_t __timerid,

> int __flags, const struct itimerspec *__restrict __value,

>  			  struct itimerspec *__restrict __ovalue)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int

> __flags,

> +     const struct itimerspec *__restrict __value,

> +     struct itimerspec *__restrict __ovalue),

> +                          __timer_settime64);

> +# else

> +# define timer_settime __timer_settime64

> +# endif

> +#endif

> +

>  /* Get current value of timer TIMERID and store it in VALUE.  */

>  extern int timer_gettime (timer_t __timerid, struct itimerspec

> *__value) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid,

> +                                           struct itimerspec

> *__value),

> +                           __timer_gettime64) __nonnull ((1));

> +# else

> +# define timer_gettime __timer_gettime64

> +# endif

> +#endif

> +

>  /* Get expiration overrun for timer TIMERID.  */

>  extern int timer_getoverrun (timer_t __timerid) __THROW;

>  #endif

> @@ -256,6 +393,15 @@ extern int timer_getoverrun (timer_t __timerid)

> __THROW; /* Set TS to calendar time based in time base BASE.  */

>  extern int timespec_get (struct timespec *__ts, int __base)

>       __THROW __nonnull ((1));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int

> __base),

> +                           __timespec_get64);

> +#  else

> +#  define timespec_get __timespec_get64

> +#  endif

> +# endif

>  #endif

>  

>  





Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Lukasz Majewski Feb. 3, 2021, 2:09 p.m. | #2
Hi Adhemerval, Joseph, Florian,

> Dear Community,

> 

> I do know that the "freeze" time for glibc release is coming, but I

> would be very happy to receive feedback on this patch.


The glibc 2.33 is now out - do you mind if I pull this patch? It is a
preparatory patch for Y2038 support and is inactive until support for
_TIME_BITS flag is added.

> 

> It is the attempt to divide the Y2038 support to smaller chunks, so it

> would be easier to review.

> 

> > Exported headers have been modified to provide redirections to 64

> > bit functions when __USE_TIME_BITS64 is defined - this exported

> > flag is set only when _TIME_BITS=64 and _FILE_OFFSET_BITS=64 are

> > set on compilation time.

> > For example, when __USE_TIME_BIT64 is defined - calls to

> > clock_settime are redirected to clock_settime64, which supports

> > setting 64 bit time in glibc ports with __WORDSIZE==32 and

> > __TIMESIZE != 64.

> > 

> > This patch is the preparatory one for addressing Y2038 issue and as

> > such will be inactive until support for _TIME_BITS exported flag is

> > added, which in turn causes definition of __USE_TIME_BITS64.  

> 

> To emphasize - this patch set will not introduce any harm, as

> __USE_TIME_BITS64 will be NOT defined until the support for 64 bit

> time is added to glibc.

> 

> > ---

> >  io/sys/poll.h                         |  11 ++

> >  io/sys/stat.h                         |  20 ++++

> >  io/utime.h                            |  10 ++

> >  misc/sys/select.h                     |  27 +++++

> >  posix/sched.h                         |   9 ++

> >  posix/sys/wait.h                      |  20 ++++

> >  resolv/netdb.h                        |  11 ++

> >  resource/sys/resource.h               |  10 ++

> >  rt/aio.h                              |  25 ++++-

> >  rt/mqueue.h                           |  25 +++++

> >  signal/signal.h                       |  12 +++

> >  socket/sys/socket.h                   |  11 ++

> >  sysdeps/nptl/pthread.h                | 117 +++++++++++++++++++++

> >  sysdeps/pthread/semaphore.h           |  23 ++++

> >  sysdeps/pthread/threads.h             |  33 ++++++

> >  sysdeps/unix/sysv/linux/bits/time.h   |  10 ++

> >  sysdeps/unix/sysv/linux/sys/timerfd.h |  22 ++++

> >  sysdeps/unix/sysv/linux/sys/timex.h   |  37 ++++++-

> >  sysvipc/sys/msg.h                     |  10 ++

> >  sysvipc/sys/sem.h                     |  21 ++++

> >  sysvipc/sys/shm.h                     |  10 ++

> >  time/sys/time.h                       |  91 ++++++++++++++++

> >  time/time.h                           | 146

> > ++++++++++++++++++++++++++ 23 files changed, 705 insertions(+), 6

> > deletions(-)

> > 

> > diff --git a/io/sys/poll.h b/io/sys/poll.h

> > index 857be0f5ac..4a725ed18e 100644

> > --- a/io/sys/poll.h

> > +++ b/io/sys/poll.h

> > @@ -63,6 +63,17 @@ extern int poll (struct pollfd *__fds, nfds_t

> > __nfds, int __timeout); extern int ppoll (struct pollfd *__fds,

> > nfds_t __nfds, const struct timespec *__timeout,

> >  		  const __sigset_t *__ss);

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds,

> > +                               const struct timespec *__timeout,

> > +                               const __sigset_t *__ss),

> > +                       __ppoll64);

> > +#  else

> > +#  define ppoll __ppoll64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  __END_DECLS

> > diff --git a/io/sys/stat.h b/io/sys/stat.h

> > index 58c3770622..b3f2f0da99 100644

> > --- a/io/sys/stat.h

> > +++ b/io/sys/stat.h

> > @@ -361,11 +361,31 @@ extern int utimensat (int __fd, const char

> > *__path, const struct timespec __times[2],

> >  		      int __flags)

> >       __THROW __nonnull ((2));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,

> > +                                       const struct timespec

> > __times[2],

> > +                                       int flags),

> > +                           __utimensat64) __nonnull ((2));

> > +#  else

> > +#  define utimensat __utimensat64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_XOPEN2K8

> >  /* Set file access and modification times of the file associated

> > with FD.  */ extern int futimens (int __fd, const struct timespec

> > __times[2]) __THROW; +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec

> > __times[2]),

> > +                           __futimens64);

> > +#  else

> > +#  define futimens __futimens64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_GNU

> > diff --git a/io/utime.h b/io/utime.h

> > index 07659016ab..f607bf0aad 100644

> > --- a/io/utime.h

> > +++ b/io/utime.h

> > @@ -45,6 +45,16 @@ extern int utime (const char *__file,

> >  		  const struct utimbuf *__file_times)

> >       __THROW __nonnull ((1));

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (utime, (const char *__file,

> > +                                   const struct utimbuf

> > *__file_times),

> > +                           __utime64);

> > +# else

> > +# define utime __utime64

> > +# endif

> > +#endif

> > +

> >  __END_DECLS

> >  

> >  #endif /* utime.h */

> > diff --git a/misc/sys/select.h b/misc/sys/select.h

> > index 29d011c2d5..779a6e81b6 100644

> > --- a/misc/sys/select.h

> > +++ b/misc/sys/select.h

> > @@ -103,6 +103,19 @@ extern int select (int __nfds, fd_set

> > *__restrict __readfds, fd_set *__restrict __exceptfds,

> >  		   struct timeval *__restrict __timeout);

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT)

> > +extern int __REDIRECT (select,

> > +                       (int __nfds, fd_set *__restrict __readfds,

> > +                        fd_set *__restrict __writefds,

> > +                        fd_set *__restrict __exceptfds,

> > +                        struct timeval *__restrict __timeout),

> > +                       __select64);

> > +# else

> > +#  define select __select64

> > +# endif

> > +#endif

> > +

> >  #ifdef __USE_XOPEN2K

> >  /* Same as above only that the TIMEOUT value is given with higher

> >     resolution and a sigmask which is been set temporarily.  This

> > version @@ -115,6 +128,20 @@ extern int pselect (int __nfds, fd_set

> > *__restrict __readfds, fd_set *__restrict __exceptfds,

> >  		    const struct timespec *__restrict __timeout,

> >  		    const __sigset_t *__restrict __sigmask);

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (pselect,

> > +                       (int __nfds, fd_set *__restrict __readfds,

> > +                        fd_set *__restrict __writefds,

> > +                        fd_set *__restrict __exceptfds,

> > +                        const struct timespec *__restrict

> > __timeout,

> > +                        const __sigset_t *__restrict __sigmask),

> > +                       __pselect64);

> > +#  else

> > +#   define pselect __pselect64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  

> > diff --git a/posix/sched.h b/posix/sched.h

> > index 60c9c3c710..0d9cbc5bb2 100644

> > --- a/posix/sched.h

> > +++ b/posix/sched.h

> > @@ -76,6 +76,15 @@ extern int sched_get_priority_min (int

> > __algorithm) __THROW; /* Get the SCHED_RR interval for the named

> > process.  */ extern int sched_rr_get_interval (__pid_t __pid, struct

> > timespec *__t) __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (sched_rr_get_interval,

> > +                           (__pid_t __pid, struct timespec *__t),

> > +                           __sched_rr_get_interval64);

> > +# else

> > +# define sched_rr_get_interval __sched_rr_get_interval64

> > +# endif

> > +#endif

> >  

> >  #ifdef __USE_GNU

> >  /* Access macros for `cpu_set'.  */

> > diff --git a/posix/sys/wait.h b/posix/sys/wait.h

> > index a42e16c1b0..68ec036b29 100644

> > --- a/posix/sys/wait.h

> > +++ b/posix/sys/wait.h

> > @@ -146,12 +146,32 @@ struct rusage;

> >     otherwise don't.  */

> >  extern __pid_t wait3 (int *__stat_loc, int __options,

> >  		      struct rusage * __usage) __THROWNL;

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTHNL)

> > +extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int

> > __options,

> > +                                         struct rusage * __usage)

> > +                                 __wait3_time64);

> > +#  else

> > +#  define wait3 __wait3_time64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_MISC

> >  /* PID is like waitpid.  Other args are like wait3.  */

> >  extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int

> > __options, struct rusage *__usage) __THROWNL;

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTHNL)

> > +extern __pid_t __REDIRECT_NTHNL (wait4, (__pid_t __pid, int

> > *__stat_loc,

> > +                                         int __options, struct

> > rusage *__usage),

> > +                                 __wait4_time64);

> > +#  else

> > +#  define wait4 __wait4_time64

> > +#  endif

> > +# endif

> >  #endif /* Use misc.  */

> >  

> >  

> > diff --git a/resolv/netdb.h b/resolv/netdb.h

> > index 575e416dac..bd0832988f 100644

> > --- a/resolv/netdb.h

> > +++ b/resolv/netdb.h

> > @@ -701,6 +701,17 @@ extern int getaddrinfo_a (int __mode, struct

> > gaicb *__list[__restrict_arr], extern int gai_suspend (const struct

> > gaicb *const __list[], int __ent, const struct timespec *__timeout);

> >  

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (gai_suspend, (const struct gaicb *const

> > __list[],

> > +                                     int __ent,

> > +                                     const struct timespec

> > *__timeout),

> > +                       __gai_suspend_time64);

> > +#  else

> > +#   define gai_suspend __gai_suspend_time64

> > +#  endif

> > +# endif

> > +

> >  /* Get the error status of the request REQ.  */

> >  extern int gai_error (struct gaicb *__req) __THROW;

> >  

> > diff --git a/resource/sys/resource.h b/resource/sys/resource.h

> > index 4edafb50d5..98f05cf1c4 100644

> > --- a/resource/sys/resource.h

> > +++ b/resource/sys/resource.h

> > @@ -86,6 +86,16 @@ extern int setrlimit64 (__rlimit_resource_t

> > __resource, and put it in *USAGE.  Returns 0 for success, -1 for

> > failure.  */ extern int getrusage (__rusage_who_t __who, struct

> > rusage *__usage) __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who,

> > +                                       struct rusage *__usage),

> > +                           __getrusage64);

> > +# else

> > +# define getrusage __getrusage64

> > +# endif

> > +#endif

> > +

> >  /* Return the highest priority of any process specified by WHICH

> > and WHO (see above); if WHO is zero, the current process, process

> > group, or user (as specified by WHO) is used.  A lower priority

> > number means higher diff --git a/rt/aio.h b/rt/aio.h

> > index 148d31a0af..2c35f1b04c 100644

> > --- a/rt/aio.h

> > +++ b/rt/aio.h

> > @@ -193,12 +193,17 @@ extern __ssize_t __REDIRECT_NTH (aio_return,

> > (struct aiocb *__aiocbp), extern int __REDIRECT_NTH (aio_cancel,

> >  			   (int __fildes, struct aiocb *__aiocbp),

> >  			   aio_cancel64);

> > -

> > +#  ifdef __USE_TIME_BITS64

> > +extern int __REDIRECT_NTH (aio_suspend,

> > +			   (const struct aiocb *const __list[], int

> > __nent,

> > +			    const struct timespec *__restrict

> > __timeout),

> > +			   __aio_suspend_time64) __nonnull ((1));

> > +#  else

> >  extern int __REDIRECT_NTH (aio_suspend,

> >  			   (const struct aiocb *const __list[], int

> > __nent, const struct timespec *__restrict __timeout),

> >  			   aio_suspend64) __nonnull ((1));

> > -

> > +#  endif

> >  extern int __REDIRECT_NTH (aio_fsync,

> >  			   (int __operation, struct aiocb

> > *__aiocbp), aio_fsync64) __nonnull ((2));

> > @@ -210,7 +215,11 @@ extern int __REDIRECT_NTH (aio_fsync,

> >  #  define aio_error aio_error64

> >  #  define aio_return aio_return64

> >  #  define aio_cancel aio_cancel64

> > -#  define aio_suspend aio_suspend64

> > +#  ifdef __USE_TIME_BITS64

> > +#   define aio_suspend __aio_suspend_time64

> > +#  else

> > +#   define aio_suspend aio_suspend64

> > +#  endif

> >  #  define aio_fsync aio_fsync64

> >  # endif

> >  #endif

> > @@ -234,6 +243,16 @@ extern int aio_cancel64 (int __fildes, struct

> > aiocb64 *__aiocbp) __THROW; extern int aio_suspend64 (const struct

> > aiocb64 *const __list[], int __nent, const struct timespec

> > *__restrict __timeout) __THROW __nonnull ((1));

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (aio_suspend64,

> > +			   (const struct aiocb *const __list[], int

> > __nent,

> > +			    const struct timespec *__restrict

> > __timeout),

> > +			   __aio_suspend_time64) __nonnull ((1));

> > +#  else

> > +#   define aio_suspend64 __aio_suspend_time64

> > +#  endif

> > +# endif

> >  

> >  extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)

> >    __THROW __nonnull ((2));

> > diff --git a/rt/mqueue.h b/rt/mqueue.h

> > index a2a2aa1771..e6b8641c62 100644

> > --- a/rt/mqueue.h

> > +++ b/rt/mqueue.h

> > @@ -79,12 +79,37 @@ extern ssize_t mq_timedreceive (mqd_t __mqdes,

> > char *__restrict __msg_ptr, const struct timespec *__restrict

> > __abs_timeout) __nonnull ((2, 5));

> >  

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes,

> > +                               char *__restrict __msg_ptr,

> > +                               size_t __msg_len,

> > +                               unsigned int *__restrict __msg_prio,

> > +                               const struct timespec *__restrict

> > __abs_timeout),

> > +                       __mq_timedreceive_time64);

> > +#  else

> > +#   define mq_timedreceive __mq_timedreceive_time64

> > +#  endif

> > +# endif

> > +

> >  /* Add message pointed by MSG_PTR to message queue MQDES, stop

> > blocking on full message queue if ABS_TIMEOUT expires.  */

> >  extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,

> >  			 size_t __msg_len, unsigned int __msg_prio,

> >  			 const struct timespec *__abs_timeout)

> >    __nonnull ((2, 5));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes,

> > +                       const char *__msg_ptr, size_t __msg_len,

> > +                       unsigned int __msg_prio,

> > +                       const struct timespec *__abs_timeout),

> > +     __mq_timedsend_time64);

> > +#  else

> > +#   define mq_timedsend __mq_timedsend_time64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  /* Define some inlines helping to catch common problems.  */

> > diff --git a/signal/signal.h b/signal/signal.h

> > index effe3d698f..564820e366 100644

> > --- a/signal/signal.h

> > +++ b/signal/signal.h

> > @@ -274,6 +274,18 @@ extern int sigtimedwait (const sigset_t

> > *__restrict __set, const struct timespec *__restrict __timeout)

> >       __nonnull ((1));

> >  

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT)

> > +extern int __REDIRECT (sigtimedwait,

> > +                       (const sigset_t *__restrict __set,

> > +                        siginfo_t *__restrict __info,

> > +                        const struct timespec *__restrict

> > __timeout),

> > +                       __sigtimedwait64);

> > +#   else

> > +#    define sigtimedwait __sigtimedwait64

> > +#   endif

> > +#  endif

> > +

> >  /* Send signal SIG to the process PID.  Associate data in VAL with

> > the signal.  */

> >  extern int sigqueue (__pid_t __pid, int __sig, const union sigval

> > __val) diff --git a/socket/sys/socket.h b/socket/sys/socket.h

> > index 7780c00ecb..2273c52cdf 100644

> > --- a/socket/sys/socket.h

> > +++ b/socket/sys/socket.h

> > @@ -199,6 +199,17 @@ extern ssize_t recvmsg (int __fd, struct msghdr

> > *__message, int __flags); extern int recvmmsg (int __fd, struct

> > mmsghdr *__vmessages, unsigned int __vlen, int __flags,

> >  		     struct timespec *__tmo);

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr

> > *__vmessages,

> > +                                  unsigned int __vlen, int __flags,

> > +                                  struct timespec *__tmo),

> > +                       __recvmmsg64);

> > +#  else

> > +#   define recvmmsg __recvmmsg64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  

> > diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h

> > index 3a34d82342..982ed32baa 100644

> > --- a/sysdeps/nptl/pthread.h

> > +++ b/sysdeps/nptl/pthread.h

> > @@ -230,6 +230,17 @@ extern int pthread_tryjoin_np (pthread_t __th,

> > void **__thread_return) __THROW; extern int pthread_timedjoin_np

> > (pthread_t __th, void **__thread_return, const struct timespec

> > *__abstime); 

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (pthread_timedjoin_np,

> > +                       (pthread_t __th, void **__thread_return,

> > +                        const struct timespec *__abstime),

> > +                       __pthread_timedjoin_np64);

> > +#  else

> > +#  define pthread_timedjoin_np __pthread_timedjoin_np64

> > +#  endif

> > +# endif

> > +

> >  /* Make calling thread wait for termination of the thread TH, but

> > only until TIMEOUT measured against the clock specified by CLOCKID.

> > The exit status of the thread is stored in *THREAD_RETURN, if

> > @@ -240,6 +251,18 @@ extern int pthread_timedjoin_np (pthread_t

> > __th, void **__thread_return, extern int pthread_clockjoin_np

> > (pthread_t __th, void **__thread_return, clockid_t __clockid,

> >  				 const struct timespec *__abstime);

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (pthread_clockjoin_np,

> > +                       (pthread_t __th, void **__thread_return,

> > +                        clockid_t __clockid,

> > +                        const struct timespec *__abstime),

> > +                       __pthread_clockjoin_np64);

> > +#  else

> > +#  define pthread_clockjoin_np __pthread_clockjoin_np64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  /* Indicate that the thread TH is never to be joined with

> > PTHREAD_JOIN. @@ -776,6 +799,17 @@ extern int pthread_mutex_lock

> > (pthread_mutex_t *__mutex) extern int pthread_mutex_timedlock

> > (pthread_mutex_t *__restrict __mutex, const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,

> > +                             (pthread_mutex_t *__restrict __mutex,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_mutex_timedlock64);

> > +#  else

> > +#   define pthread_mutex_timedlock __pthread_mutex_timedlock64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_GNU

> > @@ -783,6 +817,18 @@ extern int pthread_mutex_clocklock

> > (pthread_mutex_t *__restrict __mutex, clockid_t __clockid,

> >  				    const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull

> > ((1, 3)); +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,

> > +                             (pthread_mutex_t *__restrict __mutex,

> > +                              clockid_t __clockid,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_mutex_clocklock64);

> > +#  else

> > +#   define pthread_mutex_clocklock __pthread_mutex_clocklock64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  /* Unlock a mutex.  */

> > @@ -922,6 +968,17 @@ extern int pthread_rwlock_tryrdlock

> > (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedrdlock

> > (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> > +

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,

> > +                             (pthread_rwlock_t *__restrict

> > __rwlock,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_rwlock_timedrdlock64);

> > +#   else

> > +#    define pthread_rwlock_timedrdlock

> > __pthread_rwlock_timedrdlock64 +#   endif

> > +#  endif

> >  # endif

> >  

> >  # ifdef __USE_GNU

> > @@ -929,6 +986,18 @@ extern int pthread_rwlock_clockrdlock

> > (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

> >  				       const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> > +

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,

> > +                             (pthread_rwlock_t *__restrict

> > __rwlock,

> > +                              clockid_t __clockid,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_rwlock_clockrdlock64);

> > +#   else

> > +#    define pthread_rwlock_clockrdlock

> > __pthread_rwlock_clockrdlock64 +#   endif

> > +#  endif

> >  # endif

> >  

> >  /* Acquire write lock for RWLOCK.  */

> > @@ -944,6 +1013,17 @@ extern int pthread_rwlock_trywrlock

> > (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedwrlock

> > (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> > +

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,

> > +                             (pthread_rwlock_t *__restrict

> > __rwlock,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_rwlock_timedwrlock64);

> > +#   else

> > +#    define pthread_rwlock_timedwrlock

> > __pthread_rwlock_timedwrlock64 +#   endif

> > +#  endif

> >  # endif

> >  

> >  # ifdef __USE_GNU

> > @@ -951,6 +1031,18 @@ extern int pthread_rwlock_clockwrlock

> > (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

> >  				       const struct timespec

> > *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> > +

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT_NTHNL)

> > +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,

> > +                             (pthread_rwlock_t *__restrict

> > __rwlock,

> > +                              clockid_t __clockid,

> > +                              const struct timespec *__restrict

> > __abstime),

> > +                             __pthread_rwlock_clockwrlock64);

> > +#   else

> > +#    define pthread_rwlock_clockwrlock

> > __pthread_rwlock_clockwrlock64 +#   endif

> > +#  endif

> >  # endif

> >  

> >  /* Unlock RWLOCK.  */

> > @@ -1032,6 +1124,18 @@ extern int pthread_cond_timedwait

> > (pthread_cond_t *__restrict __cond, const struct timespec

> > *__restrict __abstime) __nonnull ((1, 2, 3));

> >  

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (pthread_cond_timedwait,

> > +                       (pthread_cond_t *__restrict __cond,

> > +                        pthread_mutex_t *__restrict __mutex,

> > +                        const struct timespec *__restrict

> > __abstime),

> > +                       __pthread_cond_timedwait64);

> > +#  else

> > +#  define pthread_cond_timedwait __pthread_cond_timedwait64

> > +#  endif

> > +# endif

> > +

> >  # ifdef __USE_GNU

> >  /* Wait for condition variable COND to be signaled or broadcast

> > until ABSTIME measured by the specified clock. MUTEX is assumed to

> > be @@ -1045,6 +1149,19 @@ extern int pthread_cond_clockwait

> > (pthread_cond_t *__restrict __cond, __clockid_t __clock_id,

> >  				   const struct timespec

> > *__restrict __abstime) __nonnull ((1, 2, 4));

> > +

> > +#  ifdef __USE_TIME_BITS64

> > +#   if defined(__REDIRECT)

> > +extern int __REDIRECT (pthread_cond_clockwait,

> > +                       (pthread_cond_t *__restrict __cond,

> > +                        pthread_mutex_t *__restrict __mutex,

> > +                        __clockid_t __clock_id,

> > +                        const struct timespec *__restrict

> > __abstime),

> > +                       __pthread_cond_clockwait64);

> > +#   else

> > +#   define pthread_cond_clockwait __pthread_cond_clockwait64

> > +#   endif

> > +#  endif

> >  # endif

> >  

> >  /* Functions for handling condition variable attributes.  */

> > diff --git a/sysdeps/pthread/semaphore.h

> > b/sysdeps/pthread/semaphore.h index 436d21cb08..6a6055fc3a 100644

> > --- a/sysdeps/pthread/semaphore.h

> > +++ b/sysdeps/pthread/semaphore.h

> > @@ -62,6 +62,17 @@ extern int sem_wait (sem_t *__sem) __nonnull

> > ((1)); extern int sem_timedwait (sem_t *__restrict __sem,

> >  			  const struct timespec *__restrict

> > __abstime) __nonnull ((1, 2));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (sem_timedwait,

> > +                       (sem_t *__restrict __sem,

> > +                        const struct timespec *__restrict

> > __abstime),

> > +                        __sem_timedwait64);

> > +#  else

> > +#   define sem_timedwait __sem_timedwait64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_GNU

> > @@ -69,6 +80,18 @@ extern int sem_clockwait (sem_t *__restrict

> > __sem, clockid_t clock,

> >  			  const struct timespec *__restrict

> > __abstime) __nonnull ((1, 3));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (sem_clockwait,

> > +                       (sem_t *__restrict __sem,

> > +                        clockid_t clock,

> > +                        const struct timespec *__restrict

> > __abstime),

> > +                        __sem_clockwait64);

> > +#  else

> > +#   define sem_clockwait __sem_clockwait64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  /* Test whether SEM is posted.  */

> > diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h

> > index 0ac489b4a1..acdc7b329a 100644

> > --- a/sysdeps/pthread/threads.h

> > +++ b/sysdeps/pthread/threads.h

> > @@ -91,6 +91,16 @@ extern thrd_t thrd_current (void);

> >  extern int thrd_sleep (const struct timespec *__time_point,

> >  		       struct timespec *__remaining);

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT)

> > +extern int __REDIRECT (thrd_sleep, (const struct timespec

> > *__time_point,

> > +                                    struct timespec *__remaining),

> > +                       __thrd_sleep64);

> > +# else

> > +#  define thrd_sleep __thrd_sleep64

> > +# endif

> > +#endif

> > +

> >  /* Terminate current thread execution, cleaning up any thread local

> >     storage and freeing resources.  Returns the value specified in

> > __RES.  */ extern void thrd_exit (int __res) __attribute__

> > ((__noreturn__)); @@ -134,6 +144,17 @@ extern int mtx_lock (mtx_t

> > *__mutex); extern int mtx_timedlock (mtx_t *__restrict __mutex,

> >  			  const struct timespec *__restrict

> > __time_point); 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT)

> > +extern int __REDIRECT (mtx_timedlock, (mtx_t *__restrict __mutex,

> > +                                       const struct timespec

> > *__restrict

> > +                                       __time_point),

> > +                       __mtx_timedlock64);

> > +# else

> > +#  define mtx_timedlock __mtx_timedlock64

> > +# endif

> > +#endif

> > +

> >  /* Try to lock the mutex pointed by __MUTEX without blocking.  If

> > the mutex is free the current threads takes control of it, otherwise

> > it returns immediately.  */

> > @@ -175,6 +196,18 @@ extern int cnd_timedwait (cnd_t *__restrict

> > __cond, mtx_t *__restrict __mutex,

> >  			  const struct timespec *__restrict

> > __time_point); 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT)

> > +extern int __REDIRECT (cnd_timedwait, (cnd_t *__restrict __cond,

> > +                                       mtx_t *__restrict __mutex,

> > +                                       const struct timespec

> > *__restrict

> > +                                       __time_point),

> > +                       __cnd_timedwait64);

> > +# else

> > +#  define cnd_timedwait __cnd_timedwait64

> > +# endif

> > +#endif

> > +

> >  /* Destroy condition variable pointed by __cond and free all of its

> >     resources.  */

> >  extern void cnd_destroy (cnd_t *__COND);

> > diff --git a/sysdeps/unix/sysv/linux/bits/time.h

> > b/sysdeps/unix/sysv/linux/bits/time.h index e0962744e1..7168ef1948

> > 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h

> > +++ b/sysdeps/unix/sysv/linux/bits/time.h

> > @@ -77,6 +77,16 @@ __BEGIN_DECLS

> >  /* Tune a POSIX clock.  */

> >  extern int clock_adjtime (__clockid_t __clock_id, struct timex

> > *__utx) __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id,

> > +                                           struct timex *__utx),

> > +                           __clock_adjtime64);

> > +# else

> > +# define clock_adjtime __clock_adjtime64

> > +# endif

> > +#endif

> > +

> >  __END_DECLS

> >  #endif /* use GNU */

> >  

> > diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h

> > b/sysdeps/unix/sysv/linux/sys/timerfd.h index 0ae60b65bd..cd252476a7

> > 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h

> > +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h

> > @@ -47,9 +47,31 @@ extern int timerfd_settime (int __ufd, int

> > __flags, const struct itimerspec *__utmr,

> >  			    struct itimerspec *__otmr) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (timerfd_settime,

> > +                           (int __ufd, int __flags,

> > +                            const struct itimerspec *__restrict

> > __value,

> > +                            struct itimerspec *__restrict

> > __ovalue),

> > +                           __timerfd_settime64);

> > +# else

> > +# define timerfd_settime __timerfd_settime64

> > +# endif

> > +#endif

> > +

> >  /* Return the next expiration time of UFD.  */

> >  extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr)

> > __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd,

> > +                                             struct itimerspec

> > *__otmr),

> > +                           __timerfd_gettime64);

> > +# else

> > +# define timerfd_gettime __timerfd_gettime64

> > +# endif

> > +#endif

> > +

> >  __END_DECLS

> >  

> >  #endif /* sys/timerfd.h */

> > diff --git a/sysdeps/unix/sysv/linux/sys/timex.h

> > b/sysdeps/unix/sysv/linux/sys/timex.h index 6979b86b72..b5271152bb

> > 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h

> > +++ b/sysdeps/unix/sysv/linux/sys/timex.h

> > @@ -57,15 +57,46 @@ __BEGIN_DECLS

> >  extern int __adjtimex (struct timex *__ntx) __THROW;

> >  extern int adjtimex (struct timex *__ntx) __THROW;

> >  

> > -#ifdef __REDIRECT_NTH

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),

> > +                           ___adjtimex64);

> > +# else

> > +# define adjtimex ___adjtimex64

> > +# endif

> > +#endif

> > +

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> >  extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> > -			   ntp_gettimex);

> > +                           __ntp_gettime64);

> > +extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval

> > *__ntv),

> > +                           __ntp_gettimex64);

> > +# else

> > +# define ntp_gettime __ntp_gettime64

> > +# define ntp_gettimex __ntp_gettimex64

> > +# endif

> >  #else

> > +# ifdef __REDIRECT_NTH

> > +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> > +			   ntp_gettimex);

> > +# else

> >  extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;

> > -# define ntp_gettime ntp_gettimex

> > +#  define ntp_gettime ntp_gettimex

> > +# endif

> >  #endif

> > +

> >  extern int ntp_adjtime (struct timex *__tntx) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),

> > +                           ___adjtimex64);

> > +# else

> > +# define ntp_adjtime ___adjtimex64

> > +# endif

> > +#endif

> > +

> >  __END_DECLS

> >  

> >  #endif /* sys/timex.h */

> > diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h

> > index c70cfa582c..f39c153b86 100644

> > --- a/sysvipc/sys/msg.h

> > +++ b/sysvipc/sys/msg.h

> > @@ -60,6 +60,16 @@ __BEGIN_DECLS

> >  /* Message queue control operation.  */

> >  extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf)

> > __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (msgctl,

> > +                           (int __msqid, int __cmd, struct msqid_ds

> > *__buf),

> > +                           __msgctl64);

> > +# else

> > +# define msgctl __msgctl64

> > +# endif

> > +#endif

> > +

> >  /* Get messages queue.  */

> >  extern int msgget (key_t __key, int __msgflg) __THROW;

> >  

> > diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h

> > index 4ede2dd6ef..b26c17914c 100644

> > --- a/sysvipc/sys/sem.h

> > +++ b/sysvipc/sys/sem.h

> > @@ -50,6 +50,16 @@ __BEGIN_DECLS

> >  /* Semaphore control operation.  */

> >  extern int semctl (int __semid, int __semnum, int __cmd, ...)

> > __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (semctl,

> > +                           (int __semid, int __semnum, int __cmd,

> > ...),

> > +                           __semctl64);

> > +# else

> > +# define semctl __semctl64

> > +# endif

> > +#endif

> > +

> >  /* Get semaphore.  */

> >  extern int semget (key_t __key, int __nsems, int __semflg) __THROW;

> >  

> > @@ -60,6 +70,17 @@ extern int semop (int __semid, struct sembuf

> > *__sops, size_t __nsops) __THROW; /* Operate on semaphore with

> > timeout.  */ extern int semtimedop (int __semid, struct sembuf

> > *__sops, size_t __nsops, const struct timespec *__timeout) __THROW;

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (semtimedop, (int __semid, struct sembuf

> > *__sops,

> > +                                        size_t __nsops,

> > +                                        const struct timespec

> > *__timeout),

> > +                           __semtimedop64);

> > +#  else

> > +#  define semtimedop __semtimedop64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  __END_DECLS

> > diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h

> > index 6c58742c4f..8d74911e55 100644

> > --- a/sysvipc/sys/shm.h

> > +++ b/sysvipc/sys/shm.h

> > @@ -48,6 +48,16 @@ __BEGIN_DECLS

> >  /* Shared memory control operation.  */

> >  extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf)

> > __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (shmctl,

> > +                           (int __shmid, int __cmd, struct shmid_ds

> > *__buf),

> > +                           __shmctl64);

> > +# else

> > +# define shmctl __shmctl64

> > +# endif

> > +#endif

> > +

> >  /* Get shared memory segment.  */

> >  extern int shmget (key_t __key, size_t __size, int __shmflg)

> > __THROW; 

> > diff --git a/time/sys/time.h b/time/sys/time.h

> > index 21fa9ed451..d3bf1e6588 100644

> > --- a/time/sys/time.h

> > +++ b/time/sys/time.h

> > @@ -66,6 +66,16 @@ struct timezone

> >  extern int gettimeofday (struct timeval *__restrict __tv,

> >  			 void *__restrict __tz) __THROW __nonnull

> > ((1)); 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (gettimeofday, (struct timeval

> > *__restrict __tv,

> > +                                          void *__restrict __tz),

> > +                           __gettimeofday64);

> > +# else

> > +# define gettimeofday __gettimeofday64

> > +# endif

> > +#endif

> > +

> >  #ifdef __USE_MISC

> >  /* Set the current time of day and timezone information.

> >     This call is restricted to the super-user.

> > @@ -76,12 +86,33 @@ extern int settimeofday (const struct timeval

> > *__tv, const struct timezone *__tz)

> >       __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (settimeofday, (const struct timeval

> > *__tv,

> > +                                          const struct timezone

> > *__tz),

> > +                           __settimeofday64);

> > +# else

> > +# define settimeofday __settimeofday64

> > +# endif

> > +#endif

> > +

> >  /* Adjust the current time of day by the amount in DELTA.

> >     If OLDDELTA is not NULL, it is filled in with the amount

> >     of time adjustment remaining to be done from the last `adjtime'

> > call. This call is restricted to the super-user.  */

> >  extern int adjtime (const struct timeval *__delta,

> >  		    struct timeval *__olddelta) __THROW;

> > +

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (adjtime, (const struct timeval *__delta,

> > +                                     struct timeval *__olddelta),

> > +                           __adjtime64);

> > +# else

> > +# define adjtime __adjtime64

> > +# endif

> > +#endif

> > +

> >  #endif

> >  

> >  

> > @@ -123,6 +154,16 @@ typedef int __itimer_which_t;

> >  extern int getitimer (__itimer_which_t __which,

> >  		      struct itimerval *__value) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (getitimer, (__itimer_which_t __which,

> > +                                       struct itimerval *__value),

> > +                           __getitimer64);

> > +# else

> > +# define getitimer __getitimer64

> > +# endif

> > +#endif

> > +

> >  /* Set the timer WHICH to *NEW.  If OLD is not NULL,

> >     set *OLD to the old value of timer WHICH.

> >     Returns 0 on success, -1 on errors.  */

> > @@ -130,19 +171,59 @@ extern int setitimer (__itimer_which_t

> > __which, const struct itimerval *__restrict __new,

> >  		      struct itimerval *__restrict __old) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (setitimer, (__itimer_which_t __which,

> > +                                       const struct itimerval

> > *__restrict __new,

> > +                                       struct itimerval *__restrict

> > __old),

> > +                           __setitimer64);

> > +# else

> > +# define setitimer __setitimer64

> > +# endif

> > +#endif

> > +

> >  /* Change the access time of FILE to TVP[0] and the modification

> > time of FILE to TVP[1].  If TVP is a null pointer, use the current

> > time instead. Returns 0 on success, -1 on errors.  */

> >  extern int utimes (const char *__file, const struct timeval

> > __tvp[2]) __THROW __nonnull ((1));

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (utimes, (const char *__file,

> > +                                    const struct timeval __tvp[2]),

> > +                           __utimes64);

> > +# else

> > +# define utimes __utimes64

> > +# endif

> > +#endif

> > +

> >  #ifdef __USE_MISC

> >  /* Same as `utimes', but does not follow symbolic links.  */

> >  extern int lutimes (const char *__file, const struct timeval

> > __tvp[2]) __THROW __nonnull ((1));

> >  

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (lutimes, (const char *__file,

> > +                                     const struct timeval

> > __tvp[2]),

> > +                           __lutimes64);

> > +#  else

> > +#   define lutimes __lutimes64

> > +#  endif

> > +# endif

> > +

> >  /* Same as `utimes', but takes an open file descriptor instead of a

> > name.  */ extern int futimes (int __fd, const struct timeval

> > __tvp[2]) __THROW; +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval

> > __tvp[2]),

> > +                           __futimes64);

> > +#  else

> > +#   define futimes __futimes64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  #ifdef __USE_GNU

> > @@ -151,6 +232,16 @@ extern int futimes (int __fd, const struct

> > timeval __tvp[2]) __THROW; the current time instead.  Returns 0 on

> > success, -1 on errors.  */ extern int futimesat (int __fd, const

> > char *__file, const struct timeval __tvp[2]) __THROW;

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (futimesat, (int __fd, const char

> > *__file,

> > +                                       const struct timeval

> > __tvp[2]),

> > +                           __futimesat64);

> > +#  else

> > +#   define futimesat __futimesat64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >  

> > diff --git a/time/time.h b/time/time.h

> > index 015bc1c7f3..9a74f01b2f 100644

> > --- a/time/time.h

> > +++ b/time/time.h

> > @@ -74,13 +74,37 @@ extern clock_t clock (void) __THROW;

> >  /* Return the current time and put it in *TIMER if TIMER is not

> > NULL.  */ extern time_t time (time_t *__timer) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64);

> > +# else

> > +# define time __time64

> > +# endif

> > +#endif

> > +

> >  /* Return the difference between TIME1 and TIME0.  */

> >  extern double difftime (time_t __time1, time_t __time0)

> >       __THROW __attribute__ ((__const__));

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t

> > __time0),

> > +                              __difftime64);

> > +# else

> > +# define difftime __difftime64

> > +# endif

> > +#endif

> > +

> >  /* Return the `time_t' representation of TP and normalize TP.  */

> >  extern time_t mktime (struct tm *__tp) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp),

> > __mktime64); +# else

> > +# define mktime __mktime64

> > +# endif

> > +#endif

> >  

> >  /* Format TP into S according to FORMAT.

> >     Write no more than MAXSIZE characters and return the number

> > @@ -118,6 +142,14 @@ extern char *strptime_l (const char *__restrict

> > __s, in Universal Coordinated Time (aka Greenwich Mean Time).  */

> >  extern struct tm *gmtime (const time_t *__timer) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer),

> > __gmtime64); +# else

> > +# define gmtime __gmtime64

> > +# endif

> > +#endif

> > +

> >  /* Return the `struct tm' representation

> >     of *TIMER in the local timezone.  */

> >  extern struct tm *localtime (const time_t *__timer) __THROW;

> > @@ -128,6 +160,16 @@ extern struct tm *localtime (const time_t

> > *__timer) __THROW; extern struct tm *gmtime_r (const time_t

> > *__restrict __timer, struct tm *__restrict __tp) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t

> > *__restrict __timer,

> > +                                            struct tm *__restrict

> > __tp),

> > +                                 __gmtime64_r);

> > +# else

> > +# define gmtime_r __gmtime64_r

> > +# endif

> > +#endif

> > +

> >  /* Return the `struct tm' representation of *TIMER in local time,

> >     using *TP to store the result.  */

> >  extern struct tm *localtime_r (const time_t *__restrict __timer,

> > @@ -141,6 +183,14 @@ extern char *asctime (const struct tm *__tp)

> > __THROW; /* Equivalent to `asctime (localtime (timer))'.  */

> >  extern char *ctime (const time_t *__timer) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern char *__REDIRECT_NTH (ctime, (const time_t *__timer),

> > __ctime64); +# else

> > +# define ctime __ctime64

> > +# endif

> > +#endif

> > +

> >  #if defined __USE_POSIX || __GLIBC_USE (ISOC2X)

> >  /* Reentrant versions of the above functions.  */

> >  

> > @@ -152,6 +202,16 @@ extern char *asctime_r (const struct tm

> > *__restrict __tp, /* Equivalent to `asctime_r (localtime_r (timer,

> > *TMP*), buf)'.  */ extern char *ctime_r (const time_t *__restrict

> > __timer, char *__restrict __buf) __THROW;

> > +

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict

> > __timer,

> > +                                       char *__restrict __buf),

> > __ctime64_r); +# else

> > +# define ctime_r __ctime64_r

> > +# endif

> > +#endif

> > +

> >  #endif	/* POSIX || C2X */

> >  

> >  

> > @@ -189,6 +249,14 @@ extern long int timezone;

> >  /* Like `mktime', but for TP represents Universal Time, not local

> > time.  */ extern time_t timegm (struct tm *__tp) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp),

> > __timegm64); +# else

> > +# define timegm __timegm64

> > +# endif

> > +#endif

> > +

> >  /* Another name for `mktime'.  */

> >  extern time_t timelocal (struct tm *__tp) __THROW;

> >  

> > @@ -205,17 +273,54 @@ extern int dysize (int __year) __THROW

> > __attribute__ ((__const__)); extern int nanosleep (const struct

> > timespec *__requested_time, struct timespec *__remaining);

> >  

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT)

> > +extern int __REDIRECT (nanosleep, (const struct timespec

> > *__requested_time,

> > +                                   struct timespec *__remaining),

> > +                       __nanosleep64);

> > +#  else

> > +#   define nanosleep __nanosleep64

> > +#  endif

> > +# endif

> >  

> >  /* Get resolution of clock CLOCK_ID.  */

> >  extern int clock_getres (clockid_t __clock_id, struct timespec

> > *__res) __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id,

> > +                                          struct timespec *__res),

> > +                           __clock_getres64);

> > +# else

> > +# define clock_getres __clock_getres64

> > +# endif

> > +#endif

> > +

> >  /* Get current value of clock CLOCK_ID and store it in TP.  */

> >  extern int clock_gettime (clockid_t __clock_id, struct timespec

> > *__tp) __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id,

> > struct

> > +                                           timespec *__tp),

> > __clock_gettime64); +# else

> > +# define clock_gettime __clock_gettime64

> > +# endif

> > +#endif

> > +

> >  /* Set clock CLOCK_ID to value TP.  */

> >  extern int clock_settime (clockid_t __clock_id, const struct

> > timespec *__tp) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id,

> > const struct

> > +                                           timespec *__tp),

> > __clock_settime64); +# else

> > +# define clock_settime __clock_settime64

> > +# endif

> > +#endif

> > +

> >  # ifdef __USE_XOPEN2K

> >  /* High-resolution sleep with the specified clock.

> >  

> > @@ -225,6 +330,17 @@ extern int clock_nanosleep (clockid_t

> > __clock_id, int __flags, const struct timespec *__req,

> >  			    struct timespec *__rem);

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT)

> > +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int

> > __flags,

> > +                                         const struct timespec

> > *__req,

> > +                                         struct timespec *__rem),

> > +                       __clock_nanosleep_time64);

> > +# else

> > +# define clock_nanosleep __clock_nanosleep_time64

> > +# endif

> > +#endif

> > +

> >  /* Return clock ID for CPU-time clock.  */

> >  extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id)

> > __THROW; # endif

> > @@ -243,10 +359,31 @@ extern int timer_settime (timer_t __timerid,

> > int __flags, const struct itimerspec *__restrict __value,

> >  			  struct itimerspec *__restrict __ovalue)

> > __THROW; 

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int

> > __flags,

> > +     const struct itimerspec *__restrict __value,

> > +     struct itimerspec *__restrict __ovalue),

> > +                          __timer_settime64);

> > +# else

> > +# define timer_settime __timer_settime64

> > +# endif

> > +#endif

> > +

> >  /* Get current value of timer TIMERID and store it in VALUE.  */

> >  extern int timer_gettime (timer_t __timerid, struct itimerspec

> > *__value) __THROW;

> >  

> > +#ifdef __USE_TIME_BITS64

> > +# if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid,

> > +                                           struct itimerspec

> > *__value),

> > +                           __timer_gettime64) __nonnull ((1));

> > +# else

> > +# define timer_gettime __timer_gettime64

> > +# endif

> > +#endif

> > +

> >  /* Get expiration overrun for timer TIMERID.  */

> >  extern int timer_getoverrun (timer_t __timerid) __THROW;

> >  #endif

> > @@ -256,6 +393,15 @@ extern int timer_getoverrun (timer_t __timerid)

> > __THROW; /* Set TS to calendar time based in time base BASE.  */

> >  extern int timespec_get (struct timespec *__ts, int __base)

> >       __THROW __nonnull ((1));

> > +

> > +# ifdef __USE_TIME_BITS64

> > +#  if defined(__REDIRECT_NTH)

> > +extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts,

> > int __base),

> > +                           __timespec_get64);

> > +#  else

> > +#  define timespec_get __timespec_get64

> > +#  endif

> > +# endif

> >  #endif

> >  

> >    

> 

> 

> 

> 

> Best regards,

> 

> Lukasz Majewski

> 

> --

> 

> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk

> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:

> lukma@denx.de





Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Lukasz Majewski Feb. 15, 2021, 9:55 a.m. | #3
Dear Joseph, Adhemerval

> Exported headers have been modified to provide redirections to 64 bit

> functions when __USE_TIME_BITS64 is defined - this exported flag is

> set only when _TIME_BITS=64 and _FILE_OFFSET_BITS=64 are set on

> compilation time.

> For example, when __USE_TIME_BIT64 is defined - calls to clock_settime

> are redirected to clock_settime64, which supports setting 64 bit time

> in glibc ports with __WORDSIZE==32 and __TIMESIZE != 64.

> 

> This patch is the preparatory one for addressing Y2038 issue and as

> such will be inactive until support for _TIME_BITS exported flag is

> added, which in turn causes definition of __USE_TIME_BITS64.


Would it be possible to discuss if this patch can be pulled?

It extracts much "mechanical" conversion work from the patch which will
add support for _TIME_BITS exported flag to glibc.

It will not bring any functional change to the glibc until the
aforementioned flag is defined.

> ---

>  io/sys/poll.h                         |  11 ++

>  io/sys/stat.h                         |  20 ++++

>  io/utime.h                            |  10 ++

>  misc/sys/select.h                     |  27 +++++

>  posix/sched.h                         |   9 ++

>  posix/sys/wait.h                      |  20 ++++

>  resolv/netdb.h                        |  11 ++

>  resource/sys/resource.h               |  10 ++

>  rt/aio.h                              |  25 ++++-

>  rt/mqueue.h                           |  25 +++++

>  signal/signal.h                       |  12 +++

>  socket/sys/socket.h                   |  11 ++

>  sysdeps/nptl/pthread.h                | 117 +++++++++++++++++++++

>  sysdeps/pthread/semaphore.h           |  23 ++++

>  sysdeps/pthread/threads.h             |  33 ++++++

>  sysdeps/unix/sysv/linux/bits/time.h   |  10 ++

>  sysdeps/unix/sysv/linux/sys/timerfd.h |  22 ++++

>  sysdeps/unix/sysv/linux/sys/timex.h   |  37 ++++++-

>  sysvipc/sys/msg.h                     |  10 ++

>  sysvipc/sys/sem.h                     |  21 ++++

>  sysvipc/sys/shm.h                     |  10 ++

>  time/sys/time.h                       |  91 ++++++++++++++++

>  time/time.h                           | 146

> ++++++++++++++++++++++++++ 23 files changed, 705 insertions(+), 6

> deletions(-)

> 

> diff --git a/io/sys/poll.h b/io/sys/poll.h

> index 857be0f5ac..4a725ed18e 100644

> --- a/io/sys/poll.h

> +++ b/io/sys/poll.h

> @@ -63,6 +63,17 @@ extern int poll (struct pollfd *__fds, nfds_t

> __nfds, int __timeout); extern int ppoll (struct pollfd *__fds,

> nfds_t __nfds, const struct timespec *__timeout,

>  		  const __sigset_t *__ss);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds,

> +                               const struct timespec *__timeout,

> +                               const __sigset_t *__ss),

> +                       __ppoll64);

> +#  else

> +#  define ppoll __ppoll64

> +#  endif

> +# endif

>  #endif

>  

>  __END_DECLS

> diff --git a/io/sys/stat.h b/io/sys/stat.h

> index 58c3770622..b3f2f0da99 100644

> --- a/io/sys/stat.h

> +++ b/io/sys/stat.h

> @@ -361,11 +361,31 @@ extern int utimensat (int __fd, const char

> *__path, const struct timespec __times[2],

>  		      int __flags)

>       __THROW __nonnull ((2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,

> +                                       const struct timespec

> __times[2],

> +                                       int flags),

> +                           __utimensat64) __nonnull ((2));

> +#  else

> +#  define utimensat __utimensat64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_XOPEN2K8

>  /* Set file access and modification times of the file associated

> with FD.  */ extern int futimens (int __fd, const struct timespec

> __times[2]) __THROW; +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec

> __times[2]),

> +                           __futimens64);

> +#  else

> +#  define futimens __futimens64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> diff --git a/io/utime.h b/io/utime.h

> index 07659016ab..f607bf0aad 100644

> --- a/io/utime.h

> +++ b/io/utime.h

> @@ -45,6 +45,16 @@ extern int utime (const char *__file,

>  		  const struct utimbuf *__file_times)

>       __THROW __nonnull ((1));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utime, (const char *__file,

> +                                   const struct utimbuf

> *__file_times),

> +                           __utime64);

> +# else

> +# define utime __utime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* utime.h */

> diff --git a/misc/sys/select.h b/misc/sys/select.h

> index 29d011c2d5..779a6e81b6 100644

> --- a/misc/sys/select.h

> +++ b/misc/sys/select.h

> @@ -103,6 +103,19 @@ extern int select (int __nfds, fd_set

> *__restrict __readfds, fd_set *__restrict __exceptfds,

>  		   struct timeval *__restrict __timeout);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (select,

> +                       (int __nfds, fd_set *__restrict __readfds,

> +                        fd_set *__restrict __writefds,

> +                        fd_set *__restrict __exceptfds,

> +                        struct timeval *__restrict __timeout),

> +                       __select64);

> +# else

> +#  define select __select64

> +# endif

> +#endif

> +

>  #ifdef __USE_XOPEN2K

>  /* Same as above only that the TIMEOUT value is given with higher

>     resolution and a sigmask which is been set temporarily.  This

> version @@ -115,6 +128,20 @@ extern int pselect (int __nfds, fd_set

> *__restrict __readfds, fd_set *__restrict __exceptfds,

>  		    const struct timespec *__restrict __timeout,

>  		    const __sigset_t *__restrict __sigmask);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pselect,

> +                       (int __nfds, fd_set *__restrict __readfds,

> +                        fd_set *__restrict __writefds,

> +                        fd_set *__restrict __exceptfds,

> +                        const struct timespec *__restrict __timeout,

> +                        const __sigset_t *__restrict __sigmask),

> +                       __pselect64);

> +#  else

> +#   define pselect __pselect64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/posix/sched.h b/posix/sched.h

> index 60c9c3c710..0d9cbc5bb2 100644

> --- a/posix/sched.h

> +++ b/posix/sched.h

> @@ -76,6 +76,15 @@ extern int sched_get_priority_min (int

> __algorithm) __THROW; /* Get the SCHED_RR interval for the named

> process.  */ extern int sched_rr_get_interval (__pid_t __pid, struct

> timespec *__t) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (sched_rr_get_interval,

> +                           (__pid_t __pid, struct timespec *__t),

> +                           __sched_rr_get_interval64);

> +# else

> +# define sched_rr_get_interval __sched_rr_get_interval64

> +# endif

> +#endif

>  

>  #ifdef __USE_GNU

>  /* Access macros for `cpu_set'.  */

> diff --git a/posix/sys/wait.h b/posix/sys/wait.h

> index a42e16c1b0..68ec036b29 100644

> --- a/posix/sys/wait.h

> +++ b/posix/sys/wait.h

> @@ -146,12 +146,32 @@ struct rusage;

>     otherwise don't.  */

>  extern __pid_t wait3 (int *__stat_loc, int __options,

>  		      struct rusage * __usage) __THROWNL;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int

> __options,

> +                                         struct rusage * __usage)

> +                                 __wait3_time64);

> +#  else

> +#  define wait3 __wait3_time64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_MISC

>  /* PID is like waitpid.  Other args are like wait3.  */

>  extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options,

>  		      struct rusage *__usage) __THROWNL;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern __pid_t __REDIRECT_NTHNL (wait4, (__pid_t __pid, int

> *__stat_loc,

> +                                         int __options, struct

> rusage *__usage),

> +                                 __wait4_time64);

> +#  else

> +#  define wait4 __wait4_time64

> +#  endif

> +# endif

>  #endif /* Use misc.  */

>  

>  

> diff --git a/resolv/netdb.h b/resolv/netdb.h

> index 575e416dac..bd0832988f 100644

> --- a/resolv/netdb.h

> +++ b/resolv/netdb.h

> @@ -701,6 +701,17 @@ extern int getaddrinfo_a (int __mode, struct

> gaicb *__list[__restrict_arr], extern int gai_suspend (const struct

> gaicb *const __list[], int __ent, const struct timespec *__timeout);

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (gai_suspend, (const struct gaicb *const

> __list[],

> +                                     int __ent,

> +                                     const struct timespec

> *__timeout),

> +                       __gai_suspend_time64);

> +#  else

> +#   define gai_suspend __gai_suspend_time64

> +#  endif

> +# endif

> +

>  /* Get the error status of the request REQ.  */

>  extern int gai_error (struct gaicb *__req) __THROW;

>  

> diff --git a/resource/sys/resource.h b/resource/sys/resource.h

> index 4edafb50d5..98f05cf1c4 100644

> --- a/resource/sys/resource.h

> +++ b/resource/sys/resource.h

> @@ -86,6 +86,16 @@ extern int setrlimit64 (__rlimit_resource_t

> __resource, and put it in *USAGE.  Returns 0 for success, -1 for

> failure.  */ extern int getrusage (__rusage_who_t __who, struct

> rusage *__usage) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who,

> +                                       struct rusage *__usage),

> +                           __getrusage64);

> +# else

> +# define getrusage __getrusage64

> +# endif

> +#endif

> +

>  /* Return the highest priority of any process specified by WHICH and

> WHO (see above); if WHO is zero, the current process, process group,

> or user (as specified by WHO) is used.  A lower priority number means

> higher diff --git a/rt/aio.h b/rt/aio.h

> index 148d31a0af..2c35f1b04c 100644

> --- a/rt/aio.h

> +++ b/rt/aio.h

> @@ -193,12 +193,17 @@ extern __ssize_t __REDIRECT_NTH (aio_return,

> (struct aiocb *__aiocbp), extern int __REDIRECT_NTH (aio_cancel,

>  			   (int __fildes, struct aiocb *__aiocbp),

>  			   aio_cancel64);

> -

> +#  ifdef __USE_TIME_BITS64

> +extern int __REDIRECT_NTH (aio_suspend,

> +			   (const struct aiocb *const __list[], int

> __nent,

> +			    const struct timespec *__restrict

> __timeout),

> +			   __aio_suspend_time64) __nonnull ((1));

> +#  else

>  extern int __REDIRECT_NTH (aio_suspend,

>  			   (const struct aiocb *const __list[], int

> __nent, const struct timespec *__restrict __timeout),

>  			   aio_suspend64) __nonnull ((1));

> -

> +#  endif

>  extern int __REDIRECT_NTH (aio_fsync,

>  			   (int __operation, struct aiocb *__aiocbp),

>  			   aio_fsync64) __nonnull ((2));

> @@ -210,7 +215,11 @@ extern int __REDIRECT_NTH (aio_fsync,

>  #  define aio_error aio_error64

>  #  define aio_return aio_return64

>  #  define aio_cancel aio_cancel64

> -#  define aio_suspend aio_suspend64

> +#  ifdef __USE_TIME_BITS64

> +#   define aio_suspend __aio_suspend_time64

> +#  else

> +#   define aio_suspend aio_suspend64

> +#  endif

>  #  define aio_fsync aio_fsync64

>  # endif

>  #endif

> @@ -234,6 +243,16 @@ extern int aio_cancel64 (int __fildes, struct

> aiocb64 *__aiocbp) __THROW; extern int aio_suspend64 (const struct

> aiocb64 *const __list[], int __nent, const struct timespec

> *__restrict __timeout) __THROW __nonnull ((1));

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (aio_suspend64,

> +			   (const struct aiocb *const __list[], int

> __nent,

> +			    const struct timespec *__restrict

> __timeout),

> +			   __aio_suspend_time64) __nonnull ((1));

> +#  else

> +#   define aio_suspend64 __aio_suspend_time64

> +#  endif

> +# endif

>  

>  extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)

>    __THROW __nonnull ((2));

> diff --git a/rt/mqueue.h b/rt/mqueue.h

> index a2a2aa1771..e6b8641c62 100644

> --- a/rt/mqueue.h

> +++ b/rt/mqueue.h

> @@ -79,12 +79,37 @@ extern ssize_t mq_timedreceive (mqd_t __mqdes,

> char *__restrict __msg_ptr, const struct timespec *__restrict

> __abs_timeout) __nonnull ((2, 5));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes,

> +                               char *__restrict __msg_ptr,

> +                               size_t __msg_len,

> +                               unsigned int *__restrict __msg_prio,

> +                               const struct timespec *__restrict

> __abs_timeout),

> +                       __mq_timedreceive_time64);

> +#  else

> +#   define mq_timedreceive __mq_timedreceive_time64

> +#  endif

> +# endif

> +

>  /* Add message pointed by MSG_PTR to message queue MQDES, stop

> blocking on full message queue if ABS_TIMEOUT expires.  */

>  extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,

>  			 size_t __msg_len, unsigned int __msg_prio,

>  			 const struct timespec *__abs_timeout)

>    __nonnull ((2, 5));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes,

> +                       const char *__msg_ptr, size_t __msg_len,

> +                       unsigned int __msg_prio,

> +                       const struct timespec *__abs_timeout),

> +     __mq_timedsend_time64);

> +#  else

> +#   define mq_timedsend __mq_timedsend_time64

> +#  endif

> +# endif

>  #endif

>  

>  /* Define some inlines helping to catch common problems.  */

> diff --git a/signal/signal.h b/signal/signal.h

> index effe3d698f..564820e366 100644

> --- a/signal/signal.h

> +++ b/signal/signal.h

> @@ -274,6 +274,18 @@ extern int sigtimedwait (const sigset_t

> *__restrict __set, const struct timespec *__restrict __timeout)

>       __nonnull ((1));

>  

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT)

> +extern int __REDIRECT (sigtimedwait,

> +                       (const sigset_t *__restrict __set,

> +                        siginfo_t *__restrict __info,

> +                        const struct timespec *__restrict __timeout),

> +                       __sigtimedwait64);

> +#   else

> +#    define sigtimedwait __sigtimedwait64

> +#   endif

> +#  endif

> +

>  /* Send signal SIG to the process PID.  Associate data in VAL with

> the signal.  */

>  extern int sigqueue (__pid_t __pid, int __sig, const union sigval

> __val) diff --git a/socket/sys/socket.h b/socket/sys/socket.h

> index 7780c00ecb..2273c52cdf 100644

> --- a/socket/sys/socket.h

> +++ b/socket/sys/socket.h

> @@ -199,6 +199,17 @@ extern ssize_t recvmsg (int __fd, struct msghdr

> *__message, int __flags); extern int recvmmsg (int __fd, struct

> mmsghdr *__vmessages, unsigned int __vlen, int __flags,

>  		     struct timespec *__tmo);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr

> *__vmessages,

> +                                  unsigned int __vlen, int __flags,

> +                                  struct timespec *__tmo),

> +                       __recvmmsg64);

> +#  else

> +#   define recvmmsg __recvmmsg64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h

> index 3a34d82342..982ed32baa 100644

> --- a/sysdeps/nptl/pthread.h

> +++ b/sysdeps/nptl/pthread.h

> @@ -230,6 +230,17 @@ extern int pthread_tryjoin_np (pthread_t __th,

> void **__thread_return) __THROW; extern int pthread_timedjoin_np

> (pthread_t __th, void **__thread_return, const struct timespec

> *__abstime); 

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_timedjoin_np,

> +                       (pthread_t __th, void **__thread_return,

> +                        const struct timespec *__abstime),

> +                       __pthread_timedjoin_np64);

> +#  else

> +#  define pthread_timedjoin_np __pthread_timedjoin_np64

> +#  endif

> +# endif

> +

>  /* Make calling thread wait for termination of the thread TH, but

> only until TIMEOUT measured against the clock specified by CLOCKID.

> The exit status of the thread is stored in *THREAD_RETURN, if

> @@ -240,6 +251,18 @@ extern int pthread_timedjoin_np (pthread_t __th,

> void **__thread_return, extern int pthread_clockjoin_np (pthread_t

> __th, void **__thread_return, clockid_t __clockid,

>  				 const struct timespec *__abstime);

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_clockjoin_np,

> +                       (pthread_t __th, void **__thread_return,

> +                        clockid_t __clockid,

> +                        const struct timespec *__abstime),

> +                       __pthread_clockjoin_np64);

> +#  else

> +#  define pthread_clockjoin_np __pthread_clockjoin_np64

> +#  endif

> +# endif

>  #endif

>  

>  /* Indicate that the thread TH is never to be joined with

> PTHREAD_JOIN. @@ -776,6 +799,17 @@ extern int pthread_mutex_lock

> (pthread_mutex_t *__mutex) extern int pthread_mutex_timedlock

> (pthread_mutex_t *__restrict __mutex, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,

> +                             (pthread_mutex_t *__restrict __mutex,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_mutex_timedlock64);

> +#  else

> +#   define pthread_mutex_timedlock __pthread_mutex_timedlock64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -783,6 +817,18 @@ extern int pthread_mutex_clocklock

> (pthread_mutex_t *__restrict __mutex, clockid_t __clockid,

>  				    const struct timespec *__restrict

>  				    __abstime) __THROWNL __nonnull

> ((1, 3)); +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,

> +                             (pthread_mutex_t *__restrict __mutex,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_mutex_clocklock64);

> +#  else

> +#   define pthread_mutex_clocklock __pthread_mutex_clocklock64

> +#  endif

> +# endif

>  #endif

>  

>  /* Unlock a mutex.  */

> @@ -922,6 +968,17 @@ extern int pthread_rwlock_tryrdlock

> (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedrdlock

> (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_timedrdlock64);

> +#   else

> +#    define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64

> +#   endif

> +#  endif

>  # endif

>  

>  # ifdef __USE_GNU

> @@ -929,6 +986,18 @@ extern int pthread_rwlock_clockrdlock

> (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

>  				       const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_clockrdlock64);

> +#   else

> +#    define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Acquire write lock for RWLOCK.  */

> @@ -944,6 +1013,17 @@ extern int pthread_rwlock_trywrlock

> (pthread_rwlock_t *__rwlock) extern int pthread_rwlock_timedwrlock

> (pthread_rwlock_t *__restrict __rwlock, const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 2));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_timedwrlock64);

> +#   else

> +#    define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64

> +#   endif

> +#  endif

>  # endif

>  

>  # ifdef __USE_GNU

> @@ -951,6 +1031,18 @@ extern int pthread_rwlock_clockwrlock

> (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid,

>  				       const struct timespec

> *__restrict __abstime) __THROWNL __nonnull ((1, 3));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT_NTHNL)

> +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,

> +                             (pthread_rwlock_t *__restrict __rwlock,

> +                              clockid_t __clockid,

> +                              const struct timespec *__restrict

> __abstime),

> +                             __pthread_rwlock_clockwrlock64);

> +#   else

> +#    define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Unlock RWLOCK.  */

> @@ -1032,6 +1124,18 @@ extern int pthread_cond_timedwait

> (pthread_cond_t *__restrict __cond, const struct timespec *__restrict

> __abstime) __nonnull ((1, 2, 3));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_cond_timedwait,

> +                       (pthread_cond_t *__restrict __cond,

> +                        pthread_mutex_t *__restrict __mutex,

> +                        const struct timespec *__restrict __abstime),

> +                       __pthread_cond_timedwait64);

> +#  else

> +#  define pthread_cond_timedwait __pthread_cond_timedwait64

> +#  endif

> +# endif

> +

>  # ifdef __USE_GNU

>  /* Wait for condition variable COND to be signaled or broadcast until

>     ABSTIME measured by the specified clock. MUTEX is assumed to be

> @@ -1045,6 +1149,19 @@ extern int pthread_cond_clockwait

> (pthread_cond_t *__restrict __cond, __clockid_t __clock_id,

>  				   const struct timespec *__restrict

> __abstime) __nonnull ((1, 2, 4));

> +

> +#  ifdef __USE_TIME_BITS64

> +#   if defined(__REDIRECT)

> +extern int __REDIRECT (pthread_cond_clockwait,

> +                       (pthread_cond_t *__restrict __cond,

> +                        pthread_mutex_t *__restrict __mutex,

> +                        __clockid_t __clock_id,

> +                        const struct timespec *__restrict __abstime),

> +                       __pthread_cond_clockwait64);

> +#   else

> +#   define pthread_cond_clockwait __pthread_cond_clockwait64

> +#   endif

> +#  endif

>  # endif

>  

>  /* Functions for handling condition variable attributes.  */

> diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h

> index 436d21cb08..6a6055fc3a 100644

> --- a/sysdeps/pthread/semaphore.h

> +++ b/sysdeps/pthread/semaphore.h

> @@ -62,6 +62,17 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1));

>  extern int sem_timedwait (sem_t *__restrict __sem,

>  			  const struct timespec *__restrict

> __abstime) __nonnull ((1, 2));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (sem_timedwait,

> +                       (sem_t *__restrict __sem,

> +                        const struct timespec *__restrict __abstime),

> +                        __sem_timedwait64);

> +#  else

> +#   define sem_timedwait __sem_timedwait64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -69,6 +80,18 @@ extern int sem_clockwait (sem_t *__restrict __sem,

>  			  clockid_t clock,

>  			  const struct timespec *__restrict

> __abstime) __nonnull ((1, 3));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (sem_clockwait,

> +                       (sem_t *__restrict __sem,

> +                        clockid_t clock,

> +                        const struct timespec *__restrict __abstime),

> +                        __sem_clockwait64);

> +#  else

> +#   define sem_clockwait __sem_clockwait64

> +#  endif

> +# endif

>  #endif

>  

>  /* Test whether SEM is posted.  */

> diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h

> index 0ac489b4a1..acdc7b329a 100644

> --- a/sysdeps/pthread/threads.h

> +++ b/sysdeps/pthread/threads.h

> @@ -91,6 +91,16 @@ extern thrd_t thrd_current (void);

>  extern int thrd_sleep (const struct timespec *__time_point,

>  		       struct timespec *__remaining);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (thrd_sleep, (const struct timespec

> *__time_point,

> +                                    struct timespec *__remaining),

> +                       __thrd_sleep64);

> +# else

> +#  define thrd_sleep __thrd_sleep64

> +# endif

> +#endif

> +

>  /* Terminate current thread execution, cleaning up any thread local

>     storage and freeing resources.  Returns the value specified in

> __RES.  */ extern void thrd_exit (int __res) __attribute__

> ((__noreturn__)); @@ -134,6 +144,17 @@ extern int mtx_lock (mtx_t

> *__mutex); extern int mtx_timedlock (mtx_t *__restrict __mutex,

>  			  const struct timespec *__restrict

> __time_point); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (mtx_timedlock, (mtx_t *__restrict __mutex,

> +                                       const struct timespec

> *__restrict

> +                                       __time_point),

> +                       __mtx_timedlock64);

> +# else

> +#  define mtx_timedlock __mtx_timedlock64

> +# endif

> +#endif

> +

>  /* Try to lock the mutex pointed by __MUTEX without blocking.  If

> the mutex is free the current threads takes control of it, otherwise

> it returns immediately.  */

> @@ -175,6 +196,18 @@ extern int cnd_timedwait (cnd_t *__restrict

> __cond, mtx_t *__restrict __mutex,

>  			  const struct timespec *__restrict

> __time_point); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (cnd_timedwait, (cnd_t *__restrict __cond,

> +                                       mtx_t *__restrict __mutex,

> +                                       const struct timespec

> *__restrict

> +                                       __time_point),

> +                       __cnd_timedwait64);

> +# else

> +#  define cnd_timedwait __cnd_timedwait64

> +# endif

> +#endif

> +

>  /* Destroy condition variable pointed by __cond and free all of its

>     resources.  */

>  extern void cnd_destroy (cnd_t *__COND);

> diff --git a/sysdeps/unix/sysv/linux/bits/time.h

> b/sysdeps/unix/sysv/linux/bits/time.h index e0962744e1..7168ef1948

> 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h

> +++ b/sysdeps/unix/sysv/linux/bits/time.h

> @@ -77,6 +77,16 @@ __BEGIN_DECLS

>  /* Tune a POSIX clock.  */

>  extern int clock_adjtime (__clockid_t __clock_id, struct timex

> *__utx) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id,

> +                                           struct timex *__utx),

> +                           __clock_adjtime64);

> +# else

> +# define clock_adjtime __clock_adjtime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  #endif /* use GNU */

>  

> diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h

> b/sysdeps/unix/sysv/linux/sys/timerfd.h index 0ae60b65bd..cd252476a7

> 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h

> +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h

> @@ -47,9 +47,31 @@ extern int timerfd_settime (int __ufd, int __flags,

>  			    const struct itimerspec *__utmr,

>  			    struct itimerspec *__otmr) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timerfd_settime,

> +                           (int __ufd, int __flags,

> +                            const struct itimerspec *__restrict

> __value,

> +                            struct itimerspec *__restrict __ovalue),

> +                           __timerfd_settime64);

> +# else

> +# define timerfd_settime __timerfd_settime64

> +# endif

> +#endif

> +

>  /* Return the next expiration time of UFD.  */

>  extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd,

> +                                             struct itimerspec

> *__otmr),

> +                           __timerfd_gettime64);

> +# else

> +# define timerfd_gettime __timerfd_gettime64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* sys/timerfd.h */

> diff --git a/sysdeps/unix/sysv/linux/sys/timex.h

> b/sysdeps/unix/sysv/linux/sys/timex.h index 6979b86b72..b5271152bb

> 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h

> +++ b/sysdeps/unix/sysv/linux/sys/timex.h

> @@ -57,15 +57,46 @@ __BEGIN_DECLS

>  extern int __adjtimex (struct timex *__ntx) __THROW;

>  extern int adjtimex (struct timex *__ntx) __THROW;

>  

> -#ifdef __REDIRECT_NTH

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),

> +                           ___adjtimex64);

> +# else

> +# define adjtimex ___adjtimex64

> +# endif

> +#endif

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

>  extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> -			   ntp_gettimex);

> +                           __ntp_gettime64);

> +extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),

> +                           __ntp_gettimex64);

> +# else

> +# define ntp_gettime __ntp_gettime64

> +# define ntp_gettimex __ntp_gettimex64

> +# endif

>  #else

> +# ifdef __REDIRECT_NTH

> +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),

> +			   ntp_gettimex);

> +# else

>  extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;

> -# define ntp_gettime ntp_gettimex

> +#  define ntp_gettime ntp_gettimex

> +# endif

>  #endif

> +

>  extern int ntp_adjtime (struct timex *__tntx) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),

> +                           ___adjtimex64);

> +# else

> +# define ntp_adjtime ___adjtimex64

> +# endif

> +#endif

> +

>  __END_DECLS

>  

>  #endif /* sys/timex.h */

> diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h

> index c70cfa582c..f39c153b86 100644

> --- a/sysvipc/sys/msg.h

> +++ b/sysvipc/sys/msg.h

> @@ -60,6 +60,16 @@ __BEGIN_DECLS

>  /* Message queue control operation.  */

>  extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (msgctl,

> +                           (int __msqid, int __cmd, struct msqid_ds

> *__buf),

> +                           __msgctl64);

> +# else

> +# define msgctl __msgctl64

> +# endif

> +#endif

> +

>  /* Get messages queue.  */

>  extern int msgget (key_t __key, int __msgflg) __THROW;

>  

> diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h

> index 4ede2dd6ef..b26c17914c 100644

> --- a/sysvipc/sys/sem.h

> +++ b/sysvipc/sys/sem.h

> @@ -50,6 +50,16 @@ __BEGIN_DECLS

>  /* Semaphore control operation.  */

>  extern int semctl (int __semid, int __semnum, int __cmd, ...)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (semctl,

> +                           (int __semid, int __semnum, int __cmd,

> ...),

> +                           __semctl64);

> +# else

> +# define semctl __semctl64

> +# endif

> +#endif

> +

>  /* Get semaphore.  */

>  extern int semget (key_t __key, int __nsems, int __semflg) __THROW;

>  

> @@ -60,6 +70,17 @@ extern int semop (int __semid, struct sembuf

> *__sops, size_t __nsops) __THROW; /* Operate on semaphore with

> timeout.  */ extern int semtimedop (int __semid, struct sembuf

> *__sops, size_t __nsops, const struct timespec *__timeout) __THROW;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (semtimedop, (int __semid, struct sembuf

> *__sops,

> +                                        size_t __nsops,

> +                                        const struct timespec

> *__timeout),

> +                           __semtimedop64);

> +#  else

> +#  define semtimedop __semtimedop64

> +#  endif

> +# endif

>  #endif

>  

>  __END_DECLS

> diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h

> index 6c58742c4f..8d74911e55 100644

> --- a/sysvipc/sys/shm.h

> +++ b/sysvipc/sys/shm.h

> @@ -48,6 +48,16 @@ __BEGIN_DECLS

>  /* Shared memory control operation.  */

>  extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (shmctl,

> +                           (int __shmid, int __cmd, struct shmid_ds

> *__buf),

> +                           __shmctl64);

> +# else

> +# define shmctl __shmctl64

> +# endif

> +#endif

> +

>  /* Get shared memory segment.  */

>  extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW;

>  

> diff --git a/time/sys/time.h b/time/sys/time.h

> index 21fa9ed451..d3bf1e6588 100644

> --- a/time/sys/time.h

> +++ b/time/sys/time.h

> @@ -66,6 +66,16 @@ struct timezone

>  extern int gettimeofday (struct timeval *__restrict __tv,

>  			 void *__restrict __tz) __THROW __nonnull

> ((1)); 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict

> __tv,

> +                                          void *__restrict __tz),

> +                           __gettimeofday64);

> +# else

> +# define gettimeofday __gettimeofday64

> +# endif

> +#endif

> +

>  #ifdef __USE_MISC

>  /* Set the current time of day and timezone information.

>     This call is restricted to the super-user.

> @@ -76,12 +86,33 @@ extern int settimeofday (const struct timeval

> *__tv, const struct timezone *__tz)

>       __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (settimeofday, (const struct timeval *__tv,

> +                                          const struct timezone

> *__tz),

> +                           __settimeofday64);

> +# else

> +# define settimeofday __settimeofday64

> +# endif

> +#endif

> +

>  /* Adjust the current time of day by the amount in DELTA.

>     If OLDDELTA is not NULL, it is filled in with the amount

>     of time adjustment remaining to be done from the last `adjtime'

> call. This call is restricted to the super-user.  */

>  extern int adjtime (const struct timeval *__delta,

>  		    struct timeval *__olddelta) __THROW;

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (adjtime, (const struct timeval *__delta,

> +                                     struct timeval *__olddelta),

> +                           __adjtime64);

> +# else

> +# define adjtime __adjtime64

> +# endif

> +#endif

> +

>  #endif

>  

>  

> @@ -123,6 +154,16 @@ typedef int __itimer_which_t;

>  extern int getitimer (__itimer_which_t __which,

>  		      struct itimerval *__value) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (getitimer, (__itimer_which_t __which,

> +                                       struct itimerval *__value),

> +                           __getitimer64);

> +# else

> +# define getitimer __getitimer64

> +# endif

> +#endif

> +

>  /* Set the timer WHICH to *NEW.  If OLD is not NULL,

>     set *OLD to the old value of timer WHICH.

>     Returns 0 on success, -1 on errors.  */

> @@ -130,19 +171,59 @@ extern int setitimer (__itimer_which_t __which,

>  		      const struct itimerval *__restrict __new,

>  		      struct itimerval *__restrict __old) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (setitimer, (__itimer_which_t __which,

> +                                       const struct itimerval

> *__restrict __new,

> +                                       struct itimerval *__restrict

> __old),

> +                           __setitimer64);

> +# else

> +# define setitimer __setitimer64

> +# endif

> +#endif

> +

>  /* Change the access time of FILE to TVP[0] and the modification

> time of FILE to TVP[1].  If TVP is a null pointer, use the current

> time instead. Returns 0 on success, -1 on errors.  */

>  extern int utimes (const char *__file, const struct timeval __tvp[2])

>       __THROW __nonnull ((1));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (utimes, (const char *__file,

> +                                    const struct timeval __tvp[2]),

> +                           __utimes64);

> +# else

> +# define utimes __utimes64

> +# endif

> +#endif

> +

>  #ifdef __USE_MISC

>  /* Same as `utimes', but does not follow symbolic links.  */

>  extern int lutimes (const char *__file, const struct timeval

> __tvp[2]) __THROW __nonnull ((1));

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (lutimes, (const char *__file,

> +                                     const struct timeval __tvp[2]),

> +                           __lutimes64);

> +#  else

> +#   define lutimes __lutimes64

> +#  endif

> +# endif

> +

>  /* Same as `utimes', but takes an open file descriptor instead of a

> name.  */ extern int futimes (int __fd, const struct timeval

> __tvp[2]) __THROW; +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval

> __tvp[2]),

> +                           __futimes64);

> +#  else

> +#   define futimes __futimes64

> +#  endif

> +# endif

>  #endif

>  

>  #ifdef __USE_GNU

> @@ -151,6 +232,16 @@ extern int futimes (int __fd, const struct

> timeval __tvp[2]) __THROW; the current time instead.  Returns 0 on

> success, -1 on errors.  */ extern int futimesat (int __fd, const char

> *__file, const struct timeval __tvp[2]) __THROW;

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (futimesat, (int __fd, const char *__file,

> +                                       const struct timeval

> __tvp[2]),

> +                           __futimesat64);

> +#  else

> +#   define futimesat __futimesat64

> +#  endif

> +# endif

>  #endif

>  

>  

> diff --git a/time/time.h b/time/time.h

> index 015bc1c7f3..9a74f01b2f 100644

> --- a/time/time.h

> +++ b/time/time.h

> @@ -74,13 +74,37 @@ extern clock_t clock (void) __THROW;

>  /* Return the current time and put it in *TIMER if TIMER is not

> NULL.  */ extern time_t time (time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64);

> +# else

> +# define time __time64

> +# endif

> +#endif

> +

>  /* Return the difference between TIME1 and TIME0.  */

>  extern double difftime (time_t __time1, time_t __time0)

>       __THROW __attribute__ ((__const__));

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t

> __time0),

> +                              __difftime64);

> +# else

> +# define difftime __difftime64

> +# endif

> +#endif

> +

>  /* Return the `time_t' representation of TP and normalize TP.  */

>  extern time_t mktime (struct tm *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64);

> +# else

> +# define mktime __mktime64

> +# endif

> +#endif

>  

>  /* Format TP into S according to FORMAT.

>     Write no more than MAXSIZE characters and return the number

> @@ -118,6 +142,14 @@ extern char *strptime_l (const char *__restrict

> __s, in Universal Coordinated Time (aka Greenwich Mean Time).  */

>  extern struct tm *gmtime (const time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer),

> __gmtime64); +# else

> +# define gmtime __gmtime64

> +# endif

> +#endif

> +

>  /* Return the `struct tm' representation

>     of *TIMER in the local timezone.  */

>  extern struct tm *localtime (const time_t *__timer) __THROW;

> @@ -128,6 +160,16 @@ extern struct tm *localtime (const time_t

> *__timer) __THROW; extern struct tm *gmtime_r (const time_t

> *__restrict __timer, struct tm *__restrict __tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t *__restrict

> __timer,

> +                                            struct tm *__restrict

> __tp),

> +                                 __gmtime64_r);

> +# else

> +# define gmtime_r __gmtime64_r

> +# endif

> +#endif

> +

>  /* Return the `struct tm' representation of *TIMER in local time,

>     using *TP to store the result.  */

>  extern struct tm *localtime_r (const time_t *__restrict __timer,

> @@ -141,6 +183,14 @@ extern char *asctime (const struct tm *__tp)

> __THROW; /* Equivalent to `asctime (localtime (timer))'.  */

>  extern char *ctime (const time_t *__timer) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern char *__REDIRECT_NTH (ctime, (const time_t *__timer),

> __ctime64); +# else

> +# define ctime __ctime64

> +# endif

> +#endif

> +

>  #if defined __USE_POSIX || __GLIBC_USE (ISOC2X)

>  /* Reentrant versions of the above functions.  */

>  

> @@ -152,6 +202,16 @@ extern char *asctime_r (const struct tm

> *__restrict __tp, /* Equivalent to `asctime_r (localtime_r (timer,

> *TMP*), buf)'.  */ extern char *ctime_r (const time_t *__restrict

> __timer, char *__restrict __buf) __THROW;

> +

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict

> __timer,

> +                                       char *__restrict __buf),

> __ctime64_r); +# else

> +# define ctime_r __ctime64_r

> +# endif

> +#endif

> +

>  #endif	/* POSIX || C2X */

>  

>  

> @@ -189,6 +249,14 @@ extern long int timezone;

>  /* Like `mktime', but for TP represents Universal Time, not local

> time.  */ extern time_t timegm (struct tm *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);

> +# else

> +# define timegm __timegm64

> +# endif

> +#endif

> +

>  /* Another name for `mktime'.  */

>  extern time_t timelocal (struct tm *__tp) __THROW;

>  

> @@ -205,17 +273,54 @@ extern int dysize (int __year) __THROW

> __attribute__ ((__const__)); extern int nanosleep (const struct

> timespec *__requested_time, struct timespec *__remaining);

>  

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT)

> +extern int __REDIRECT (nanosleep, (const struct timespec

> *__requested_time,

> +                                   struct timespec *__remaining),

> +                       __nanosleep64);

> +#  else

> +#   define nanosleep __nanosleep64

> +#  endif

> +# endif

>  

>  /* Get resolution of clock CLOCK_ID.  */

>  extern int clock_getres (clockid_t __clock_id, struct timespec

> *__res) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id,

> +                                          struct timespec *__res),

> +                           __clock_getres64);

> +# else

> +# define clock_getres __clock_getres64

> +# endif

> +#endif

> +

>  /* Get current value of clock CLOCK_ID and store it in TP.  */

>  extern int clock_gettime (clockid_t __clock_id, struct timespec

> *__tp) __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id,

> struct

> +                                           timespec *__tp),

> __clock_gettime64); +# else

> +# define clock_gettime __clock_gettime64

> +# endif

> +#endif

> +

>  /* Set clock CLOCK_ID to value TP.  */

>  extern int clock_settime (clockid_t __clock_id, const struct

> timespec *__tp) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id,

> const struct

> +                                           timespec *__tp),

> __clock_settime64); +# else

> +# define clock_settime __clock_settime64

> +# endif

> +#endif

> +

>  # ifdef __USE_XOPEN2K

>  /* High-resolution sleep with the specified clock.

>  

> @@ -225,6 +330,17 @@ extern int clock_nanosleep (clockid_t

> __clock_id, int __flags, const struct timespec *__req,

>  			    struct timespec *__rem);

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT)

> +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int

> __flags,

> +                                         const struct timespec

> *__req,

> +                                         struct timespec *__rem),

> +                       __clock_nanosleep_time64);

> +# else

> +# define clock_nanosleep __clock_nanosleep_time64

> +# endif

> +#endif

> +

>  /* Return clock ID for CPU-time clock.  */

>  extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id)

> __THROW; # endif

> @@ -243,10 +359,31 @@ extern int timer_settime (timer_t __timerid,

> int __flags, const struct itimerspec *__restrict __value,

>  			  struct itimerspec *__restrict __ovalue)

> __THROW; 

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int

> __flags,

> +     const struct itimerspec *__restrict __value,

> +     struct itimerspec *__restrict __ovalue),

> +                          __timer_settime64);

> +# else

> +# define timer_settime __timer_settime64

> +# endif

> +#endif

> +

>  /* Get current value of timer TIMERID and store it in VALUE.  */

>  extern int timer_gettime (timer_t __timerid, struct itimerspec

> *__value) __THROW;

>  

> +#ifdef __USE_TIME_BITS64

> +# if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid,

> +                                           struct itimerspec

> *__value),

> +                           __timer_gettime64) __nonnull ((1));

> +# else

> +# define timer_gettime __timer_gettime64

> +# endif

> +#endif

> +

>  /* Get expiration overrun for timer TIMERID.  */

>  extern int timer_getoverrun (timer_t __timerid) __THROW;

>  #endif

> @@ -256,6 +393,15 @@ extern int timer_getoverrun (timer_t __timerid)

> __THROW; /* Set TS to calendar time based in time base BASE.  */

>  extern int timespec_get (struct timespec *__ts, int __base)

>       __THROW __nonnull ((1));

> +

> +# ifdef __USE_TIME_BITS64

> +#  if defined(__REDIRECT_NTH)

> +extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int

> __base),

> +                           __timespec_get64);

> +#  else

> +#  define timespec_get __timespec_get64

> +#  endif

> +# endif

>  #endif

>  

>  





Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Patch

diff --git a/io/sys/poll.h b/io/sys/poll.h
index 857be0f5ac..4a725ed18e 100644
--- a/io/sys/poll.h
+++ b/io/sys/poll.h
@@ -63,6 +63,17 @@  extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
 extern int ppoll (struct pollfd *__fds, nfds_t __nfds,
 		  const struct timespec *__timeout,
 		  const __sigset_t *__ss);
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds,
+                               const struct timespec *__timeout,
+                               const __sigset_t *__ss),
+                       __ppoll64);
+#  else
+#  define ppoll __ppoll64
+#  endif
+# endif
 #endif
 
 __END_DECLS
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 58c3770622..b3f2f0da99 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -361,11 +361,31 @@  extern int utimensat (int __fd, const char *__path,
 		      const struct timespec __times[2],
 		      int __flags)
      __THROW __nonnull ((2));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
+                                       const struct timespec __times[2],
+                                       int flags),
+                           __utimensat64) __nonnull ((2));
+#  else
+#  define utimensat __utimensat64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_XOPEN2K8
 /* Set file access and modification times of the file associated with FD.  */
 extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]),
+                           __futimens64);
+#  else
+#  define futimens __futimens64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_GNU
diff --git a/io/utime.h b/io/utime.h
index 07659016ab..f607bf0aad 100644
--- a/io/utime.h
+++ b/io/utime.h
@@ -45,6 +45,16 @@  extern int utime (const char *__file,
 		  const struct utimbuf *__file_times)
      __THROW __nonnull ((1));
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (utime, (const char *__file,
+                                   const struct utimbuf *__file_times),
+                           __utime64);
+# else
+# define utime __utime64
+# endif
+#endif
+
 __END_DECLS
 
 #endif /* utime.h */
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 29d011c2d5..779a6e81b6 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -103,6 +103,19 @@  extern int select (int __nfds, fd_set *__restrict __readfds,
 		   fd_set *__restrict __exceptfds,
 		   struct timeval *__restrict __timeout);
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (select,
+                       (int __nfds, fd_set *__restrict __readfds,
+                        fd_set *__restrict __writefds,
+                        fd_set *__restrict __exceptfds,
+                        struct timeval *__restrict __timeout),
+                       __select64);
+# else
+#  define select __select64
+# endif
+#endif
+
 #ifdef __USE_XOPEN2K
 /* Same as above only that the TIMEOUT value is given with higher
    resolution and a sigmask which is been set temporarily.  This version
@@ -115,6 +128,20 @@  extern int pselect (int __nfds, fd_set *__restrict __readfds,
 		    fd_set *__restrict __exceptfds,
 		    const struct timespec *__restrict __timeout,
 		    const __sigset_t *__restrict __sigmask);
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (pselect,
+                       (int __nfds, fd_set *__restrict __readfds,
+                        fd_set *__restrict __writefds,
+                        fd_set *__restrict __exceptfds,
+                        const struct timespec *__restrict __timeout,
+                        const __sigset_t *__restrict __sigmask),
+                       __pselect64);
+#  else
+#   define pselect __pselect64
+#  endif
+# endif
 #endif
 
 
diff --git a/posix/sched.h b/posix/sched.h
index 60c9c3c710..0d9cbc5bb2 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -76,6 +76,15 @@  extern int sched_get_priority_min (int __algorithm) __THROW;
 /* Get the SCHED_RR interval for the named process.  */
 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (sched_rr_get_interval,
+                           (__pid_t __pid, struct timespec *__t),
+                           __sched_rr_get_interval64);
+# else
+# define sched_rr_get_interval __sched_rr_get_interval64
+# endif
+#endif
 
 #ifdef __USE_GNU
 /* Access macros for `cpu_set'.  */
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index a42e16c1b0..68ec036b29 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -146,12 +146,32 @@  struct rusage;
    otherwise don't.  */
 extern __pid_t wait3 (int *__stat_loc, int __options,
 		      struct rusage * __usage) __THROWNL;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTHNL)
+extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int __options,
+                                         struct rusage * __usage)
+                                 __wait3_time64);
+#  else
+#  define wait3 __wait3_time64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_MISC
 /* PID is like waitpid.  Other args are like wait3.  */
 extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options,
 		      struct rusage *__usage) __THROWNL;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTHNL)
+extern __pid_t __REDIRECT_NTHNL (wait4, (__pid_t __pid, int *__stat_loc,
+                                         int __options, struct rusage *__usage),
+                                 __wait4_time64);
+#  else
+#  define wait4 __wait4_time64
+#  endif
+# endif
 #endif /* Use misc.  */
 
 
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 575e416dac..bd0832988f 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -701,6 +701,17 @@  extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
 extern int gai_suspend (const struct gaicb *const __list[], int __ent,
 			const struct timespec *__timeout);
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (gai_suspend, (const struct gaicb *const __list[],
+                                     int __ent,
+                                     const struct timespec *__timeout),
+                       __gai_suspend_time64);
+#  else
+#   define gai_suspend __gai_suspend_time64
+#  endif
+# endif
+
 /* Get the error status of the request REQ.  */
 extern int gai_error (struct gaicb *__req) __THROW;
 
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index 4edafb50d5..98f05cf1c4 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -86,6 +86,16 @@  extern int setrlimit64 (__rlimit_resource_t __resource,
    and put it in *USAGE.  Returns 0 for success, -1 for failure.  */
 extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who,
+                                       struct rusage *__usage),
+                           __getrusage64);
+# else
+# define getrusage __getrusage64
+# endif
+#endif
+
 /* Return the highest priority of any process specified by WHICH and WHO
    (see above); if WHO is zero, the current process, process group, or user
    (as specified by WHO) is used.  A lower priority number means higher
diff --git a/rt/aio.h b/rt/aio.h
index 148d31a0af..2c35f1b04c 100644
--- a/rt/aio.h
+++ b/rt/aio.h
@@ -193,12 +193,17 @@  extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp),
 extern int __REDIRECT_NTH (aio_cancel,
 			   (int __fildes, struct aiocb *__aiocbp),
 			   aio_cancel64);
-
+#  ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (aio_suspend,
+			   (const struct aiocb *const __list[], int __nent,
+			    const struct timespec *__restrict __timeout),
+			   __aio_suspend_time64) __nonnull ((1));
+#  else
 extern int __REDIRECT_NTH (aio_suspend,
 			   (const struct aiocb *const __list[], int __nent,
 			    const struct timespec *__restrict __timeout),
 			   aio_suspend64) __nonnull ((1));
-
+#  endif
 extern int __REDIRECT_NTH (aio_fsync,
 			   (int __operation, struct aiocb *__aiocbp),
 			   aio_fsync64) __nonnull ((2));
@@ -210,7 +215,11 @@  extern int __REDIRECT_NTH (aio_fsync,
 #  define aio_error aio_error64
 #  define aio_return aio_return64
 #  define aio_cancel aio_cancel64
-#  define aio_suspend aio_suspend64
+#  ifdef __USE_TIME_BITS64
+#   define aio_suspend __aio_suspend_time64
+#  else
+#   define aio_suspend aio_suspend64
+#  endif
 #  define aio_fsync aio_fsync64
 # endif
 #endif
@@ -234,6 +243,16 @@  extern int aio_cancel64 (int __fildes, struct aiocb64 *__aiocbp) __THROW;
 extern int aio_suspend64 (const struct aiocb64 *const __list[], int __nent,
 			  const struct timespec *__restrict __timeout)
   __THROW __nonnull ((1));
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (aio_suspend64,
+			   (const struct aiocb *const __list[], int __nent,
+			    const struct timespec *__restrict __timeout),
+			   __aio_suspend_time64) __nonnull ((1));
+#  else
+#   define aio_suspend64 __aio_suspend_time64
+#  endif
+# endif
 
 extern int aio_fsync64 (int __operation, struct aiocb64 *__aiocbp)
   __THROW __nonnull ((2));
diff --git a/rt/mqueue.h b/rt/mqueue.h
index a2a2aa1771..e6b8641c62 100644
--- a/rt/mqueue.h
+++ b/rt/mqueue.h
@@ -79,12 +79,37 @@  extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
 				const struct timespec *__restrict __abs_timeout)
   __nonnull ((2, 5));
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes,
+                               char *__restrict __msg_ptr,
+                               size_t __msg_len,
+                               unsigned int *__restrict __msg_prio,
+                               const struct timespec *__restrict __abs_timeout),
+                       __mq_timedreceive_time64);
+#  else
+#   define mq_timedreceive __mq_timedreceive_time64
+#  endif
+# endif
+
 /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
    on full message queue if ABS_TIMEOUT expires.  */
 extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr,
 			 size_t __msg_len, unsigned int __msg_prio,
 			 const struct timespec *__abs_timeout)
   __nonnull ((2, 5));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes,
+                       const char *__msg_ptr, size_t __msg_len,
+                       unsigned int __msg_prio,
+                       const struct timespec *__abs_timeout),
+     __mq_timedsend_time64);
+#  else
+#   define mq_timedsend __mq_timedsend_time64
+#  endif
+# endif
 #endif
 
 /* Define some inlines helping to catch common problems.  */
diff --git a/signal/signal.h b/signal/signal.h
index effe3d698f..564820e366 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -274,6 +274,18 @@  extern int sigtimedwait (const sigset_t *__restrict __set,
 			 const struct timespec *__restrict __timeout)
      __nonnull ((1));
 
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT)
+extern int __REDIRECT (sigtimedwait,
+                       (const sigset_t *__restrict __set,
+                        siginfo_t *__restrict __info,
+                        const struct timespec *__restrict __timeout),
+                       __sigtimedwait64);
+#   else
+#    define sigtimedwait __sigtimedwait64
+#   endif
+#  endif
+
 /* Send signal SIG to the process PID.  Associate data in VAL with the
    signal.  */
 extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index 7780c00ecb..2273c52cdf 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -199,6 +199,17 @@  extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
 extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
 		     unsigned int __vlen, int __flags,
 		     struct timespec *__tmo);
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages,
+                                  unsigned int __vlen, int __flags,
+                                  struct timespec *__tmo),
+                       __recvmmsg64);
+#  else
+#   define recvmmsg __recvmmsg64
+#  endif
+# endif
 #endif
 
 
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index 3a34d82342..982ed32baa 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -230,6 +230,17 @@  extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
 extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
 				 const struct timespec *__abstime);
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (pthread_timedjoin_np,
+                       (pthread_t __th, void **__thread_return,
+                        const struct timespec *__abstime),
+                       __pthread_timedjoin_np64);
+#  else
+#  define pthread_timedjoin_np __pthread_timedjoin_np64
+#  endif
+# endif
+
 /* Make calling thread wait for termination of the thread TH, but only
    until TIMEOUT measured against the clock specified by CLOCKID.  The
    exit status of the thread is stored in *THREAD_RETURN, if
@@ -240,6 +251,18 @@  extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
 extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
                                  clockid_t __clockid,
 				 const struct timespec *__abstime);
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (pthread_clockjoin_np,
+                       (pthread_t __th, void **__thread_return,
+                        clockid_t __clockid,
+                        const struct timespec *__abstime),
+                       __pthread_clockjoin_np64);
+#  else
+#  define pthread_clockjoin_np __pthread_clockjoin_np64
+#  endif
+# endif
 #endif
 
 /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
@@ -776,6 +799,17 @@  extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
 				    const struct timespec *__restrict
 				    __abstime) __THROWNL __nonnull ((1, 2));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
+                             (pthread_mutex_t *__restrict __mutex,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_mutex_timedlock64);
+#  else
+#   define pthread_mutex_timedlock __pthread_mutex_timedlock64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_GNU
@@ -783,6 +817,18 @@  extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
 				    clockid_t __clockid,
 				    const struct timespec *__restrict
 				    __abstime) __THROWNL __nonnull ((1, 3));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,
+                             (pthread_mutex_t *__restrict __mutex,
+                              clockid_t __clockid,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_mutex_clocklock64);
+#  else
+#   define pthread_mutex_clocklock __pthread_mutex_clocklock64
+#  endif
+# endif
 #endif
 
 /* Unlock a mutex.  */
@@ -922,6 +968,17 @@  extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
 				       const struct timespec *__restrict
 				       __abstime) __THROWNL __nonnull ((1, 2));
+
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
+                             (pthread_rwlock_t *__restrict __rwlock,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_rwlock_timedrdlock64);
+#   else
+#    define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64
+#   endif
+#  endif
 # endif
 
 # ifdef __USE_GNU
@@ -929,6 +986,18 @@  extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
 				       clockid_t __clockid,
 				       const struct timespec *__restrict
 				       __abstime) __THROWNL __nonnull ((1, 3));
+
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,
+                             (pthread_rwlock_t *__restrict __rwlock,
+                              clockid_t __clockid,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_rwlock_clockrdlock64);
+#   else
+#    define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64
+#   endif
+#  endif
 # endif
 
 /* Acquire write lock for RWLOCK.  */
@@ -944,6 +1013,17 @@  extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
 				       const struct timespec *__restrict
 				       __abstime) __THROWNL __nonnull ((1, 2));
+
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
+                             (pthread_rwlock_t *__restrict __rwlock,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_rwlock_timedwrlock64);
+#   else
+#    define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64
+#   endif
+#  endif
 # endif
 
 # ifdef __USE_GNU
@@ -951,6 +1031,18 @@  extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
 				       clockid_t __clockid,
 				       const struct timespec *__restrict
 				       __abstime) __THROWNL __nonnull ((1, 3));
+
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT_NTHNL)
+extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,
+                             (pthread_rwlock_t *__restrict __rwlock,
+                              clockid_t __clockid,
+                              const struct timespec *__restrict __abstime),
+                             __pthread_rwlock_clockwrlock64);
+#   else
+#    define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64
+#   endif
+#  endif
 # endif
 
 /* Unlock RWLOCK.  */
@@ -1032,6 +1124,18 @@  extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
 				   const struct timespec *__restrict __abstime)
      __nonnull ((1, 2, 3));
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (pthread_cond_timedwait,
+                       (pthread_cond_t *__restrict __cond,
+                        pthread_mutex_t *__restrict __mutex,
+                        const struct timespec *__restrict __abstime),
+                       __pthread_cond_timedwait64);
+#  else
+#  define pthread_cond_timedwait __pthread_cond_timedwait64
+#  endif
+# endif
+
 # ifdef __USE_GNU
 /* Wait for condition variable COND to be signaled or broadcast until
    ABSTIME measured by the specified clock. MUTEX is assumed to be
@@ -1045,6 +1149,19 @@  extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
 				   __clockid_t __clock_id,
 				   const struct timespec *__restrict __abstime)
      __nonnull ((1, 2, 4));
+
+#  ifdef __USE_TIME_BITS64
+#   if defined(__REDIRECT)
+extern int __REDIRECT (pthread_cond_clockwait,
+                       (pthread_cond_t *__restrict __cond,
+                        pthread_mutex_t *__restrict __mutex,
+                        __clockid_t __clock_id,
+                        const struct timespec *__restrict __abstime),
+                       __pthread_cond_clockwait64);
+#   else
+#   define pthread_cond_clockwait __pthread_cond_clockwait64
+#   endif
+#  endif
 # endif
 
 /* Functions for handling condition variable attributes.  */
diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h
index 436d21cb08..6a6055fc3a 100644
--- a/sysdeps/pthread/semaphore.h
+++ b/sysdeps/pthread/semaphore.h
@@ -62,6 +62,17 @@  extern int sem_wait (sem_t *__sem) __nonnull ((1));
 extern int sem_timedwait (sem_t *__restrict __sem,
 			  const struct timespec *__restrict __abstime)
   __nonnull ((1, 2));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (sem_timedwait,
+                       (sem_t *__restrict __sem,
+                        const struct timespec *__restrict __abstime),
+                        __sem_timedwait64);
+#  else
+#   define sem_timedwait __sem_timedwait64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_GNU
@@ -69,6 +80,18 @@  extern int sem_clockwait (sem_t *__restrict __sem,
 			  clockid_t clock,
 			  const struct timespec *__restrict __abstime)
   __nonnull ((1, 3));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (sem_clockwait,
+                       (sem_t *__restrict __sem,
+                        clockid_t clock,
+                        const struct timespec *__restrict __abstime),
+                        __sem_clockwait64);
+#  else
+#   define sem_clockwait __sem_clockwait64
+#  endif
+# endif
 #endif
 
 /* Test whether SEM is posted.  */
diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h
index 0ac489b4a1..acdc7b329a 100644
--- a/sysdeps/pthread/threads.h
+++ b/sysdeps/pthread/threads.h
@@ -91,6 +91,16 @@  extern thrd_t thrd_current (void);
 extern int thrd_sleep (const struct timespec *__time_point,
 		       struct timespec *__remaining);
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (thrd_sleep, (const struct timespec *__time_point,
+                                    struct timespec *__remaining),
+                       __thrd_sleep64);
+# else
+#  define thrd_sleep __thrd_sleep64
+# endif
+#endif
+
 /* Terminate current thread execution, cleaning up any thread local
    storage and freeing resources.  Returns the value specified in __RES.  */
 extern void thrd_exit (int __res) __attribute__ ((__noreturn__));
@@ -134,6 +144,17 @@  extern int mtx_lock (mtx_t *__mutex);
 extern int mtx_timedlock (mtx_t *__restrict __mutex,
 			  const struct timespec *__restrict __time_point);
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (mtx_timedlock, (mtx_t *__restrict __mutex,
+                                       const struct timespec *__restrict
+                                       __time_point),
+                       __mtx_timedlock64);
+# else
+#  define mtx_timedlock __mtx_timedlock64
+# endif
+#endif
+
 /* Try to lock the mutex pointed by __MUTEX without blocking.  If the mutex
    is free the current threads takes control of it, otherwise it returns
    immediately.  */
@@ -175,6 +196,18 @@  extern int cnd_timedwait (cnd_t *__restrict __cond,
 			  mtx_t *__restrict __mutex,
 			  const struct timespec *__restrict __time_point);
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (cnd_timedwait, (cnd_t *__restrict __cond,
+                                       mtx_t *__restrict __mutex,
+                                       const struct timespec *__restrict
+                                       __time_point),
+                       __cnd_timedwait64);
+# else
+#  define cnd_timedwait __cnd_timedwait64
+# endif
+#endif
+
 /* Destroy condition variable pointed by __cond and free all of its
    resources.  */
 extern void cnd_destroy (cnd_t *__COND);
diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h
index e0962744e1..7168ef1948 100644
--- a/sysdeps/unix/sysv/linux/bits/time.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -77,6 +77,16 @@  __BEGIN_DECLS
 /* Tune a POSIX clock.  */
 extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id,
+                                           struct timex *__utx),
+                           __clock_adjtime64);
+# else
+# define clock_adjtime __clock_adjtime64
+# endif
+#endif
+
 __END_DECLS
 #endif /* use GNU */
 
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index 0ae60b65bd..cd252476a7 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -47,9 +47,31 @@  extern int timerfd_settime (int __ufd, int __flags,
 			    const struct itimerspec *__utmr,
 			    struct itimerspec *__otmr) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (timerfd_settime,
+                           (int __ufd, int __flags,
+                            const struct itimerspec *__restrict __value,
+                            struct itimerspec *__restrict __ovalue),
+                           __timerfd_settime64);
+# else
+# define timerfd_settime __timerfd_settime64
+# endif
+#endif
+
 /* Return the next expiration time of UFD.  */
 extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd,
+                                             struct itimerspec *__otmr),
+                           __timerfd_gettime64);
+# else
+# define timerfd_gettime __timerfd_gettime64
+# endif
+#endif
+
 __END_DECLS
 
 #endif /* sys/timerfd.h */
diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h
index 6979b86b72..b5271152bb 100644
--- a/sysdeps/unix/sysv/linux/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/sys/timex.h
@@ -57,15 +57,46 @@  __BEGIN_DECLS
 extern int __adjtimex (struct timex *__ntx) __THROW;
 extern int adjtimex (struct timex *__ntx) __THROW;
 
-#ifdef __REDIRECT_NTH
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),
+                           ___adjtimex64);
+# else
+# define adjtimex ___adjtimex64
+# endif
+#endif
+
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
 extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
-			   ntp_gettimex);
+                           __ntp_gettime64);
+extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),
+                           __ntp_gettimex64);
+# else
+# define ntp_gettime __ntp_gettime64
+# define ntp_gettimex __ntp_gettimex64
+# endif
 #else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
+			   ntp_gettimex);
+# else
 extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
-# define ntp_gettime ntp_gettimex
+#  define ntp_gettime ntp_gettimex
+# endif
 #endif
+
 extern int ntp_adjtime (struct timex *__tntx) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),
+                           ___adjtimex64);
+# else
+# define ntp_adjtime ___adjtimex64
+# endif
+#endif
+
 __END_DECLS
 
 #endif /* sys/timex.h */
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index c70cfa582c..f39c153b86 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -60,6 +60,16 @@  __BEGIN_DECLS
 /* Message queue control operation.  */
 extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (msgctl,
+                           (int __msqid, int __cmd, struct msqid_ds *__buf),
+                           __msgctl64);
+# else
+# define msgctl __msgctl64
+# endif
+#endif
+
 /* Get messages queue.  */
 extern int msgget (key_t __key, int __msgflg) __THROW;
 
diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h
index 4ede2dd6ef..b26c17914c 100644
--- a/sysvipc/sys/sem.h
+++ b/sysvipc/sys/sem.h
@@ -50,6 +50,16 @@  __BEGIN_DECLS
 /* Semaphore control operation.  */
 extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (semctl,
+                           (int __semid, int __semnum, int __cmd, ...),
+                           __semctl64);
+# else
+# define semctl __semctl64
+# endif
+#endif
+
 /* Get semaphore.  */
 extern int semget (key_t __key, int __nsems, int __semflg) __THROW;
 
@@ -60,6 +70,17 @@  extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW;
 /* Operate on semaphore with timeout.  */
 extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
 		       const struct timespec *__timeout) __THROW;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (semtimedop, (int __semid, struct sembuf *__sops,
+                                        size_t __nsops,
+                                        const struct timespec *__timeout),
+                           __semtimedop64);
+#  else
+#  define semtimedop __semtimedop64
+#  endif
+# endif
 #endif
 
 __END_DECLS
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index 6c58742c4f..8d74911e55 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -48,6 +48,16 @@  __BEGIN_DECLS
 /* Shared memory control operation.  */
 extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (shmctl,
+                           (int __shmid, int __cmd, struct shmid_ds *__buf),
+                           __shmctl64);
+# else
+# define shmctl __shmctl64
+# endif
+#endif
+
 /* Get shared memory segment.  */
 extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW;
 
diff --git a/time/sys/time.h b/time/sys/time.h
index 21fa9ed451..d3bf1e6588 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -66,6 +66,16 @@  struct timezone
 extern int gettimeofday (struct timeval *__restrict __tv,
 			 void *__restrict __tz) __THROW __nonnull ((1));
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict __tv,
+                                          void *__restrict __tz),
+                           __gettimeofday64);
+# else
+# define gettimeofday __gettimeofday64
+# endif
+#endif
+
 #ifdef __USE_MISC
 /* Set the current time of day and timezone information.
    This call is restricted to the super-user.
@@ -76,12 +86,33 @@  extern int settimeofday (const struct timeval *__tv,
 			 const struct timezone *__tz)
      __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (settimeofday, (const struct timeval *__tv,
+                                          const struct timezone *__tz),
+                           __settimeofday64);
+# else
+# define settimeofday __settimeofday64
+# endif
+#endif
+
 /* Adjust the current time of day by the amount in DELTA.
    If OLDDELTA is not NULL, it is filled in with the amount
    of time adjustment remaining to be done from the last `adjtime' call.
    This call is restricted to the super-user.  */
 extern int adjtime (const struct timeval *__delta,
 		    struct timeval *__olddelta) __THROW;
+
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (adjtime, (const struct timeval *__delta,
+                                     struct timeval *__olddelta),
+                           __adjtime64);
+# else
+# define adjtime __adjtime64
+# endif
+#endif
+
 #endif
 
 
@@ -123,6 +154,16 @@  typedef int __itimer_which_t;
 extern int getitimer (__itimer_which_t __which,
 		      struct itimerval *__value) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (getitimer, (__itimer_which_t __which,
+                                       struct itimerval *__value),
+                           __getitimer64);
+# else
+# define getitimer __getitimer64
+# endif
+#endif
+
 /* Set the timer WHICH to *NEW.  If OLD is not NULL,
    set *OLD to the old value of timer WHICH.
    Returns 0 on success, -1 on errors.  */
@@ -130,19 +171,59 @@  extern int setitimer (__itimer_which_t __which,
 		      const struct itimerval *__restrict __new,
 		      struct itimerval *__restrict __old) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (setitimer, (__itimer_which_t __which,
+                                       const struct itimerval *__restrict __new,
+                                       struct itimerval *__restrict __old),
+                           __setitimer64);
+# else
+# define setitimer __setitimer64
+# endif
+#endif
+
 /* Change the access time of FILE to TVP[0] and the modification time of
    FILE to TVP[1].  If TVP is a null pointer, use the current time instead.
    Returns 0 on success, -1 on errors.  */
 extern int utimes (const char *__file, const struct timeval __tvp[2])
      __THROW __nonnull ((1));
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (utimes, (const char *__file,
+                                    const struct timeval __tvp[2]),
+                           __utimes64);
+# else
+# define utimes __utimes64
+# endif
+#endif
+
 #ifdef __USE_MISC
 /* Same as `utimes', but does not follow symbolic links.  */
 extern int lutimes (const char *__file, const struct timeval __tvp[2])
      __THROW __nonnull ((1));
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (lutimes, (const char *__file,
+                                     const struct timeval __tvp[2]),
+                           __lutimes64);
+#  else
+#   define lutimes __lutimes64
+#  endif
+# endif
+
 /* Same as `utimes', but takes an open file descriptor instead of a name.  */
 extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval __tvp[2]),
+                           __futimes64);
+#  else
+#   define futimes __futimes64
+#  endif
+# endif
 #endif
 
 #ifdef __USE_GNU
@@ -151,6 +232,16 @@  extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW;
    the current time instead.  Returns 0 on success, -1 on errors.  */
 extern int futimesat (int __fd, const char *__file,
 		      const struct timeval __tvp[2]) __THROW;
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (futimesat, (int __fd, const char *__file,
+                                       const struct timeval __tvp[2]),
+                           __futimesat64);
+#  else
+#   define futimesat __futimesat64
+#  endif
+# endif
 #endif
 
 
diff --git a/time/time.h b/time/time.h
index 015bc1c7f3..9a74f01b2f 100644
--- a/time/time.h
+++ b/time/time.h
@@ -74,13 +74,37 @@  extern clock_t clock (void) __THROW;
 /* Return the current time and put it in *TIMER if TIMER is not NULL.  */
 extern time_t time (time_t *__timer) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64);
+# else
+# define time __time64
+# endif
+#endif
+
 /* Return the difference between TIME1 and TIME0.  */
 extern double difftime (time_t __time1, time_t __time0)
      __THROW __attribute__ ((__const__));
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t __time0),
+                              __difftime64);
+# else
+# define difftime __difftime64
+# endif
+#endif
+
 /* Return the `time_t' representation of TP and normalize TP.  */
 extern time_t mktime (struct tm *__tp) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64);
+# else
+# define mktime __mktime64
+# endif
+#endif
 
 /* Format TP into S according to FORMAT.
    Write no more than MAXSIZE characters and return the number
@@ -118,6 +142,14 @@  extern char *strptime_l (const char *__restrict __s,
    in Universal Coordinated Time (aka Greenwich Mean Time).  */
 extern struct tm *gmtime (const time_t *__timer) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer), __gmtime64);
+# else
+# define gmtime __gmtime64
+# endif
+#endif
+
 /* Return the `struct tm' representation
    of *TIMER in the local timezone.  */
 extern struct tm *localtime (const time_t *__timer) __THROW;
@@ -128,6 +160,16 @@  extern struct tm *localtime (const time_t *__timer) __THROW;
 extern struct tm *gmtime_r (const time_t *__restrict __timer,
 			    struct tm *__restrict __tp) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t *__restrict __timer,
+                                            struct tm *__restrict __tp),
+                                 __gmtime64_r);
+# else
+# define gmtime_r __gmtime64_r
+# endif
+#endif
+
 /* Return the `struct tm' representation of *TIMER in local time,
    using *TP to store the result.  */
 extern struct tm *localtime_r (const time_t *__restrict __timer,
@@ -141,6 +183,14 @@  extern char *asctime (const struct tm *__tp) __THROW;
 /* Equivalent to `asctime (localtime (timer))'.  */
 extern char *ctime (const time_t *__timer) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern char *__REDIRECT_NTH (ctime, (const time_t *__timer), __ctime64);
+# else
+# define ctime __ctime64
+# endif
+#endif
+
 #if defined __USE_POSIX || __GLIBC_USE (ISOC2X)
 /* Reentrant versions of the above functions.  */
 
@@ -152,6 +202,16 @@  extern char *asctime_r (const struct tm *__restrict __tp,
 /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'.  */
 extern char *ctime_r (const time_t *__restrict __timer,
 		      char *__restrict __buf) __THROW;
+
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict __timer,
+                                       char *__restrict __buf), __ctime64_r);
+# else
+# define ctime_r __ctime64_r
+# endif
+#endif
+
 #endif	/* POSIX || C2X */
 
 
@@ -189,6 +249,14 @@  extern long int timezone;
 /* Like `mktime', but for TP represents Universal Time, not local time.  */
 extern time_t timegm (struct tm *__tp) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);
+# else
+# define timegm __timegm64
+# endif
+#endif
+
 /* Another name for `mktime'.  */
 extern time_t timelocal (struct tm *__tp) __THROW;
 
@@ -205,17 +273,54 @@  extern int dysize (int __year) __THROW  __attribute__ ((__const__));
 extern int nanosleep (const struct timespec *__requested_time,
 		      struct timespec *__remaining);
 
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT)
+extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time,
+                                   struct timespec *__remaining),
+                       __nanosleep64);
+#  else
+#   define nanosleep __nanosleep64
+#  endif
+# endif
 
 /* Get resolution of clock CLOCK_ID.  */
 extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id,
+                                          struct timespec *__res),
+                           __clock_getres64);
+# else
+# define clock_getres __clock_getres64
+# endif
+#endif
+
 /* Get current value of clock CLOCK_ID and store it in TP.  */
 extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct
+                                           timespec *__tp), __clock_gettime64);
+# else
+# define clock_gettime __clock_gettime64
+# endif
+#endif
+
 /* Set clock CLOCK_ID to value TP.  */
 extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
      __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct
+                                           timespec *__tp), __clock_settime64);
+# else
+# define clock_settime __clock_settime64
+# endif
+#endif
+
 # ifdef __USE_XOPEN2K
 /* High-resolution sleep with the specified clock.
 
@@ -225,6 +330,17 @@  extern int clock_nanosleep (clockid_t __clock_id, int __flags,
 			    const struct timespec *__req,
 			    struct timespec *__rem);
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int __flags,
+                                         const struct timespec *__req,
+                                         struct timespec *__rem),
+                       __clock_nanosleep_time64);
+# else
+# define clock_nanosleep __clock_nanosleep_time64
+# endif
+#endif
+
 /* Return clock ID for CPU-time clock.  */
 extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
 # endif
@@ -243,10 +359,31 @@  extern int timer_settime (timer_t __timerid, int __flags,
 			  const struct itimerspec *__restrict __value,
 			  struct itimerspec *__restrict __ovalue) __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int __flags,
+     const struct itimerspec *__restrict __value,
+     struct itimerspec *__restrict __ovalue),
+                          __timer_settime64);
+# else
+# define timer_settime __timer_settime64
+# endif
+#endif
+
 /* Get current value of timer TIMERID and store it in VALUE.  */
 extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
      __THROW;
 
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid,
+                                           struct itimerspec *__value),
+                           __timer_gettime64) __nonnull ((1));
+# else
+# define timer_gettime __timer_gettime64
+# endif
+#endif
+
 /* Get expiration overrun for timer TIMERID.  */
 extern int timer_getoverrun (timer_t __timerid) __THROW;
 #endif
@@ -256,6 +393,15 @@  extern int timer_getoverrun (timer_t __timerid) __THROW;
 /* Set TS to calendar time based in time base BASE.  */
 extern int timespec_get (struct timespec *__ts, int __base)
      __THROW __nonnull ((1));
+
+# ifdef __USE_TIME_BITS64
+#  if defined(__REDIRECT_NTH)
+extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base),
+                           __timespec_get64);
+#  else
+#  define timespec_get __timespec_get64
+#  endif
+# endif
 #endif