devela::_dep::nc

Function mq_getsetattr

pub unsafe fn mq_getsetattr(
    mqdes: i32,
    new_attr: Option<&mq_attr_t>,
    old_attr: Option<&mut mq_attr_t>,
) -> Result<i32, i32> 
Available on crate feature dep_nc only.
Expand description

Get/set message queue attributes

§Examples

let name = "nc-mq-getsetattr";
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 mut old_attr = nc::mq_attr_t::default();
let ret = unsafe { nc::mq_getsetattr(mq_id, None, Some(&mut old_attr)) };
assert!(ret.is_ok());
println!("old attr: {:?}", old_attr);

let ret = unsafe { nc::close(mq_id) };
assert!(ret.is_ok());
let ret = unsafe { nc::mq_unlink(name) };
assert!(ret.is_ok());