uapi 0.2.2

Wrappers for OS APIs on UNIX-like platform
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use uapi::*;

#[test]
fn dupfd() {
    let (fd, _) = pipe().unwrap();

    let dup = fcntl_dupfd(*fd, 100).unwrap();
    assert_eq!(*dup, 100);
    assert_ne!(fcntl_getfd(*dup).unwrap() & c::FD_CLOEXEC, c::FD_CLOEXEC);

    let dup = fcntl_dupfd_cloexec(*fd, 101).unwrap();
    assert_eq!(*dup, 101);
    assert_eq!(fcntl_getfd(*dup).unwrap() & c::FD_CLOEXEC, c::FD_CLOEXEC);
}