Bug 14304 - Provide some parts of librt in libc as well
Summary: Provide some parts of librt in libc as well
Status: RESOLVED DUPLICATE of bug 14743
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: 2.13
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2012-06-27 14:59 UTC by Adam Jackson
Modified: 2014-06-18 04:31 UTC (History)
1 user (show)

See Also:
Last reconfirmed:
fweimer: security-


Note You need to log in before you can comment on or make changes to this bug.
Description Adam Jackson 2012-06-27 14:59:55 UTC
librt links against libpthread, mostly because aio_* are implemented in threads instead of in the kernel AFAICT.  This is unfortunate, because many libraries would like to use (for example) clock_gettime, but doing so pulls in pthreads.  Now you have no choice but to hit the more expensive thread-safe paths, because your library can't know whether multiple threads actually exist, only whether the pthread symbols are non-zero.

The complementary problem also exists for applications that are unthreaded: if they link against librt, pthread symbols will be non-zero, and any thread-safe library beneath that app now has to behave thread-safely.

This is especially comic when reading the clock_gettime implementation, which goes out of its way to work correctly regardless of whether __pthread_clock_gettime is available.

Ideally it would be possible to provide most of these symbols from libc directly (presumably versioned so the app requires a sufficiently new libc).
Comment 1 Andreas Schwab 2013-01-15 14:34:56 UTC
The clock_* function have been moved to libc.

*** This bug has been marked as a duplicate of bug 14743 ***