devela::_dep::nc::call

Function mq_open

pub unsafe fn mq_open<P>(
    name: P,
    oflag: i32,
    mode: u16,
    attr: Option<&mut mq_attr_t>,
) -> Result<i32, i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Open a POSIX message queue.

§Examples

let name = "nc-posix-mq";
let ret = unsafe {
    nc::mq_open(
        name,
        nc::O_CREAT | nc::O_RDWR,
        (nc::S_IRUSR | nc::S_IWUSR) as nc::umode_t,
        None,
    )
};
assert!(ret.is_ok());
let mq_id = ret.unwrap();
let ret = unsafe { nc::close(mq_id) };
assert!(ret.is_ok());
let ret = unsafe { nc::mq_unlink(name) };
assert!(ret.is_ok());