pub struct Libc;unsafe_ffi only.Expand description
๐ฅ๏ธ ๐ ๏ธ Raw C/POSIX system interfaces exposed through the platformโs libc.
๐ sys/os
Thin, unsafe bindings that provide direct access to C ABI functions for memory mapping, shared memory, file descriptors, and other low-level operations. These are unmodified system calls as provided by the host libc.
Implementationsยง
Sourceยงimpl Libc
Constants from POSIX and libc.
impl Libc
Constants from POSIX and libc.
Sourcepub const PROT_WRITE: c_int = 0x2
pub const PROT_WRITE: c_int = 0x2
POSIX mmap protection: pages are writable.
Sourcepub const MAP_SHARED: c_int = 0x01
pub const MAP_SHARED: c_int = 0x01
POSIX mmap flag: mapping is shared with other processes.
Sourcepub const MAP_FAILED: *mut c_void
pub const MAP_FAILED: *mut c_void
POSIX mmap failure sentinel returned on error.
Sourcepub const MAP_PRIVATE: c_int = 0x02
pub const MAP_PRIVATE: c_int = 0x02
POSIX mmap flag: mapping is private to this process.
Sourcepub const MAP_ANONYMOUS: c_int = 0x20
pub const MAP_ANONYMOUS: c_int = 0x20
Linux mmap flag: mapping is not backed by a file.
Sourcepub const MAP_NORESERVE: c_int = 0x4000
pub const MAP_NORESERVE: c_int = 0x4000
Linux mmap flag: do not reserve swap space for this mapping.
Sourceยงimpl Libc
Convenience helpers for libc return values.
impl Libc
Convenience helpers for libc return values.
Sourcepub fn is_map_failed(ptr: *mut c_void) -> bool
pub fn is_map_failed(ptr: *mut c_void) -> bool
Returns true if ptr matches the POSIX MAP_FAILED sentinel.
Sourceยงimpl Libc
Direct wrappers around libc/POSIX calls.
impl Libc
Direct wrappers around libc/POSIX calls.
Sourcepub unsafe fn shm_open(
name: *const c_char,
oflag: c_int,
mode: c_mode_t,
) -> c_int
pub unsafe fn shm_open( name: *const c_char, oflag: c_int, mode: c_mode_t, ) -> c_int
Create/open POSIX shared memory.
Sourcepub unsafe fn shm_unlink(name: *const c_char) -> c_int
pub unsafe fn shm_unlink(name: *const c_char) -> c_int
Unlink POSIX shared memory.
Sourcepub unsafe fn ftruncate(fd: c_int, length: c_off_t) -> c_int
pub unsafe fn ftruncate(fd: c_int, length: c_off_t) -> c_int
Truncate a file to a specified length.
Sourcepub unsafe fn mmap(
addr: *mut c_void,
length: usize,
prot: c_int,
flags: c_int,
fd: c_int,
offset: c_off_t,
) -> *mut c_void
pub unsafe fn mmap( addr: *mut c_void, length: usize, prot: c_int, flags: c_int, fd: c_int, offset: c_off_t, ) -> *mut c_void
Map pages of memory.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Libc
impl RefUnwindSafe for Libc
impl Send for Libc
impl Sync for Libc
impl Unpin for Libc
impl UnsafeUnpin for Libc
impl UnwindSafe for Libc
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.