Open FuuuOverclocking opened 1 month ago
Rust-created files and sockets have O_CLOEXEC set, e.g. https://github.com/rust-lang/rust/blob/4d215e2426d52ca8d1af166d5f6b5e172afbff67/library/std/src/sys/pal/unix/fs.rs#L1177 https://github.com/rust-lang/rust/blob/4d215e2426d52ca8d1af166d5f6b5e172afbff67/library/std/src/sys/pal/unix/net.rs#L85
While it may not be possible to set this on non-Linux systems as part of the recvmsg call, this crate should either set it immediately on reception of the file descriptors, or else document that the returned file descriptors do not have this flag set.
I'm happy to take a PR that implements it in a portable way (even if the implementation ends up slightly racy.)
MSG_CMSG_CLOEXEC
is supported on Linux, FreeBSD and various other BSDs but notably not on Darwin. So a fallback will be necessary.
Consider using
MSG_CMSG_CLOEXEC
flag,close-on-exec
should be default behavior.Links: