[−][src]Crate posish
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
Results. - Out-parameters are translated to return values.
- Path arguments can by any kind of string type.
- File descriptors are passed in through arguments implementing
AsRawFdinstead of as bare integers and returned asstd::fs::Files. - Constants use
enums andbitflagstypes. - Multiplexed functions (eg.
fcntl,ioctl, etc.) are de-multiplexed. - Variadic functions (eg.
openat, etc.) are presented as non-variadic. - Functions and types which need
64suffixes to enable large-file support are used automatically. - Behaviors that depend on the sizes of C types like
longare hidden. - File offsets and sizes are presented as
i64andu64rather thanoff_t. - In some places, more human-friendly and less historical-accident names are used.
Things they don't do include:
- Emulating functions that aren't natively supported on a platform.
- Detecting whether functions are supported at runtime.
- Hiding significant differences between platforms.
- Hiding ambient authorities.
- Imposing sandboxing features such as filesystem path or network address sandboxing.
See cap-std and system-interface for libraries which do hide
ambient authorities and perform sandboxing.
Safety
This library follows std in considering dynamic integer values that
have no meaning outside of OS APIs to be similar to raw pointers, from a
safety perspective. For example,
std::os::unix::io::FromRawFd::from_raw_fd is unsafe since it takes a
raw file descriptor. In this library, raw file descriptors and raw
directory seek locations are considered to be similar to raw pointers in
terms of safety.
Modules
| fs | Filesystem operations. |
| io | I/O operations. |
| net | Network-related operations. |
| path | Filesystem path operations. |
| process | Process-associated operations. |
| time | Time-related operations. |