Module utils

Module utils 

Source
Expand description

Utility functions and struct

Modules§

byte_order
Module with helpers to read/write bytes into slices
net
Module with network related helpers
signal
Module with external libc functions
sm
Module with state machine

Functions§

align_down
Align address down to the aligment.
align_up
Align address up to the aligment.
bytes_to_mib
Converts Bytes to MiB, truncating any remainder
get_page_size
Return the default page size of the platform, in bytes.
mib_to_bytes
Converts MiB to Bytes
open_file_write_nonblock
Create and open a File for writing to it. In case we open a FIFO, in order to not block the instance if nobody is consuming the message that is flushed to it, we are opening it with O_NONBLOCK flag. In this case, writing to a pipe will start failing when reaching 64K of unconsumed content.
u64_to_usize
Safely converts a u64 value to a usize value. This bypasses the Clippy lint check because we only support 64-bit platforms.
usize_to_u64
Safely converts a usize value to a u64 value. This bypasses the Clippy lint check because we only support 64-bit platforms.
wrap_usize_to_u32
Converts a usize into a wrapping u32.