LSB 4.0 and Glibc 2.4

glibc 2.4 was released a while ago, and it (or a higher version) is in
use in most current distributions. Support began to appear as early as
Fedora Core 5 and OpenSUSE 10.1.

LSB version 3 is essentially based on glibc 2.3.4. This is a report on
the difference between glibc 2.4 and LSB 3.1 in the POSIX area (mostly
excluding other areas in which glibc extends). It includes new features
in 2.4, existing symbols with new versions, and features omitted from
LSB which may not be new to 2.4 specifically that might be considered
for inclusion in a future LSB version.

Support for glibc 2.4 is important for several reasons; LSB needs to remain as
close to what shipping distributions are providing without unreasonably
cutting off slightly older distributions. The point seems to have arrived
when there's no point in holding back glibc 2.4 and LSB 4.0 should have it.

This page is a work in progress and as issues are discovered they will be added here.

New / Changed Interfaces in Glibc 2.4

This is relative to the glibc 2.3 series based on library symbol versions,
and does not discuss interfaces that may have been added late in the 2.3
series but not included in the LSB (some of those are dealt with in the
Excluded Interfaces section below).

*at Functions

The largest set of new functions is the set of 14 *at interfaces, which
allows opening files "at" a relative location. These system calls are not
currently in POSIX but are proposed for inclusion in the next revision
of POSIX.1 (they make up Extended API Set Part 2). Similar system calls
exist on Solaris, where they have an additional sense: they also open
the extended attributes on a file, not the case on Linux.

which take a file descriptor/filename pair instead of a single file
name. These functions, openat etc, have been discussed on numerous
occasions. They are needed to implement race-free filesystem traversal,
they are necessary to implement a virtual per-thread current working

These interfaces are moderately recent, having been added in Linux kernel 2.6.16.

There are two other interfaces in the proposed POSIX Extended API Set Part
2 that can thus be grouped with these: fdopendir, which is like opendir
but takes a file descriptor instead of a path name (new to glibc 2.4);
and fexecve, which is like exeve but takes a file descriptor instead of
a path name (has been in glibc since 2.0 but is not in the LSB, even in
the database).

Update: these interfaces are now in the development/4.0 version control

inotify Functions

API for monitoring file system events. Inotify can be used to monitor
individual files, or to monitor directories. When a directory is
monitored, inotify will return events for the directory itself, and for
files inside the directory.

Again, these interfaces have a minimum kernel version - 2.6.13. Usually
LSB tries not to add too many Linux-specific interfaces (which
these are), but this one has already been specifically requested
and seems quite applicable to desktop usage. This is now tracked as
bug 1394.

Update: these interfaces are now in the development/4.0 version control

ppoll, pselect

New versions of poll, select which take a finer-granularity timer
(timespec instead of timeval) and a signal mask; that mask will
be applied while the calling process waits for events, with the
previous mask being restored on return. These are new to the
kernel. Note that pselect is actually a POSIX interface, and not
an optional one, which has been in glibc forever (it has version
GLIBC_2.0), but is not included in LSB. This issue
has been added as bug 1392.
pselect is included in LSB 3.2.
ppoll is a new interface at version 2.4 - see
poll manpage
for details.

unshare

unshare allows a process to disassociate parts of its execution context
that are currently being shared with other processes. Part of the
execution context, such as the namespace, is shared implicitly when
a new process is created using fork or vfork while other parts, such
as virtual memory, may be shared by explicit request when creating a
process using clone.

The main use of unshare is to allow a process to control its shared
execution context without creating a new process.

open_wmemstream

A companion interface to open_memstream but using a wide-character buffer.
opem_memstream is GLIBC_2.0 but is not in the LSB (marked Deferred in
the database). Both of these interfaces are in the proposed "Extended
API Set Part 1" for the next POSIX revision.
Mentioned in bug 2126.
Another interface in the "analagous to existing interfaces" set which
also appears in the new POSIX specification is fexecve.

Update: these interfaces are now in the development/4.0 version control

eaccess

Alias for euidaccess, which is not in the LSB (Deferred in the database). Only the alias is new; euidaccess is GLIBC_2.0.

exp2l Note

# A bug in sysdeps/generic/w_exp2.c kept this from appearing
# in GLIBC_2.1 as it should have on platforms using that
# implementation file. On others, sysdeps/CPU/Versions now
# puts exp2l in GLIBC_2.1, which will override this entry.

Linux is such a platform, so we should not see a need to change.

Architecture-Specfic Changes

On ppc32/ppc64 and s390/s390x, long double support was provided by making
a long double be a double. As of glibc_2.4, proper long double support
is added. This affects libm and libc functions, and for the LSB would
actually add the 'l' suffixed routines into the ABI. This is a very
significant change.

Excluded Interfaces

Async I/O

The POSIX async I/O interfaces (AIO set) in librt are excluded from the
LSB. This is tracked as
bug 1391.
In addition to the set in POSIX, glibc also provides the non-POSIX
aio_cancel64, aio_fsync64, aio_error64, aio_read64, aio_suspend64,
aio_write64 and lio_listio64 as well as aio_init as a logical extension.

These continue to be an issue; the glibc (librt) versions implement
async I/O in userspace while the new kernel aio does not use the POSIX
interfaces.

It also appears that the GLIBC_2.4 version of lio_listio introduces
a change in the implementation, from issuing only a single event when
listio completes to issuing events for individual requests. This would
not be an LSB compatibility issue, of course, since there is no existing
LSB version to compare to.

Stack Check Interfaces

19 stack-safe interfaces (_chk suffix) were added late in the 2.3 series
with 48 additional interfaces added for 2.4. This is now tracked as
bug 2083.

Update: the interfaces used in tracked apps are now in the development/4.0 version control; discussing whether the rest should be added

epoll

The epoll interface set consists of epoll_create, epoll_ctl, epoll_wait
which were added in 2.3.2, and epoll_pwait added in 2.6. These are
not in LSB. Tracked as
bug 2137.

CPU Affinity

sched_getaffinity and sched_setaffinity were added for 2.3.4 (actually,
updated then, added in 2.3.3). These are tracked as
bug 2113.

Update: these interfaces are now in the development/4.0 version control

Message Queues

The POSIX message queue interfaces (MSG set) are excluded from
the LSB. These routines are in librt with with a symbol version
of GLIBC_2.3.4, but depended on a kernel version (2.6.6 or later)
that seemed too new to make these interfaces mandatory for LSB
3.0, so they were omitted at the time.. This is now refiled as
bug 1388 since the
previous librt bug was closed when librt was added to the LSB.
These are now in LSB 3.2.

Pthreads

Portions of the pthread set are not specified by LSB. This omission is
described in bug 893.

The POSIX Barriers (BAR) option is implemented by the pthread_barrier*
and pthread_barrierattr* functions, in libpthread with a version of
GLIBC_2.2, except pthread_barrierattr_getpshared which was omitted from
2.2 but added in GLIBC_2.3.3.
These are now in LSB 3.2.

The POSIX Spinlocks (SPI) option is implemented by the pthread_spin*
functions, in libpthread with a version of GLIBC_2.2.
These are now in LSB 3.2.

The POSIX Thread CPUtime (TCT) option has is only one thread interface
affected, pthread_getcpuclockid, which is in libpthread with a version
of GLIBC_2.2. The other interfaces from TCT (clock_*, timer_create)
are already included in LSB. These interfaces are in libc with version
of GLIBC_2.2. These are now in LSB 3.2.

An additional set of six interfaces grouped as Thread Priority Protection and
Thread Priority Inheritance (TPP and TPI). These are tracked in
bug 2136.
Update: these interfaces are now in the development/4.0 version control

Advanced Realtime Feature Sets

Some of the features sets of POSIX Advanced Realtime are in glibc but
either incomplete or omitted from LSB. Other pieces are not included in
glibc and/or the Linux kernel. They are mentioned here for completeness.

The POSIX Advisory Information (ADV) set is partially
implemented. posix_memalign does appear in LSB 3.x. Three POSIX
interfaces and two additional extension interfaces do not. This is tracked
as bug 1389. These
interfaces all appear in libc with version of GLIBC_2.2.
This is now complete in LSB 3.2.

posix_fadvise, posix_fallocate, posix_madvise

posix_fadvise64, posix_fallocate64 are not in POSIX but appear in glibc as obvious extensions.

The Spawn (SPN) set in implemented by the posix_spawn* and
posix_spawnattr* functions, in libc with version of GLIBC_2.2. This is
tracked as bug 1390.
These are now in LSB 3.2.

The POSIX Tracing (TRC), Trace Event Filter (TEF), Trace Inherit (TRI)
and Trace Log (TRL) sets are not supported in glibc 2.4. Tracing requires
kernel support which does not appear to be forthcoming, at least in a
form that would be useful for these interfaces.

The POSIX Typed Memory (TYP) objects are not supported in glibc 2.4,
again as there is no kernel support.

Omitted Libraries

libnss_compat, libnss_dns, libnss_files, libnss_hesiod, libnss_nis,
libnss_nisplus and libcidn have no exported symbols (or rather, they
are all GLIBC_PRIVATE) and are not intended to be called directly by
applications.

libBrokenLocale, libanl, libnsl, libresolv and libthread_db do have
exported public symbols but are not part of the LSB. libnsl and libresolv
have been asked for. It is the current position of LSB that these are not
needed by application programs. One particular case is that programs which
had their genesis on Solaris often include -lnsl as a matter of course;
however the interfaces actually used are often in libc on Linux. Thus,
while linking with libnsl does not break anything in the non-LSB case,
neither is the library actually used in many cases. The LSB team has
encountered more than one program where the configure script tests for
presence of a function in libnsl without testing if the function works
without libnsl (which it would), thus needlessly including the library
on the link line.