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.
grantpt was performing two consecutive calls to stat with the same
file name. Avoid this by creating a special version of the ptsname
function which allows to pass the stat result back to the caller.
We use a callback function into libc.so to get access to the data
structure with the information and have special versions of the test
macros which automatically use this function.
The following patch fixes catomic_compare_and_exchange_*_rel definitions
(which were never used and weren't correct) and uses
catomic_compare_and_exchange_val_rel in _int_free. Comparing to the
pre-2009-07-02 --enable-experimental-malloc state the generated code should
be identical on all arches other than ppc/ppc64 and on ppc/ppc64 should use
lwsync instead of isync barrier.
The terminal output etc is not visible in a core file. The new
libc-internal variable __abort_msg will point to a string with the
message which has been printed before the abort in case abort is
called from inside libc. BZ #10217
If longjmp restores the stack frame to an address which is beyond
the stack frame at the time of the longjmp call it would install
an uninitialized stack frame. If compiled with _FORTIFY_SOURCE
defined, longjmp will now bail out in this situation.
* sysdeps/unix/sysv/linux/bits/stat.h: Protect UTIME_NOW and
UTIME_OMIT only with __USE_ATFILE.
* sysdeps/unix/sysv/linux/ia64/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
* io/sys/stat.h: Move mknodat definition into same conditional as
mknod.
* time/sys/time.h: futimesat is not among the functions accepted
into the POSIX standard.
by default a POSIX mode, also define __USE_POSIX_IMPLICITLY.
* posix/Versions: Export __posix_getopt.
* posix/getopt.c (_getopt_initialize): Take additional parameter.
Use it to alternatively initialize __posixly_correct.
(_getopt_internal_r): Take addition parameter. Pass on to
_getopt_initialize.
(_getopt_internal): Take addition parameter. Pass on to
_getopt_internal_r.
(getopt): Pass additional zero to _getopt_internal.
(__posix_getopt): New function.
* posix/getopt.h: Add redirection for getopt.
* posix/getopt1.c (getopt_long): Pass additional zero to
_getopt_internal.
(getopt_long_only): Likewise.
(_getopt_long_r): Pass additional zero to _getopt_internal_r.
(_getopt_long_only_r): Likewise.
* posix/getopt_int.h: Adjust declarations of _getopt_internal and
_getopt_internal_r.