[PATCH v6 0/5] Add close_range, closefrom, and posix_spawn_file_actions_closefrom_np

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jun 23 18:51:10 GMT 2021


Linux v5.9 added a new close_range syscall, which allows the caller to
issue the kernel to close or set close-on-exec on a range of file
descriptors.

This patchset export the syscall along with two GNU extensions:
closefrom, with similar semantics from other systems ((Solaris, OpenBSD,
NetBSD, FreeBSD); and posix_spawn_file_actions_closefrom_np, which
allows use close_range semantic on posix_spawn().

The first two patches are libsupport support for the tests.  The third
patch adds the Linux specific close_range syscall.  The forth path adds
the GNU extension closefrom, which use close_range if available.  The
final part adds the posix_spawn extension.

Adhemerval Zanella (5):
  support: Add support_stack_alloc
  support: Add xclone
  linux: Add close_range
  io: Add closefrom [BZ #10353]
  posix: Add posix_spawn_file_actions_closefrom_np

 NEWS                                          |  12 +
 include/bits/unistd_ext.h                     |   6 +
 include/unistd.h                              |   1 +
 io/Makefile                                   |   4 +-
 io/Versions                                   |   3 +
 io/closefrom.c                                |  34 ++
 io/tst-closefrom.c                            | 152 +++++++++
 manual/llio.texi                              |  55 ++++
 posix/Makefile                                |   4 +-
 posix/Versions                                |   1 +
 posix/spawn.h                                 |   8 +
 posix/spawn_faction_addclosefrom.c            |  57 ++++
 posix/spawn_faction_destroy.c                 |   1 +
 posix/spawn_int.h                             |   6 +
 posix/tst-spawn5.c                            | 284 ++++++++++++++++
 posix/unistd.h                                |   6 +
 support/Makefile                              |   2 +
 support/support.h                             |  19 ++
 support/support_stack_alloc.c                 |  76 +++++
 support/xclone.c                              |  50 +++
 support/xsched.h                              |  34 ++
 support/xsigstack.c                           |  43 +--
 sysdeps/generic/spawn_int_def.h               |  24 ++
 sysdeps/mach/hurd/i386/libc.abilist           |   2 +
 sysdeps/mach/hurd/spawni.c                    |   4 +
 sysdeps/posix/spawni.c                        |   4 +
 sysdeps/unix/sysv/linux/Makefile              |   6 +-
 sysdeps/unix/sysv/linux/Versions              |   1 +
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |   3 +
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |   3 +
 sysdeps/unix/sysv/linux/arc/libc.abilist      |   3 +
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |   3 +
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |   3 +
 sysdeps/unix/sysv/linux/bits/unistd_ext.h     |  22 ++
 sysdeps/unix/sysv/linux/closefrom.c           |  36 +++
 sysdeps/unix/sysv/linux/closefrom_fallback.c  |  99 ++++++
 sysdeps/unix/sysv/linux/csky/libc.abilist     |   3 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |   3 +
 sysdeps/unix/sysv/linux/i386/libc.abilist     |   3 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |   3 +
 .../sysv/linux/m68k/coldfire/libc.abilist     |   3 +
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |   3 +
 .../sysv/linux/microblaze/be/libc.abilist     |   3 +
 .../sysv/linux/microblaze/le/libc.abilist     |   3 +
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |   3 +
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |   3 +
 .../sysv/linux/mips/mips64/n32/libc.abilist   |   3 +
 .../sysv/linux/mips/mips64/n64/libc.abilist   |   3 +
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |   3 +
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |   3 +
 .../powerpc/powerpc32/nofpu/libc.abilist      |   3 +
 .../linux/powerpc/powerpc64/be/libc.abilist   |   3 +
 .../linux/powerpc/powerpc64/le/libc.abilist   |   3 +
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |   3 +
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |   3 +
 .../unix/sysv/linux/s390/s390-32/libc.abilist |   3 +
 .../unix/sysv/linux/s390/s390-64/libc.abilist |   3 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |   3 +
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |   3 +
 .../sysv/linux/sparc/sparc32/libc.abilist     |   3 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |   3 +
 sysdeps/unix/sysv/linux/spawn_int_def.h       |  25 ++
 sysdeps/unix/sysv/linux/spawni.c              |  34 +-
 sysdeps/unix/sysv/linux/syscalls.list         |   1 +
 sysdeps/unix/sysv/linux/tst-close_range.c     | 303 ++++++++++++++++++
 .../unix/sysv/linux/x86_64/64/libc.abilist    |   3 +
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |   3 +
 67 files changed, 1458 insertions(+), 57 deletions(-)
 create mode 100644 include/bits/unistd_ext.h
 create mode 100644 io/closefrom.c
 create mode 100644 io/tst-closefrom.c
 create mode 100644 posix/spawn_faction_addclosefrom.c
 create mode 100644 posix/tst-spawn5.c
 create mode 100644 support/support_stack_alloc.c
 create mode 100644 support/xclone.c
 create mode 100644 support/xsched.h
 create mode 100644 sysdeps/generic/spawn_int_def.h
 create mode 100644 sysdeps/unix/sysv/linux/closefrom.c
 create mode 100644 sysdeps/unix/sysv/linux/closefrom_fallback.c
 create mode 100644 sysdeps/unix/sysv/linux/spawn_int_def.h
 create mode 100644 sysdeps/unix/sysv/linux/tst-close_range.c

-- 
2.30.2



More information about the Libc-alpha mailing list