glibc/sysdeps/unix/sysv/linux/mips/mips64
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
..
n32 io: Add closefrom [BZ #10353] 2021-07-08 14:08:14 -03:00
n64 io: Add closefrom [BZ #10353] 2021-07-08 14:08:14 -03:00
configure
configure.ac
fxstat64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fxstatat64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fxstatat.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
getdents64.c linux: mips: Fix getdents64 fallback on mips64-n32 2021-01-22 15:44:41 -03:00
ipc_priv.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
kstat_cp.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ldconfig.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ldd-rewrite.sed
libBrokenLocale.abilist
libcrypt.abilist
libdl.abilist dlfcn: Move dlopen into libc 2021-06-03 08:26:04 +02:00
libm.abilist
libnsl.abilist
libpthread.abilist nptl: Remove remaining code from libpthread 2021-05-21 22:35:01 +02:00
libthread_db.abilist
libutil.abilist login: Move libutil into libc 2021-06-30 08:43:37 +02:00
lxstat64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile
msgctl.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
semctl.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shmctl.c 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
sysdep.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
xstat64.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00