devela::_dep::nc::call

Function pipe2

pub unsafe fn pipe2(pipefd: &mut [i32; 2], flags: i32) -> Result<(), i32> 
Available on crate feature dep_nc only.
Expand description

Create a pipe.

§Examples

let mut fds = [-1_i32, 2];
let ret = unsafe {nc::pipe2(&mut fds, nc::O_CLOEXEC | nc::O_NONBLOCK) };
assert!(ret.is_ok());
let ret = unsafe { nc::close(fds[0]) };
assert!(ret.is_ok());
let ret = unsafe { nc::close(fds[1]) };
assert!(ret.is_ok());