summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-08-04Merge #1779bors[bot]
1779: Upgrade libc to 0.2.127 r=asomers a=rtzoeller This is the last version of libc which will support Rust 1.46, per https://github.com/rust-lang/libc/pull/2845. I think we should ship nix 0.25.0 against this version of libc (at some point, not necessarily now), as it will allow us to maintain an MSRV of 1.46, and subsequently upgrade to a later libc immediately after releasing 0.25.0. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-08-03Upgrade libc to 0.2.127Ryan Zoeller
This is the last version of libc which will support Rust 1.46, per https://github.com/rust-lang/libc/pull/2845
2022-08-04Merge #1778bors[bot]
1778: fix clippy assertions_on_result_states r=rtzoeller a=pacak https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states Fixes broken CI for https://github.com/nix-rust/nix/pull/1744 Co-authored-by: Michael Baikov <manpacket@gmail.com>
2022-08-04fix clippy assertions_on_result_statesMichael Baikov
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
2022-07-26Merge #1772bors[bot]
1772: Add support for RecvOrigDstAddr on Linux r=asomers a=brianmay Fixes #1767 Co-authored-by: Brian May <brian@linuxpenguins.xyz>
2022-07-26Merge #1774bors[bot]
1774: Fix typo guarding memfd export on android. r=asomers a=detly Extremely minor but crucial typo on import guard from #1773. `@flxo` Co-authored-by: Jason Heeris <jason.heeris@gmail.com>
2022-07-26Fix typo guarding memfd export on android.Jason Heeris
2022-07-26Add support for RecvOrigDstAddr on LinuxBrian May
Fixes #1767
2022-07-25Merge #1773bors[bot]
1773: Add memfd for target_os = "android" r=asomers a=flxo Memory fds (`memfd`) are implemented and exported by Androids bionic. Export the `memfd` module if the target os is `android`. https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/mman.h;drc=23c7543b8e608ebcbb38b952761b54bb56065577;bpv=1;bpt=1;l=182 Co-authored-by: Felix Obenhuber <felix@obenhuber.de>
2022-07-25Add memfd for target_os = "android"Felix Obenhuber
Memory fds (`memfd`) are implemented and exported by Androids bionic. Export the `memfd` module if the target os is `android`. https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/mman.h;drc=23c7543b8e608ebcbb38b952761b54bb56065577;bpv=1;bpt=1;l=182
2022-07-24Merge #1768bors[bot]
1768: Add ETH_P_ALL protocol number to SockProtocol r=asomers a=valdaarhun Hi. I am working on a networking project that uses [packet sockets](https://man7.org/linux/man-pages/man7/packet.7.html) and noticed that ETH_P_ALL is not there in the `SockProtocol` enum. I thought it would be nice to have it here alongside IPPROTO_TCP and IPPROTO_UDP instead of having to separately import it from the libc crate. Co-authored-by: valdaarhun <icegambit91@gmail.com>
2022-07-24Add ETH_P_ALL protocol number to SockProtocolvaldaarhun
Add note to Changelog.md Make changes in comments Co-authored-by: Alan Somers <asomers@gmail.com> Add Android as target os for ETH_P_ALL
2022-07-23Merge #1770bors[bot]
1770: Fix SockaddrLike::from_raw with unaligned inputs r=rtzoeller a=asomers The major users of this function are functions like gethostname, which will always properly align their buffers. But out-of-crate consumers could manually construct an unaligned buffer. Handle that correctly. Enable Clippy's cast_ptr_alignment lint. It's disabled by default as it reports many false positives, but it would've caught this problem. Reported-by: Miri Fixes: 1769 Co-authored-by: Alan Somers <asomers@gmail.com>
2022-07-23Merge pull request #1771 from asomers/0.24.2-changelogAlan Somers
[skip ci] Add 0.24.2 release notes to CHANGELOG
2022-07-23Pin cargo-hack to 0.5.14 in CIAlan Somers
Newer versions of cargo-hack require a newer toolchain to install
2022-07-23Fix SockaddrLike::from_raw with unaligned inputsAlan Somers
The major users of this function are functions like gethostname, which will always properly align their buffers. But out-of-crate consumers could manually construct an unaligned buffer. Handle that correctly. Enable Clippy's cast_ptr_alignment lint. It's disabled by default as it reports many false positives, but it would've caught this problem. Reported-by: Miri Fixes: 1769
2022-07-23[skip ci] Add 0.24.2 release notes to CHANGELOGAlan Somers
2022-07-15Merge #1764bors[bot]
1764: Fix description of fchownat r=asomers a=valdaarhun Based on the man page for `fchownat` and `lchown`, I have got the impression that with `FchownatFlags::NoFollowSymlink`, fchownat and lchown are identical. I couldn't find any documentation on `lchmod`. Co-authored-by: valdaarhun <icegambit91@gmail.com>
2022-07-16Fix description of fchownatvaldaarhun
2022-07-15Merge #1741bors[bot]
1741: SigSet: A new unsafe helper method to create a SigSet from a sigset_t r=rtzoeller a=germag Currently, the only way to create a `SigSet` from a `sigset_t` object is by using pointer casts, like: ``` unsafe { let sigset = *(&sigset as *const libc::sigset_t as *const SigSet) }; ``` This is un-ergonomic for library creators with interfaces to C. So, let's add a new unsafe method that creates a `SigSet` from a `libc::sigset_t` object. We can't implement `From` since converting from `libc::sigset_t` to `SigSet` is unsafe, because objects of type `libc::sigset_t` must be initialized by calling either `sigemptyset(3)` or `sigfillset(3)` before being used. In other case, the results are undefined. We can't implement `TryFrom` either, because there is no way to check if an object of type `libc::sigset_t` is initialized. Signed-off-by: German Maglione <gmaglione@redhat.com> Co-authored-by: German Maglione <gmaglione@redhat.com>
2022-07-14Merge #1763bors[bot]
1763: Fix a buffer overflow in sys::socket::recvfrom r=posborne a=asomers IPv4 and stream sockets are unaffected, but for datagram sockets of other address types libc::recvfrom might overwrite part of the stack. Fixes #1762 Co-authored-by: Alan Somers <asomers@gmail.com>
2022-07-14Fix a buffer overflow in sys::socket::recvfromAlan Somers
IPv4 and stream sockets are unaffected, but for datagram sockets of other address types libc::recvfrom might overwrite part of the stack. Fixes #1762
2022-07-14Merge #1758bors[bot]
1758: Add chflags r=rtzoeller a=asomers Co-authored-by: musikid <musikid@outlook.com>
2022-07-13Add chflagsmusikid
2022-07-13Merge #1761bors[bot]
1761: Add non-standard Linux `SysconfVar` variants r=asomers a=stevenengler Closes #1240. You can find these options near the end of https://man7.org/linux/man-pages/man3/sysconf.3.html. I can see that the libc crate defines these for Linux and Android, but I'm not sure if they're defined for any others as well. Co-authored-by: Steven Engler <opara@cs.georgetown.edu>
2022-07-13Added non-standard Linux `SysconfVar` variantsSteven Engler
2022-07-12SigSet: Add the `repr(transparent)` attributeGerman Maglione
This commit adds the `repr(transparent)` attribute to the `SigSet` struct, to make sure that its representation is exactly like the `sigset_t` struct from C, in all cases. Signed-off-by: German Maglione <gmaglione@redhat.com>
2022-07-12SigSet: A new unsafe helper method to create a SigSet from a sigset_tGerman Maglione
Currently, the only way to create a `SigSet` from a `sigset_t` object is by using pointer casts, like: ``` unsafe { let sigset = *(&sigset as *const libc::sigset_t as *const SigSet) }; ``` This is un-ergonomic for library creators with interfaces to C. So, let's add a new unsafe method that creates a `SigSet` from a `libc::sigset_t` object. We can't implement `From` since converting from `libc::sigset_t` to `SigSet` is unsafe, because objects of type `libc::sigset_t` must be initialized by calling either `sigemptyset(3)` or `sigfillset(3)` before being used. In other case, the results are undefined. We can't implement `TryFrom` either, because there is no way to check if an object of type `libc::sigset_t` is initialized. Signed-off-by: German Maglione <gmaglione@redhat.com>
2022-07-11Merge #1759 #1760bors[bot]
1759: More docs for dir and mqueue r=rtzoeller a=asomers Add doc comments for the `dir` and `mqueue` modules. Also, delete dead code in `mqueue` 1760: Add const constructors for TimeSpec and TimeVal r=rtzoeller a=asomers These are basically the same as From<libc::timespec> and From<libc::timeval>, but they're const and require less typing. Co-authored-by: Alan Somers <asomers@gmail.com>
2022-07-11Merge #1757bors[bot]
1757: Clippy cleanup in the tests. r=rtzoeller a=asomers * Remove a redundant closure. Co-authored-by: Alan Somers <asomers@gmail.com>
2022-07-10Add const constructors for TimeSpec and TimeValAlan Somers
These are basically the same as From<libc::timespec> and From<libc::timeval>, but they're const and require less typing.
2022-07-10Merge #1752bors[bot]
1752: Add missing DontRoute SockOpt r=asomers a=leoleoasd I'm not sure, but according to [unix standard](https://pubs.opengroup.org/onlinepubs/7908799/xns/setsockopt.html), SO_DONTROUTE should appear in all unix systems. Does this need a test? Co-authored-by: Leo Lu <luyuxuanleo@gmail.com>
2022-07-11Added CHANGELOGLeo Lu
2022-07-11Add DontRoute SockOptLeo Lu
2022-07-10More docs for the dir moduleAlan Somers
2022-07-10More docs for mqueue.Alan Somers
Also, delete some dead code. It's always been dead.
2022-07-10Merge #1745bors[bot]
1745: Change gethostname to use a buffer of MaybeUninit values r=asomers a=nathaniel-daniel Changing `gethostname` to accept a buffer of `MaybeUninit` bytes allows the user to avoid needlessly initializing a buffer. This is a breaking API change. Co-authored-by: Nathaniel Daniel <nathaniel.daniel12@gmail.com>
2022-07-10Clippy cleanup in the tests.Alan Somers
* Remove a redundant closure. * Comparison with null * Manual implementation of find * Suppress a false positive
2022-07-07Merge #1756bors[bot]
1756: Fix clippy on nightly r=asomers a=rtzoeller Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-07-07Fix clippy on nightlyRyan Zoeller
2022-06-27Change gethostname to return an OsStringNathaniel Daniel
2022-06-27Change gethostname to use a buffer of MaybeUninit valuesNathaniel Daniel
2022-06-27Merge #1693bors[bot]
1693: Document aliases for functions like getuid() r=asomers a=rtzoeller Add the autocfg crate as a build dependency, and introduce `has_doc_alias` as a conditional compilation symbol. Closes #1673. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-06-26Document aliases for functions like getuid()Ryan Zoeller
Add the autocfg crate as a build dependency, and introduce has_doc_alias as a conditional compilation symbol.
2022-06-26Merge #1751bors[bot]
1751: Pin cross to 0.2.1, as 0.2.2 requires Rust 1.58.1 r=asomers a=rtzoeller Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-06-25Pin cross to 0.2.1, as 0.2.2 requires Rust 1.58.1Ryan Zoeller
2022-06-24Merge #1748bors[bot]
1748: Add format test to CI r=rtzoeller a=costinsin To enforce uniformity for all PRs, the CI checks if the code is formatted right using `cargo fmt` tool. Results after implementing the format test in CicleCI, but before fixing the format errors: https://cirrus-ci.com/build/4684991404703744 Results after fixing the format errors: https://cirrus-ci.com/build/5423803479097344 Solves #770 Co-authored-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-24Fix all formating problems to pass CI formating testCostin-Robert Sin
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-24Add format test to CICostin-Robert Sin
To enforce uniformity for all PRs, the CI checks if the code is formatted rigth using `cargo fmt` tool. Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-21Merge #1747bors[bot]
1747: Add getrusage wrapper r=rtzoeller a=kov Includes an enum to specify what to get resource usage for, and a new struct that provides a more readable view into libc::rusage, including using TimeVal for user and system CPU time. Signed-off-by: Gustavo Noronha Silva <gustavo@noronha.dev.br> Co-authored-by: Gustavo Noronha Silva <gustavo@noronha.dev.br>