[RFC 00/12] [RFC] y2038: Convert timespec_{sub|add|create} in support to be Y2038 safe

Joseph Myers joseph@codesourcery.com
Tue Jun 2 18:05:09 GMT 2020

On Mon, 1 Jun 2020, Lukasz Majewski wrote:

> First timespec* functions are renamed to have common "__" prefix for internal
> functions. This is a preparatory work for further conversion.

Leading "__" is *only* needed when the name is used in contexts where it 
could conflict with a user identifier.  For example, in installed headers 
or with external linkage.

In particular, static inline functions in non-installed headers never need 
a leading "__".  So there is no justification for renaming 
timespec_compare unless you plan to make it an extern, non-inline 
function, in which case you should say so explicitly in that patch's 
commit message.

xclock_gettime is inherently unsuitable for use in installed libraries, 
because it exits (FAIL_EXIT1) on error, which is not suitable for library 
code.  So there is no need to rename that function; any installed library 
code that uses it has to be fixed not to use it and instead to do 
appropriate error checks on the result of clock_gettime (returning an 
error from the caller if appropriate) itself; library code should almost 
never exit the process on error.  Likewise xclock_now, because it calls 
xclock_gettime, must not be used in installed libraries.

These function naming changes are only appropriate for external linkage 
functions whose semantics are appropriate for use in installed libraries 
and that are actually used in such libraries or that you intend to be used 
in such libraries.  Please review all those changes to make sure that you 
don't rename functions for which such library use is not appropriate or 
not planned.

Joseph S. Myers

More information about the Libc-alpha mailing list