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 🔒
- Library for custom implementations of serialize/deserialize.
- Provides infrastructure for de/serializing descriptors embedded in Rust data structures.
- errno 🔒
- event 🔒
- iobuf 🔒
- mmap 🔒
- shm 🔒
- Facilities for sending log message to syslog.
- timer 🔒
- tube 🔒
- Types for volatile access to memory.
- Worker thread abstraction
Macros§
- Logs a message at the debug level.
- Logs a message at the error level.
- 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. - 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
-1
and settingerrno
to appropriate error code (EINTR
,EINVAL
, etc.) Most of standard non-reentrant libc functions use this way of signalling errors. - Macro that retries the given expression every time its result indicates it was interrupted. It is intended to use with system functions that return
EINTR
and other error codes directly as their result. Most of reentrant functions use this way of signalling errors. - Logs a message at the info level.
- Raw macro to declare the expression that calculates an ioctl number
- Declare an ioctl that transfers no data.
- Raw macro to declare a constant or a function that returns an ioctl number.
- Declare an ioctl that reads data.
- Declare an ioctl that writes data.
- Declare an ioctl that reads and writes data.
- Assert repeatedly until it’s true
- Logs a message at the trace level.
- Logs a message at the warn level.
Structs§
- 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
- 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.
- 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.
- FakeTimer: For use in tests.
- Cross-platform mutable buffer.
- A contiguous memory allocation with a specified size and alignment, with a Drop impl to perform the deallocation.
- See MemoryMapping for struct- and method-level documentation.
- Memory access type for anonymous shared memory mapping.
- A Tube end which can only recv messages.
- A Tube end which can only send messages. Cloneable.
- A shared memory file descriptor and its size.
- Represents an event that has been signaled and waited for via a wait function.
- A slice of raw memory that supports volatile access. Like
std::io::IoSliceMut
, this type is guaranteed to be ABI-compatible withlibc::iovec
but unlikeIoSliceMut
, it doesn’t automatically deref to&mut [u8]
. - Used to wait for multiple objects which are eligible for waiting.
- Wrapper object for creating a worker thread that can be stopped by signaling an event.
Enums§
- Represents types of events to watch for.
Traits§
- An empty trait that helps reset timer resolution to its previous state.
- Trait that can be used to associate events with arbitrary enums when using
WaitContext
. - A trait for allocating disk space in a sparse file. This is equivalent to fallocate() with no special flags.
- 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.
- A trait similar to the unix
ReadExt
andWriteExt
traits, but for volatile memory. - A trait similar to
Read
andWrite
, but uses volatile memory as buffers. - A trait for setting the size of a file. This is equivalent to File’s
set_len
method, but wrapped in a trait so that it can be implemented for other types. - A trait for flushing the contents of a file to disk. This is equivalent to File’s
sync_all
andsync_data
methods, but wrapped in a trait so that it can be implemented for other types. - A range of memory that can be msynced, for abstracting over different types of memory mappings.
- A trait for deallocating space in a file.
- A trait for timer objects that delivers timer expiration notifications to an underlying descriptor.
- Trait for types that support raw volatile access to their data.
- A trait for writing zeroes to an arbitrary position in a file.
Functions§
- Returns the last errno as a Result that is always an error.
- Creates a UUID.
- Uses the system’s page size in bytes to round the given value up to the nearest page boundary.
Type Aliases§
Derive Macros§
- Implements the EventToken trait for a given
enum
.