[PATCH] [RFC] y2038: nptl: Convert pthread_cond_{clock|timed}wait to support 64 bit time

Lukasz Majewski lukma@denx.de
Mon Aug 24 16:59:58 GMT 2020


Dear Community,

> The pthread_cond_clockwait and pthread_cond_timedwait have been
> converted to support 64 bit time.
> 
> This change introduces new futex_abstimed_wait_cancelable64 function
> in ./sysdeps/nptl/futex-helpers.c, which uses futex_time64 where
> possible and tries to replace low-level preprocessor macros from
> lowlevellock-futex.h
> The pthread_cond_{clock|timed}wait only accepts absolute time.
> Moreover, there is no need to check for NULL passed as *abstime
> pointer as __pthread_cond_wait_common() always passes non-NULL struct
> __timespec64 pointer to futex_abstimed_wait_cancellable64().
> 
> For systems with __TIMESIZE != 64 && __WORDSIZE == 32:
> - Conversions between 64 bit time to 32 bit are necessary
> - Redirection to __pthread_cond_{clock|timed}wait64 will provide
> support for 64 bit time
> 
> The futex_abstimed_wait_cancelable64 function has been put into a
> separate file on the purpose - to avoid issues apparent on m68k
> architecture related to small number of available registers (there is
> not enough registers to put all necessary arguments in them when
> inlining). In fact - the futex_helper.c is reused, but extra flag
> "-fno-inline" is set when it is build for this architecture. Such
> approach fixes the build issue.

Unfortunately, having the futex-helpers.c as a separate file caused
issue with linknamespace tests:

/tmp/tmpiql0gye3/undef.c:33:1: warning: ‘pthread_attr_getstackaddr’ is
deprecated [-Wdeprecated-declarations] 33 | void
*__glibc_test_pthread_attr_getstackaddr = (void *)
&pthread_attr_getstackaddr; | ^~~~ In file included from
../include/pthread.h:1, from /tmp/tmpiql0gye3/undef.c:1:
../sysdeps/nptl/pthread.h:332:12: note: declared here
  332 | extern int pthread_attr_getstackaddr (const pthread_attr_t
*__restrict |            ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpiql0gye3/undef.c:42:1: warning: ‘pthread_attr_setstackaddr’ is
deprecated [-Wdeprecated-declarations] 42 | void
*__glibc_test_pthread_attr_setstackaddr = (void *)
&pthread_attr_setstackaddr; | ^~~~ In file included from
../include/pthread.h:1, from /tmp/tmpiql0gye3/undef.c:1:
../sysdeps/nptl/pthread.h:340:12: note: declared here
  340 | extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~


I'm a bit puzzled here. It is a warning in fact despite I've guarded
the function in question with:
libpthread_hidden_{proto|def} (futex_abstimed_wait_cancelable64)

Even more strange is that the check passes when the same function is
added to futex-internals.h with "static __always_inline" attribute.
(But then the problem with small number of regs for m68k is apparent).

As fair as I understood - the linknamespace check is to build sample
program with proper header (like pthread.h) and check if symbols from
linked library (in our case libpthread.*) are exported properly.

In the above case the "test" complains about using obsolete functions
(i.e. - pthread_attr_setstackaddr).

Is this part of the check itself? Or is it a side effect?

Any help appreciated.


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200824/784286f0/attachment.sig>


More information about the Libc-alpha mailing list