Module utility

Source
Expand description

Miscellaneous utilities that are used by Shadow.

Modules§

byte_queue
callback_queue
An event/listener framework to allow listeners to subscribe to event sources.
childpid_watcher
counter
A counter that can be used to count frequencies of a set of objects. The counter starts with no keys. When an unknown key is incremented, the counter adds a new key to an internal map and sets the count for that key to 1. When a known key is incremented, the count for that key increases. The state of the counter can be extracted by converting it to a string, which lists the counts for all keys sorted with the heaviest hitters first. Currently, only String types are supported, but we may eventually support counting generic types.
enum_passthrough
give
interval_map
legacy_callback_queue
macros
once_set
pcap_writer
perf_timer
proc_maps
shm_cleanup
sockaddr
status_bar
stream_len
syscall
units
Types for parsing/deserializing unit values.

Structs§

HostTreePointer
A pointer to an object that is safe to dereference from any thread, if the Host lock for the specified host is held.
Magic
Runtime memory error checking to help catch errors that C code is prone to. Can probably drop once C interop is removed.
ObjectCounter
Helper for tracking the number of allocated objects.

Enums§

VerifyPluginPathError

Traits§

IsSend
A trait we can use as a compile-time check to make sure that an object is Send.
IsSync
A trait we can use as a compile-time check to make sure that an object is Sync.

Functions§

case_insensitive_eq
Returns true if eq_ignore_ascii_case returns true on all u8 ascii pairs. Should only be used for ascii byte strings.
copy_dir_all
Copy the contents of the src directory to a new directory named dst. Permissions will be preserved.
debug_assert_cloexec
If debug assertions are enabled, panics if FD_CLOEXEC is not set on file.
i8_to_u8_slice
Convert a &[i8] to &[u8]. Useful when interacting with C strings. Panics if u8::try_from(c) fails for any c in the slice.
inject_preloads
Inject injected_preloads into the environment envv.
pathbuf_to_nul_term_cstring
Helper for converting a PathBuf to a CString
return_code_for_signal
Get the return code for a process that exited by the given signal, following the behaviour of bash.
tilde_expansion
u8_to_i8_slice
Convert a &[u8] to &[i8]. Useful when interacting with C strings. Panics if i8::try_from(c) fails for any c in the slice.
verify_plugin_path
Check that the plugin path is executable under Shadow.