Function close_range
pub unsafe fn close_range(fd: u32, max_fd: u32, flags: u32) -> Result<(), i32> ⓘ
Available on crate feature
dep_nc
only.Expand description
Close all file descriptors in a given range
Parameters:
fd
: starting file descriptor to closemax_fd
: last file descriptor to closeflags
: reserved for future extensions
§Examples
const STDOUT_FD: u32 = 1;
const STDERR_FD: u32 = 2;
let ret = unsafe { nc::close_range(STDOUT_FD, STDERR_FD, nc::CLOSE_RANGE_CLOEXEC) };
assert!(ret.is_ok());