Sha256: 60d797d4e85e08e6330e6b8d80094356ce377e5484952f88ae2a6e49231c268c

Contents?: true

Size: 791 Bytes

Versions: 23

Compression:

Stored size: 791 Bytes

Contents

use crate::ffi::CStr;

use crate::backend::c;
use crate::backend::conv::{c_str, ret, ret_owned_fd};
use crate::fd::OwnedFd;
use crate::fs::Mode;
use crate::io;
use crate::shm::ShmOFlags;

pub(crate) fn shm_open(name: &CStr, oflags: ShmOFlags, mode: Mode) -> io::Result<OwnedFd> {
    // On this platforms, `mode_t` is `u16` and can't be passed directly to a
    // variadic function.
    #[cfg(apple)]
    let mode: c::c_uint = mode.bits().into();

    // Otherwise, cast to `mode_t` as that's what `open` is documented to take.
    #[cfg(not(apple))]
    let mode: c::mode_t = mode.bits() as _;

    unsafe { ret_owned_fd(c::shm_open(c_str(name), bitflags_bits!(oflags), mode)) }
}

pub(crate) fn shm_unlink(name: &CStr) -> io::Result<()> {
    unsafe { ret(c::shm_unlink(c_str(name))) }
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/rustix-0.38.44/src/backend/libc/shm/syscalls.rs
wasmtime-28.0.0 ./ext/cargo-vendor/rustix-0.38.43/src/backend/libc/shm/syscalls.rs
wasmtime-27.0.0 ./ext/cargo-vendor/rustix-0.38.41/src/backend/libc/shm/syscalls.rs
wasmtime-26.0.0 ./ext/cargo-vendor/rustix-0.38.37/src/backend/libc/shm/syscalls.rs
wasmtime-25.0.2 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-25.0.1 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-25.0.0 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-24.0.0 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-23.0.2 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-22.0.0 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-21.0.1 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-20.0.2 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-20.0.0 ./ext/cargo-vendor/rustix-0.38.34/src/backend/libc/shm/syscalls.rs
wasmtime-18.0.3 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-17.0.1 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-17.0.0 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-16.0.0 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-15.0.1 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-15.0.0 ./ext/cargo-vendor/rustix-0.38.28/src/backend/libc/shm/syscalls.rs
wasmtime-14.0.4 ./ext/cargo-vendor/rustix-0.38.20/src/backend/libc/shm/syscalls.rs