nix
nix copied to clipboard
Rust friendly bindings to *nix APIs
Hi, Added wrapper around Linux's `getrandom` syscall as mentioned in #1826. ```rust let random_bytes = getrandom(1000, RandomMode::GRND_RANDOM).unwrap(); ``` returns a Vector with 1000 random bytes Thanks :) Signed-off-by: Stefin
```c ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); ```
crash on my Android phone because `pw.pw_passwd == NULL`
I have an API which requires a raw integer signal value, and that signal value comes from the return value of `waitid`. Currently it has to be manually mapped in...
This PR is for issue #1811. On OSes where `getpwent_r/getgrent_r` is available, it is used. On other OSes, use `getpwent/getgrent`. However, `illumos` and `solaris`, they do have `getpwent_r/getgrent_r`, but the...
When reading a value into an enum from getsockopt, we must validate it. Failing to do so can lead to UB for example with SOCK_PACKET on Linux. Perform the validation...
## Description I noticed that the implementation of `GetSockOpt` for `nix::sys::socket::sockopt::SockType` [simply assumes](https://docs.rs/nix/0.25.0/src/nix/sys/socket/sockopt.rs.html#91) that the socket type returned by the kernel is one of those defined in `enum nix::sys::socket::SockType` without...
```c int syncfs(int fd); ``` [`syncfs(2)`](https://linux.die.net/man/2/syncfs) is like `sync(2)`, but synchronizes just the filesystem containing file referred to by the open file descriptor fd.