Whenever getaddrinfo needed network interface information it used the
netlink interface to read the information every single time. The
problem is that this information can change at any time.
The patch implements monitoring of the network interfaces through
nscd. If no change is detected the previously read information can
be reused (which is the norm). This timestamp information is also
made available to other processes using the shared memory segment
between nscd and those processes.
fopen should set the FD_CLOEXEC flag if requested evenif the kernel does
not support an aotmic operation.
freopen should reuse the file descriptor for the stream. This is
especially important for calls to change the standard streams (stin,
stdout, stderr).
The getcwd syscall (so far?) can only handle path up to one page
in size. There is no limit about directory hierarchy depth, though,
and the POSIX getcwd is supposed to handle this. In that case fall
back to the generic getcwd.
Additionally, optimize the generic getcwd to use openat when possible
to change the asymptotic performance from O(N^2) to O(n).
Like the real header, the libc-internal wrapper for wchar.h needs to
undefine the macros so that if the header was already included before
the macros don't stay defined and cause problems later.
The old implementation uses fd 0 to determine the login TTY. This
was needed because using /dev/tty it is not possible to deduce the
login TTY. For some time now there is the pseudo-file
/proc/self/loginuid which directly helps us to find the user. Prefer
using this file. It also works if stdin is closed, redirected, or
re-opened.
On some architectures the update of the l_used field in the lookup
functions races with setting the other bits in the bitfield. Simply
avoid this and optimize use of l_used in general.