This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
pthread_cond_clockwait glibc forwarder (was Re: [RFCv4] Add pthread_cond_timedwaitonclock_np)
- From: Mike Crowe <mac at mcrowe dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org, Carlos O'Donell <carlos at redhat dot com>
- Date: Tue, 16 Jul 2019 11:05:16 +0100
- Subject: pthread_cond_clockwait glibc forwarder (was Re: [RFCv4] Add pthread_cond_timedwaitonclock_np)
- References: <20170622170531.1668-1-mac@mcrowe.com> <9ea58c10-ddc7-533e-f477-03e634cb9788@linaro.org> <20170930160124.6il2yexqtv4fojoo@mcrowe.com> <77064c8d-2aa8-4345-0d6d-3a873a5e684f@linaro.org>
[pthread_cond_clockwait was previously known as
pthread_cond_timedwaitonclock_np.]
On Monday 02 October 2017 at 19:26:35 -0300, Adhemerval Zanella wrote:
> >>> diff --git a/nptl/Versions b/nptl/Versions
> >>> index 0ae5def464..1cf8c2fbad 100644
> >>> --- a/nptl/Versions
> >>> +++ b/nptl/Versions
> >>> @@ -28,6 +28,9 @@ libc {
> >>> pthread_cond_wait; pthread_cond_signal;
> >>> pthread_cond_broadcast; pthread_cond_timedwait;
> >>> }
> >>> + GLIBC_2.26 {
> >>> + pthread_cond_timedwaitonclock_np;
> >>> + }
> >>
> >> The libc addition seems wrong, whhy this is required?
> >
> > pthread_cond_timedwait is in libc, so I followed suit and added
> > pthread_cond_timedwaitonclock_np too. I must admit that I can't quite see
> > how the dummy empty implementations of the pthread functions end up in
> > libc, but they apparently do according to:
> >
> > https://stackoverflow.com/questions/11161462/why-glibc-and-pthread-library-both-defined-same-apis
> >
> > Maybe this means that I've missed something.
>
> This is an GLIB implementation detail, where some libraries which
> are expected to be usable without explicit linking to libpthread use
> some pthread functions (for instance aio from librt).
>
> In the single thread case libc.so uses wrappers that may or not call the
> libpthread.so implementation (nptl/forward.c) if libpthread.so.0 is
> loaded (by dlopen for instance).
>
> So since there is no current use of pthread_cond_timedwaitonclock_np,
> there is no requirement to add it on libc.so.
I was digging through some old review comments, and came across this. It
looks like I didn't address it. :( afe4de7d283ebd88157126c5494ce1796194c16e
added forwarders for __pthread_cond_clockwait and pthread_clock_clockwait
to glibc:
$ nm /lib64/libc.so.6 |grep _clockwait
000000000007f410 t __pthread_cond_clockwait
000000000007f410 t pthread_cond_clockwait
Should we remove them now, before they are included in a release and it's
too late? (I tried removing them from forward.c, pthread-functions.h and
nptl-init.c and all tests passed on x86_64.)
Alternatively, if they should stay, do they need adding to the libc part of
nptl/Versions?
Thanks, and sorry for not discovering this earlier.
Mike.