Function shmget
pub unsafe fn shmget(key: i32, size: usize, shm_flag: i32) -> Result<i32, i32> ⓘ
Available on crate feature
dep_nc
only.Expand description
Allocates a System V shared memory segment.
§Examples
let size = 4 * nc::PAGE_SIZE;
let flags = nc::IPC_CREAT | nc::IPC_EXCL | 0o600;
let ret = unsafe { nc::shmget(nc::IPC_PRIVATE, size, flags) };
assert!(ret.is_ok());
let shmid = ret.unwrap();
let mut buf = nc::shmid_ds_t::default();
let ret = unsafe { nc::shmctl(shmid, nc::IPC_RMID, &mut buf) };
assert!(ret.is_ok());