(fd: BorrowedFd<'_>, inheritable: bool)
| 5 | pub(crate) use module::module_def; |
| 6 | |
| 7 | pub fn set_inheritable(fd: BorrowedFd<'_>, inheritable: bool) -> nix::Result<()> { |
| 8 | use nix::fcntl; |
| 9 | let flags = fcntl::FdFlag::from_bits_truncate(fcntl::fcntl(fd, fcntl::FcntlArg::F_GETFD)?); |
| 10 | let mut new_flags = flags; |
| 11 | new_flags.set(fcntl::FdFlag::FD_CLOEXEC, !inheritable); |
| 12 | if flags != new_flags { |
| 13 | fcntl::fcntl(fd, fcntl::FcntlArg::F_SETFD(new_flags))?; |
| 14 | } |
| 15 | Ok(()) |
| 16 | } |
| 17 | |
| 18 | #[pymodule(name = "posix", with( |
| 19 | super::os::_os, |
no test coverage detected