Expand description
Safe, cross-platform-compatible wrappers for system interfaces.
Re-exportsยง
pub use platform::ioctl::ioctl;pub use platform::ioctl::ioctl_with_mut_ptr;pub use platform::ioctl::ioctl_with_mut_ref;pub use platform::ioctl::ioctl_with_ptr;pub use platform::ioctl::ioctl_with_ref;pub use platform::ioctl::ioctl_with_val;pub use platform::ioctl::IoctlNr;pub use tube::ProtoTube;pub use tube::Tube;pub use sys::linux;pub use linux::clone_descriptor;pub use linux::safe_descriptor_from_path;pub use linux::validate_raw_descriptor;pub use linux::clear_descriptor_cloexec;pub use linux::safe_descriptor_from_cmdline_fd;pub use linux::block_signal;pub use linux::clear_signal;pub use linux::get_blocked_signals;pub use linux::new_pipe_full;pub use linux::register_rt_signal_handler;pub use linux::signal;pub use linux::unblock_signal;pub use linux::Killable;pub use linux::SIGRTMIN;pub use linux::AcpiNotifyEvent;pub use linux::NetlinkGenericSocket;pub use linux::SignalFd;pub use linux::Terminal;pub use linux::drop_capabilities;pub use linux::pipe;pub use linux::read_raw_stdin;pub use linux::enable_core_scheduling;pub use linux::set_rt_prio_limit;pub use linux::set_rt_round_robin;pub use linux::flock;pub use linux::FlockOperation;pub use linux::getegid;pub use linux::geteuid;pub use linux::gettid;pub use linux::kill_process_group;pub use linux::reap_child;pub use linux::logical_core_capacity;pub use linux::logical_core_cluster_id;pub use linux::logical_core_frequencies_khz;pub use linux::logical_core_max_freq_khz;pub use linux::sched_attr;pub use linux::sched_setattr;pub use linux::UnlinkUnixListener;pub use linux::EventExt;pub use linux::Gid;pub use sys::unix;pub use unix::IoBuf;pub use unix::net::UnixSeqpacket;pub use unix::net::UnixSeqpacketListener;pub use unix::net::UnlinkUnixSeqpacketListener;pub use unix::ScmSocket;pub use unix::SCM_SOCKET_MAX_FD_COUNT;pub use unix::add_fd_flags;pub use unix::clear_fd_flags;pub use unix::number_of_logical_cores;pub use unix::pagesize;pub use unix::Pid;pub use descriptor_reflection::deserialize_with_descriptors;pub use descriptor_reflection::with_as_descriptor;pub use descriptor_reflection::with_raw_descriptor;pub use descriptor_reflection::FileSerdeWrapper;pub use descriptor_reflection::SerializeDescriptors;pub use platform::get_cpu_affinity;pub use platform::getpid;pub use platform::open_file_or_duplicate;pub use platform::platform_timer_resolution::enable_high_res_timers;pub use platform::set_cpu_affinity;pub use platform::set_thread_name;pub use platform::BlockingMode;pub use platform::EventContext;pub use platform::FramingMode;pub use platform::MemoryMappingArena;pub use platform::RawDescriptor;pub use platform::StreamChannel;pub use platform::INVALID_DESCRIPTOR;pub use crate::descriptor::AsRawDescriptor;pub use crate::descriptor::AsRawDescriptors;pub use crate::descriptor::Descriptor;pub use crate::descriptor::FromRawDescriptor;pub use crate::descriptor::IntoRawDescriptor;pub use crate::descriptor::SafeDescriptor;
Modulesยง
- alloc ๐
- clock ๐
- custom_
serde - Library for custom implementations of serialize/deserialize.
- descriptor
- descriptor_
reflection - Provides infrastructure for de/serializing descriptors embedded in Rust data structures.
- errno ๐
- event ๐
- file_
traits ๐ - iobuf ๐
- Cross platform
IoBufandIoBufMuttypes wrappingiovec/WSABUF. - mmap ๐
- notifiers ๐
- periodic_
logger ๐ - shm ๐
- sys
- syslog
- Facilities for sending log message to syslog.
- test_
utils - timer ๐
- tube ๐
- volatile_
memory ๐ - Types for volatile access to memory.
- wait_
context ๐ - worker_
thread ๐ - Worker thread abstraction
- write_
zeroes ๐
Macrosยง
- debug
- Logs a message at the debug level.
- error
- Logs a message at the error level.
- handle_
eintr - Macro that retries the given expression every time its result indicates it was interrupted (i.e.
returned
EINTR). This is useful for operations that are prone to being interrupted by signals, such as blocking syscalls. - handle_
eintr_ errno - Macro that retries the given expression every time its result indicates it was interrupted.
It is intended to use with system functions that signal error by returning
-1and settingerrnoto appropriate error code (EINTR,EINVAL, etc.) Most of standard non-reentrant libc functions use this way of signalling errors. - handle_
eintr_ rc - Macro that retries the given expression every time its result indicates it was interrupted.
It is intended to use with system functions that return
EINTRand other error codes directly as their result. Most of reentrant functions use this way of signalling errors. - info
- Logs a message at the info level.
- ioctl_
expr - Raw macro to declare the expression that calculates an ioctl number
- ioctl_
io_ nr - Declare an ioctl that transfers no data.
- ioctl_
ioc_ nr - Raw macro to declare a constant or a function that returns an ioctl number.
- ioctl_
ior_ nr - Declare an ioctl that reads data.
- ioctl_
iow_ nr - Declare an ioctl that writes data.
- ioctl_
iowr_ nr - Declare an ioctl that reads and writes data.
- poll_
assert - Assert repeatedly until itโs true
- syscall
- trace
- Logs a message at the trace level.
- volatile_
at_ impl - volatile_
impl - warn
- Logs a message at the warn level.
Structsยง
- Clock
- Error
- A system error In Unix systems, retrieved from errno (man 3 errno), set by a libc function that returned an error. On Windows, retrieved from GetLastError, set by a Windows function that returned an error
- Event
- An inter-process event wait/notify mechanism. Loosely speaking: Writes signal the event. Reads block until the event is signaled and then clear the signal.
- External
Mapping - Fake
Clock - A fake clock that can be used in tests to give exact control over the time. For a code example, see the tests in base/src/timer.rs.
- Fake
Timer - FakeTimer: For use in tests.
- IoBuf
Mut - Cross-platform mutable buffer.
- Layout
Allocation - A contiguous memory allocation with a specified size and alignment, with a Drop impl to perform the deallocation.
- Memory
Mapping - See MemoryMapping for struct- and method-level documentation.
- Memory
Mapping Builder - Protection
- Memory access type for anonymous shared memory mapping.
- Recv
Tube - A Tube end which can only recv messages.
- Send
Tube - A Tube end which can only send messages. Cloneable.
- Shared
Memory - A shared memory file descriptor and its size.
- Timer
- Triggered
Event - Represents an event that has been signaled and waited for via a wait function.
- Volatile
Slice - A slice of raw memory that supports volatile access. Like
std::io::IoSliceMut, this type is guaranteed to be ABI-compatible withlibc::iovecbut unlikeIoSliceMut, it doesnโt automatically deref to&mut [u8]. - Wait
Context - Used to wait for multiple objects which are eligible for waiting.
- Worker
Thread - Wrapper object for creating a worker thread that can be stopped by signaling an event.
Enumsยง
- Event
Type - Represents types of events to watch for.
- Event
Wait Result - Mmap
Error - Tube
Error - VmEvent
Type - Volatile
Memory Error
Traitsยง
- Close
Notifier - Enabled
High ResTimer - An empty trait that helps reset timer resolution to its previous state.
- Event
Token - Trait that can be used to associate events with arbitrary enums when using
WaitContext. - File
Allocate - A trait for allocating disk space in a sparse file. This is equivalent to fallocate() with no special flags.
- File
GetLen - A trait for getting the size of a file. This is equivalent to Fileโs metadata().len() method, but wrapped in a trait so that it can be implemented for other types.
- File
Read Write AtVolatile - A trait similar to the unix
ReadExtandWriteExttraits, but for volatile memory. - File
Read Write Volatile - A trait similar to
ReadandWrite, but uses volatile memory as buffers. - File
SetLen - A trait for setting the size of a file.
This is equivalent to Fileโs
set_lenmethod, but wrapped in a trait so that it can be implemented for other types. - File
Sync - A trait for flushing the contents of a file to disk.
This is equivalent to Fileโs
sync_allandsync_datamethods, but wrapped in a trait so that it can be implemented for other types. - Mapped
Region - A range of memory that can be msynced, for abstracting over different types of memory mappings.
- Punch
Hole - A trait for deallocating space in a file.
- Read
Notifier - Timer
Trait - A trait for timer objects that delivers timer expiration notifications to an underlying descriptor.
- Volatile
Memory - Trait for types that support raw volatile access to their data.
- Write
Zeroes At - A trait for writing zeroes to an arbitrary position in a file.
Functionsยง
- errno_
result - Returns the last errno as a Result that is always an error.
- generate_
uuid - Creates a UUID.
- round_
up_ to_ page_ size - Uses the systemโs page size in bytes to round the given value up to the nearest page boundary.
Type Aliasesยง
Derive Macrosยง
- Event
Token - Implements the EventToken trait for a given
enum.