rustpython-host_env 0.6.0

Host OS API abstractions for RustPython
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use core::ffi::CStr;
use std::io;

use crate::os::CheckLibcResult;

pub use libc::mode_t;

pub fn shm_open(name: &CStr, flags: libc::c_int, mode: libc::c_uint) -> io::Result<libc::c_int> {
    #[cfg(target_os = "freebsd")]
    let mode = mode.try_into().unwrap();

    unsafe { libc::shm_open(name.as_ptr(), flags, mode) }.check_libc_neg()
}

pub fn shm_unlink(name: &CStr) -> io::Result<()> {
    unsafe { libc::shm_unlink(name.as_ptr()) }.check_libc_neg()?;
    Ok(())
}