Closed
Description
Besides
O_CLOEXEC
, which other things would we be able to clean up?
Good question! There are 6 workarounds in libstd
for older Linux versions (that I could find).
Increasing the minimum version to 2.6.32 (aka 3rd Kernel LTS, aka RHEL 6) would fix 5 of them.
Code links are inline:
-
File::open_c
uses theO_CLOEXEC
flag withopen(2)
(mentioned above, added in 2.6.23) -
FileDesc::duplicate
usesF_DUPFD_CLOEXEC
withfcntl(2)
(added in 2.6.24, there is also the mention of a bug occuring on "some linux kernel at some point") -
pipe::anon_pipe
usespipe2(2)
to atomically set theO_CLOEXEC
flag on the pipe fds (added in 2.6.27) -
Socket::new_raw
usesSOCK_CLOEXEC
withsocket(2)
(added in 2.6.27) -
Socket::accept
usesaccept4(2)
to permit use ofSOCK_CLOEXEC
(added in 2.6.28) fs::copy
usescopy_file_range(2)
(added in 4.5, not fixed by this proposal)
As you can see, the workarounds fixed by this proposal all have a similar flavor.
Originally posted by @josephlr in #62516 (comment)