glibc/sysdeps/unix/sysv/linux/arm
Adhemerval Zanella 607449506f io: Add closefrom [BZ #10353]
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] 5238e95759/src/basic/fd-util.c (L217)
[2] ddf4b77e11/src/lxc/start.c (L236)
[3] 9e4f2f3a6b/Modules/_posixsubprocess.c (L220)
[4] 5f47c0613e/src/libstd/sys/unix/process2.rs (L303-L308)
[5] https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjava/childproc.c#L82
2021-07-08 14:08:14 -03:00
..
be io: Add closefrom [BZ #10353] 2021-07-08 14:08:14 -03:00
bits
le io: Add closefrom [BZ #10353] 2021-07-08 14:08:14 -03:00
sys
____longjmp_chk.S arm: Fix an incorrect check in ____longjmp_chk [BZ #27709] 2021-04-12 14:28:07 +01:00
aeabi_read_tp.S
arch-syscall.h Update syscall lists for Linux 5.13 2021-07-01 17:37:36 +00:00
arm-features.h
atomic-machine.h
c++-types.data
clone.S arm: align stack in clone [BZ 28020] 2021-06-28 11:35:44 +01:00
dl-cache.h
dl-machine.h
dl-procinfo.c
dl-procinfo.h
fixup-asm-unistd.h
getcontext.S
Implies
ioperm.c
jmp_buf-macros.h
kernel_stat.h linux: Set default kernel_stat.h to LFS 2021-02-11 07:58:05 -03:00
kernel-features.h
ldconfig.h
ldsodefs.h
libc_sigaction.c signal: Add __libc_sigaction 2021-03-18 15:54:39 -03:00
libc-do-syscall.S
localplt.data nptl: Remove pthread raise implementation 2021-03-26 13:37:18 -03:00
makecontext.c
Makefile nptl: Remove remaining code from libpthread 2021-05-21 22:35:01 +02:00
profil-counter.h
readelflib.c
register-dump.h
setcontext.S
shlib-versions
sigcontextinfo.h
sigrestorer.S
swapcontext.S
syscall.S
syscalls.list linux: Consolidate Linux setsockopt implementation 2021-07-06 11:45:35 -03:00
sysdep.h
sysdep.S
time64-compat.h y2038: Add support for 64-bit time on legacy ABIs 2021-06-15 10:42:11 -03:00
tls.h
ucontext_i.sym
Versions
vfork.S