Crate posish[−][src]
Expand description
posish
provides safe wrappers to libc
functions. The current focus is
on the functionality needed by cap-std
and system-interface
that
isn’t provided by std
or getrandom
.
The wrappers perform the following tasks:
- Error values are translated to
Result
s. - Out-parameters are translated to return values.
- Path arguments can by any kind of string type.
- File descriptors are passed in through arguments implementing
AsFd
instead of as bare integers and returned asOwnedFd
s. - Constants use
enum
s andbitflags
types. - Multiplexed functions (eg.
fcntl
,ioctl
, etc.) are de-multiplexed. - Variadic functions (eg.
openat
, etc.) are presented as non-variadic. - Functions and types which need
64
suffixes to enable large-file support are used automatically. - Behaviors that depend on the sizes of C types like
long
are hidden. - File offsets and sizes are presented as
i64
andu64
rather thanoff_t
. - In some places, more human-friendly and less historical-accident names are used.
Things they don’t do include:
- Detecting whether functions are supported at runtime.
- Hiding significant differences between platforms.
- Restricting ambient authorities.
- Imposing sandboxing features such as filesystem path or network address sandboxing.
See cap-std
, system-interface
, and io-streams
for libraries
which do hide significant differences between platforms, and cap-std
which does perform sandboxing and restricts ambient authorities.
Safety
This library uses the io-lifetimes crate to manage all OS resource handles, automatically ensuring I/O safety.
Modules
fs | Filesystem operations. |
io | I/O operations. |
net | Network-related operations. |
path | Filesystem path operations. |
process | Process-associated operations. |
rand | Random-related operations. |
time | Time-related operations. |