1 #[cfg(not(any(target_os = "redox", target_os = "wasi")))] 2 #[test] test_fcntl_dupfd_cloexec()3fn test_fcntl_dupfd_cloexec() { 4 use rustix::fd::AsFd; 5 use std::os::unix::io::AsRawFd; 6 7 let file = rustix::fs::openat( 8 rustix::fs::cwd(), 9 "Cargo.toml", 10 rustix::fs::OFlags::RDONLY, 11 rustix::fs::Mode::empty(), 12 ) 13 .unwrap(); 14 15 let new = rustix::fs::fcntl_dupfd_cloexec(&file, 700).unwrap(); 16 assert_eq!(new.as_fd().as_raw_fd(), 700); 17 } 18