[PATCH] Y2038: add function __clock_gettime64

Joseph Myers joseph@codesourcery.com
Wed Sep 19 13:13:00 GMT 2018


On Wed, 19 Sep 2018, Albert ARIBAUD (3ADEV) wrote:

> +	      set_errno(EOVERFLOW);

Note GNU style has a space before the open parenthesis.

> +# define DO_CLOCK_GETTIME_64 \
> +    if (__y2038_linux_support > 0)					\
> +      {									\
> +	retval = INLINE_SYSCALL (clock_gettime64, 2, clock_id, tp);	\
> +	if (retval == -1 && errno == ENOSYS)				\
> +	  {								\
> +	    __y2038_linux_support = -1;					\
> +	    DO_CLOCK_GETTIME_32;					\
> +	  }								\
> +      }									\
> +    else								\
> +      {									\
> +        DO_CLOCK_GETTIME_32;						\
> +      }

Such macros need to be designed in such a way that the runtime ENOSYS 
check, and the assignment to __y2038_linux_support, are optimized away at 
compile time given the __ASSUME_* macro for the 64-bit time syscalls.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list