[−][src]Crate sys_util
Small system utility modules for usage by other modules.
Re-exports
pub use guest_memory::*; |
pub use ioctl::*; |
pub use signal::*; |
pub use guest_memory::Error as GuestMemoryError; |
Modules
guest_memory | Track memory regions that are mapped to the guest VM. |
handle_eintr | Macro and helper trait for handling interrupted routines. |
ioctl | Macros and wrapper functions for dealing with ioctls. |
net | |
signal | |
syslog | Facilities for sending log message to syslog. |
Macros
debug | A macro for logging debug information. |
error | A macro for logging an error. |
handle_eintr | Macro that retries the given expression every time its result indicates it was interrupted (i.e.
returned |
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 |
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 |
info | A macro for logging info. |
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 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. |
log | A macro for logging at an arbitrary priority level. |
warn | A macro for logging a warning. |
Structs
Clock | |
EpollContext | EpollContext wraps linux epoll. It provides similar interface to PollContext. It is thread safe while PollContext is not. It requires user to pass in a reference of EpollEvents while PollContext does not. Always use PollContext if you don't need to access the same epoll from different threads. |
EpollEvents | EpollEvents wraps raw epoll_events, it should only be used with EpollContext. |
Error | An error number, retrieved from errno (man 3 errno), set by a libc function that returned an error. |
EventFd | A safe wrapper around a Linux eventfd (man 2 eventfd). |
FakeClock | A fake clock that can be used in tests to give exact control over the time. For a code example, see the tests in sys_util/src/timerfd.rs. |
FakeTimerFd | FakeTimerFd: For use in tests. |
Fd | |
GuestAddress | Represents an Address in the guest's memory. |
MemfdSeals | A set of memfd seals. |
MemoryMapping | Wraps an anonymous shared memory mapping in the current process. |
PollContext | Used to poll multiple objects that have file descriptors. |
PollEvent | An event returned by |
PollEventIter | An iterator over some (sub)set of events returned by |
PollEvents | The list of event returned by |
PollEventsOwned | A deep copy of the event records from |
SharedMemory | A shared memory file descriptor and its size. |
SignalFd | A safe wrapper around a Linux signalfd (man 2 signalfd). |
TempDir | Create and remove a temporary directory. The directory will be maintained for the lifetime of
the |
TimerFd | A safe wrapper around a Linux timerfd (man 2 timerfd_create). |
UnlinkUnixDatagram | Used to attempt to clean up a named pipe after it is no longer used. |
WatchingEvents | Watching events taken by PollContext. |
Enums
CloneError | |
CloneNamespace | Controls what namespace |
Error | |
Error | |
FallocateMode | The operation to perform with |
FileFlags | |
FlockOperation | The operation to perform with |
MmapError | |
SignalFdError |
Traits
FileSetLen | A trait for setting the size of a file.
This is equivalent to File's |
FileSync | A trait for flushing the contents of a file to disk.
This is equivalent to File's |
IntoIovec | Trait for types that can be converted into an |
PollToken | Trait for a token that can be associated with an |
PunchHole | A trait for deallocating space in a file. |
ScmSocket | Trait for file descriptors can send and receive socket control messages via |
SeekHole | A trait for seeking to the next hole or non-hole position in a file. |
Terminal | Trait for file descriptors that are TTYs, according to |
WriteZeroes | A trait for writing zeroes to a stream. |
Functions
chown | Safe wrapper for chown(2). |
clone_process | Clones this process and calls a closure in the new process. |
fallocate | Safe wrapper for |
flock | Safe wrapper for flock(2) with the operation |
get_group_id | Safe wrapper for getting a gid from a group name with |
get_user_id | Safe wrapper for getting a uid from a user name with |
getegid | Safe wrapper for |
geteuid | Safe wrapper for |
getpid | This bypasses |
kernel_has_memfd | Checks if the kernel we are running on has memfd_create. It was introduced in 3.17. Only to be used from tests to prevent running on ancient kernels that won't support the functionality anyways. |
kill_process_group | Kill all processes in the current process group. |
pagesize | Safe wrapper for |
pipe | Spawns a pipe pair where the first pipe is the read end and the second pipe is the write end. |
read_struct⚠ | Reads a struct from an input buffer.
This is unsafe because the struct is initialized to unverified data read from the input.
|
read_struct_slice⚠ | Reads an array of structs from an input buffer. Returns a Vec of structs initialized with data
from the specified input.
This is unsafe because the structs are initialized to unverified data read from the input.
|
reap_child | Reaps a child process that has terminated. |
round_up_to_page_size | Uses the system's page size in bytes to round the given value up to the nearest page boundary. |
set_rt_prio_limit | Enables real time thread priorities in the current thread up to |
set_rt_round_robin | Sets the current thread to be scheduled using the round robin real time class with |
validate_raw_fd | Verifies that |raw_fd| is actually owned by this process and duplicates it to ensure that we have a unique handle to it. |
Type Definitions
Result |