mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
607449506f
The function closes all open file descriptors greater than or equal to input argument. Negative values are clamped to 0, i.e, it will close all file descriptors. As indicated by the bug report, this is a common symbol provided by different systems (Solaris, OpenBSD, NetBSD, FreeBSD) and, although its has inherent issues with not taking in consideration internal libc file descriptors (such as syslog), this is also a common feature used in multiple projects [1][2][3][4][5]. The Linux fallback implementation iterates over /proc and close all file descriptors sequentially. Although it was raised the questioning whether getdents on /proc/self/fd might return disjointed entries when file descriptor are closed; it does not seems the case on my testing on multiple kernel (v4.18, v5.4, v5.9) and the same strategy is used on different projects [1][2][3][5]. Also, the interface is set a fail-safe meaning that a failure in the fallback results in a process abort. Checked on x86_64-linux-gnu and i686-linux-gnu on kernel 5.11 and 4.15. [1] |
||
---|---|---|
.. | ||
64 | ||
x32 | ||
____longjmp_chk.S | ||
__start_context.S | ||
clone.S | ||
configure | ||
configure.ac | ||
dl-cache.h | ||
dl-procinfo.c | ||
dl-procinfo.h | ||
getcontext.S | ||
Implies | ||
kernel-features.h | ||
ldconfig.h | ||
ldd-rewrite.sed | ||
libc_sigaction.c | ||
libmvec.abilist | ||
makecontext.c | ||
Makefile | ||
register-dump.h | ||
setcontext.S | ||
sigaltstack-offsets.sym | ||
sigcontextinfo.h | ||
swapcontext.S | ||
syscall.S | ||
syscalls.list | ||
sysdep.h | ||
sysdep.S | ||
tst-glibc-hwcaps-2.c | ||
ucontext_i.sym | ||
Versions | ||
vfork.S | ||
x86-64-isa-level-VALUE.c |