This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 0/7] y2038: Linux: Provide __clock_* functions supporting 64 bit time


This patch set introduces the conversion of __clock_{settime|
gettime|getres|nanosleep} to explicit 64 bit struct __timespec64
arguments. As a result those functions are now Y2038 safe

To achieve the above goal - new, internal to glibc,
struct __timespec64 has been also introduced as well as
helper functions to handle time conversions on 32 bit systems.

The code from this patch set uses new clock_* syscalls (explicit
64 bits) from Linux kernel (5.1+) as well.

In glibc new __ASSUME_64BIT_TIME define has been introduced to
indicate if above syscalls are provided by the kernel.

This work is (loosely) based on a previous development/patches:
https://libc-alpha.sourceware.narkive.com/zniMOWui/rfc-patch-00-52-make-glibc-y2038-proof#post68

Github branch (including the y2038 conversion example):
https://github.com/lmajewski/y2038_glibc/commits/Y2038-2.29-glibc-__clock-internal-struct-timespec-v2

Those patches have been applied on top of master branch:
SHA1: c57afec0a9b318bb691e0f5fa4e9681cf30df7a4

Shall be used with provided meta-y2038 for development and testing:
https://github.com/lmajewski/meta-y2038

I've used guidelines from:
https://www.gnu.org/software/libc/manual/html_mono/libc.html
"D.2.1 64-bit time symbol handling in the GNU C Library"
to convert *clock_settime*.

and most notably from:
https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#clock_gettime.28.29

Feedback and comments are more than welcome.


Lukasz Majewski (7):
  y2038: Introduce internal for glibc struct __timespec64
  y2038: Introduce __ASSUME_64BIT_TIME define
  y2038: Provide conversion helpers for struct __timespec64
  y2038: linux: Provide __clock_settime64 implementation
  y2038: linux: Provide __clock_getres64 implementation
  y2038: linux: Provide __clock_gettime64 implementation
  y2038: linux: Provide __clock_nanosleep64 implementation

 include/time.h                            | 157 ++++++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/clock_getres.c    |  39 +++++++-
 sysdeps/unix/sysv/linux/clock_gettime.c   |  39 +++++++-
 sysdeps/unix/sysv/linux/clock_nanosleep.c |  71 +++++++++++++-
 sysdeps/unix/sysv/linux/clock_settime.c   |  50 +++++++++-
 sysdeps/unix/sysv/linux/kernel-features.h |  14 +++
 6 files changed, 361 insertions(+), 9 deletions(-)

-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]