Expand description
Small system utility modules for usage by other modules.
Re-exportsΒ§
pub use ioctl::*;pub use signal::*;pub use crate::sys::unix::descriptor::*;
ModulesΒ§
- acpi_event π
 - capabilities π
 - descriptor π
 - event π
 - file π
 - file_traits πThis module exposes Linuxβs off64_t, pread64, and pwrite64 identifiers as the non-64 POSIX versions, similar to defining _FILE_OFFSET_BITS=64 in a C program.
 - Macros and wrapper functions for dealing with ioctls.
 - linux πLinux-specific utility modules.
 - mmap πThe mmap module provides a safe interface to mmap memory and ensures unmap is called when the mmap object leaves scope.
 - net π
 - netlink π
 - notifiers π
 - poll π
 - priority π
 - sched πWrappers for CPU affinity functions.
 - shm π
 - signalfd π
 - terminal π
 - timer π
 - write_zeroes π
 
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
 - Used to poll multiple objects that have file descriptors.
 - Iterator returning the offset range of data in the file.
 - Generic netlink header struct, can be used by netlink consumer
 - A set of memfd seals.
 - Wraps an anonymous shared memory mapping in the current process. Provides RAII semantics including munmap when no longer needed.
 - Tracks Fixed Memory Maps within an anonymous memory-mapped fixed-sized arena in the current process.
 - Iterator over
struct NlAttras received from a netlink socket. - Safe wrapper for
NETLINK_GENERICnetlink sockets. - A single netlink message, including its header and data.
 - Iterator over
struct nlmsghdras received from a netlink socket. - Netlink attribute struct, can be used by netlink consumer
 - A safe wrapper around a Linux signalfd (man 2 signalfd).
 - Used to attempt to clean up a named pipe after it is no longer used.
 - Used to attempt to clean up a named pipe after it is no longer used.
 
EnumsΒ§
- The operation to perform with
fallocate. - The operation to perform with
flock. 
ConstantsΒ§
- Constant ioctl request number.
 - BLOCK_IO_TYPE π
 
TraitsΒ§
- A trait used to abstract types that provide a process id that can be operated on.
 - Linux specific extensions to
Event. - Trait for file descriptors that are TTYs, according to
isatty(3). 
FunctionsΒ§
- Executes the given callback with extended soft limit of max number of open files. After the callback executed, restore the limit.
 - Discards the given range of a block file.
 - Drops all capabilities (permitted, inheritable, and effective) from the current process.
 - Enable experimental core scheduling for the current thread.
 - Returns the last errno as a Result that is always an error.
 - Safe wrapper for
fallocate(). - Find the offset range of the next data in the file.
 - Safe wrapper for flock(2) with the operation
opand optionallynonblocking. The lock will be dropped automatically whenfileis dropped. - Safe wrapper for
fstat(). - Safe wrapper for
getegid(2). - Safe wrapper for
geteuid(2). - This bypasses
libcβs cachinggetpid(2)wrapper which can be invalid if a raw clone was used elsewhere. - Safe wrapper for the geppid Linux systemcall.
 - Safe wrapper for the gettid Linux systemcall.
 - Checks whether a file is a block device fie or not.
 - Kill all processes in the current process group.
 - Returns the capacity (measure of performance) of a given logical core.
 - Returns the cluster ID of a given logical core.
 - Returns a list of supported frequencies in kHz for a given logical core.
 - Returns the maximum frequency (in kHz) of a given logical core.
 - Get the soft and hard limits of max number of open files allowed by the environment.
 - Return the maximum Duration that can be used with libc::timespec.
 - Moves the requested PID/TID to a particular cgroup
 - Test-only function used to create a pipe that is full. The pipe is created, has its size set to the minimum and then has that much data written to it. Use
new_pipe_fullto test handling of blockingwritecalls in unit tests. - Open the file with the given path, or if it is of the form
/proc/self/fd/Nthen just use the file descriptor. - parse_sysfs_cpu_info π
 - Queries the property of a specified CPU sysfs node.
 - Spawns a pipe pair where the first pipe is the read end and the second pipe is the write end.
 - Utility function that returns true if the given FD is readable without blocking.
 - Read raw bytes from stdin.
 - Reaps a child process that has terminated.
 - Check FD is not opened by crosvm and returns a FD that is freshly DUPFD_CLOEXECβs. A SafeDescriptor is created from the duplicated fd. It does not take ownership of fd passed by argument.
 - If the given path is of the form /proc/self/fd/N for some N, returns
Ok(Some(N)). Otherwise returnsOk(None). - Set the CPU affinity of the current thread to a given set of CPUs.
 - set_max_open_files πSet the soft and hard limits of max number of open files to the given value.
 - Sets the pipe signified with fd to
size. - Enables real time thread priorities in the current thread up to
limit. - Sets the current thread to be scheduled using the round robin real time class with
priority. - Safe wrapper for PR_SET_NAME(2const)
 - Verifies that |raw_descriptor| is actually owned by this process and duplicates it to ensure that we have a unique handle to it.
 - Verifies that |raw_fd| is actually owned by this process and duplicates it to ensure that we have a unique handle to it.
 - A safe wrapper around waitpid.
 
Type AliasesΒ§
- Re-export libc types that are part of the API.