(args: ShmOpenArgs, vm: &VirtualMachine)
| 25 | |
| 26 | #[pyfunction] |
| 27 | fn shm_open(args: ShmOpenArgs, vm: &VirtualMachine) -> PyResult<libc::c_int> { |
| 28 | let name = CString::new(args.name.as_str()).map_err(|e| e.into_pyexception(vm))?; |
| 29 | let mode: libc::c_uint = args.mode as _; |
| 30 | #[cfg(target_os = "freebsd")] |
| 31 | let mode = mode.try_into().unwrap(); |
| 32 | // SAFETY: `name` is a NUL-terminated string and `shm_open` does not write through it. |
| 33 | let fd = unsafe { libc::shm_open(name.as_ptr(), args.flags, mode) }; |
| 34 | if fd == -1 { |
| 35 | Err(errno_io_error().into_pyexception(vm)) |
| 36 | } else { |
| 37 | Ok(fd) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | #[pyfunction] |
| 42 | fn shm_unlink(name: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult<()> { |
nothing calls this directly
no test coverage detected