glibc/sysdeps/unix/sysv/linux/i386
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
..
i686 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i786 Move remaining nptl/sysdeps/unix/sysv/linux/i386/ files. 2014-05-14 13:37:40 -07:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
arch-syscall.h Update syscall lists for Linux 5.13 2021-07-01 17:37:36 +00:00
brk.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
c++-types.data x86: Move abilist files out of nptl/ subdirectories. 2014-05-14 15:45:23 -07:00
clone.S i386/clone.S: Remove redundant EBX load 2021-02-22 04:29:19 -08:00
configure Require Linux kernel 3.2 or later on x86 / x86_64. 2017-05-08 10:45:20 +00:00
configure.ac Require Linux kernel 3.2 or later on x86 / x86_64. 2017-05-08 10:45:20 +00:00
dl-librecon.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
getcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Implies NPTL is no longer an add-on! 2014-07-07 09:29:06 -07:00
jmp_buf-macros.h Add jmp_buf-macros.h 2017-11-09 05:10:03 -08:00
kernel_stat.h linux: Set default kernel_stat.h to LFS 2021-02-11 07:58:05 -03:00
kernel-features.h linux: Consolidate Linux setsockopt implementation 2021-07-06 11:45:35 -03:00
ld.abilist <sys/platform/x86.h>: Remove the C preprocessor magic 2021-01-21 05:58:17 -08:00
ldconfig.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libanl.abilist resolv: Move libanl into libc (if libpthread is in libc) 2021-07-02 11:45:00 +02:00
libBrokenLocale.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libc_sigaction.c signal: Add __libc_sigaction 2021-03-18 15:54:39 -03:00
libc-do-syscall.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libc.abilist io: Add closefrom [BZ #10353] 2021-07-08 14:08:14 -03:00
libcrypt.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libdl.abilist dlfcn: Move dlopen into libc 2021-06-03 08:26:04 +02:00
libm.abilist Move __isnanf128 to libc.so 2021-03-30 14:58:19 +05:30
libnsl.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libpthread.abilist nptl: Remove remaining code from libpthread 2021-05-21 22:35:01 +02:00
libresolv.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
librt.abilist Linux: Move timer_settime, __timer_settime64 from librt to libc 2021-06-28 09:51:01 +02:00
libthread_db.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libutil.abilist login: Move libutil into libc 2021-06-30 08:43:37 +02:00
localplt.data ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
makecontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile Linux: Remove remaining references to $(shared-thread-library) 2021-05-25 11:30:23 +02:00
register-dump.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
setcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shlib-versions Clean up gnu/lib-names.h generation (bug 14171). 2014-09-26 17:33:04 +00:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
startup.h Use <startup.h> in __libc_init_secure 2021-01-19 09:55:47 -08:00
struct_kernel_msqid64_ds.h sysv: linux: Add 64-bit time_t variant for msgctl 2020-07-09 12:05:40 -03:00
struct_kernel_semid64_ds.h sysv: linux: Add 64-bit time_t variant for semctl 2020-07-09 12:05:35 -03:00
struct_kernel_shmid64_ds.h sysv: linux: Add 64-bit time_t variant for shmctl 2020-07-09 12:05:47 -03:00
swapcontext.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
syscall.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
syscalls.list posix: Consolidate Linux waitpid syscall 2017-05-18 18:06:47 -03:00
sysdep.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time64-compat.h y2038: Add support for 64-bit time on legacy ABIs 2021-06-15 10:42:11 -03:00
tst-bz21269.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ucontext_i.sym i386: Enable CET support in ucontext functions 2020-02-14 15:15:25 -08:00
Versions Add missing symbols to Version files 2021-06-02 07:32:19 +02:00
vfork.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00