summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-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>
2022-06-20Add getrusage wrapperGustavo Noronha Silva
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.
2022-06-19Merge #1746bors[bot]
1746: Fix typo and minimise the use of `unsafe` blocks inside the `pipe` function r=rtzoeller a=costinsin Some of the operations inside the pipe function are safe and should not be included inside an unsafe block. Co-authored-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-19Minimise the use of the unsafe block inside pipe functionCostin-Robert Sin
Some of the operations inside the pipe function are safe and should not be included inside an unsafe block. Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-19Fix typo by adding a semicolonCostin-Robert Sin
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-09Merge #1739bors[bot]
1739: ppoll: make sigmask parameter optional r=rtzoeller a=stefano-garzarella ppoll(2) supports 'sigmask' as NULL. In that case no signal mask manipulation is performed. Let's make `sigmask` parameter of `nix::poll::ppoll` optional to allow that behaviour. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Co-authored-by: Stefano Garzarella <sgarzare@redhat.com>
2022-06-09ppoll: make sigmask parameter optionalStefano Garzarella
ppoll(2) supports 'sigmask' as NULL. In that case no signal mask manipulation is performed. Let's make `sigmask` parameter of `nix::poll::ppoll` optional to allow that behaviour. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2022-06-09Merge #1736bors[bot]
1736: Fix socket address family checks r=rtzoeller a=qwandor The `SockaddrLike::from_raw` implementations for `VsockAddr` and `SysControlAddr` were checking against the wrong address family constant. This PR makes them consistent with the values matched against in `SockaddrStorage::from_raw`. Co-authored-by: Andrew Walbran <qwandor@google.com>
2022-06-09Merge #1735bors[bot]
1735: Cleanup cfg blocks r=asomers a=rtzoeller Remove obsolete references to target_env = wasi, target_os = nacl, target_os = osx, and a typo'd target_os = fushsia that didn't compile when fixed. - target_env = wasi is dead: https://github.com/rust-lang/rust/pull/60117 - target_os = nacl is dead: https://github.com/rust-lang/rust/pull/45041 - target_os = osx is dead, but I can't find a link. Found while exploring `--check-cfg`, as mentioned in #1734. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-06-09Merge #1737bors[bot]
1737: Fix the test_acct test r=rtzoeller a=asomers It has never actually executed its command, so the only reason that it ever worked is that on most systems there are usually processes starting and exiting all the time. Co-authored-by: Alan Somers <asomers@gmail.com>
2022-06-07Fix the test_acct testAlan Somers
It has never actually executed its command, so the only reason that it ever worked is that on most systems there are usually processes starting and exiting all the time.
2022-06-07Mention fix in changelog.Andrew Walbran
2022-06-07Fix socket address family check for SysControlAddr::from_raw.Andrew Walbran
2022-06-07Fix socket address family check for VsockAddr::from_raw.Andrew Walbran
2022-06-06Cleanup cfg blocksRyan Zoeller
Remove obsolete references to target_env = wasi, target_os = nacl, target_os = osx, and a typo'd target_os = fushsia that didn't compile when fixed. - target_env = wasi is dead: https://github.com/rust-lang/rust/pull/60117 - target_os = nacl is dead: https://github.com/rust-lang/rust/pull/45041 - target_os = osx is dead, but I can't find a link.
2022-05-31Merge #1729bors[bot]
1729: Enable SockaddrStorage::{as_link_addr, as_link_addr_mut} on Linux. r=rtzoeller a=asomers This was an oversight from #1684. Fixes #1728 Co-authored-by: Alan Somers <asomers@gmail.com>
2022-05-31Merge #1730bors[bot]
1730: Ignore doctests for unexported macros r=asomers a=zombiepigdragon Due to rust-lang/rust#97030, cargo test will fail to doctest macros unless they are exported, breaking the examples for `libc_bitflags!` and `libc_enum!`. Adds `ignore` to the examples for these macros to stop tests from failing. `cargo test` already fails on cargo 1.62.0-beta.2, and the above issue makes it seem unlikely that this will be changed on the Rust side. If rust-lang/rust#96630 *does* get reverted, this PR can be closed/unmerged, although the test wasn't running beforehand, and it might be worth making this explicit regardless. Co-authored-by: Alex Rawson <ajzecrom@gmail.com>
2022-05-31Ignore doctests for unexported macrosAlex Rawson
Due to rust-lang/rust#97030, cargo test will fail to doctest macros unless they are exported, breaking the examples for libc_bitflags! and libc_enum!. Adds `ignore` to the examples for these macros to stop tests from failing.
2022-05-31Enable SockaddrStorage::{as_link_addr, as_link_addr_mut} on Linux.Alan Somers
This was an oversight from #1684. Fixes #1728
2022-05-30Merge #1727bors[bot]
1727: Add From<uid_t> and From<gid_t> r=rtzoeller a=vkkoskie Conversions to/from primitive uid_t and gid_t to newtype Uid and Gid types are valid and infallible, but are only implemented in one direction. This provides the counterparts in the other direction. These conversions are identical in behavior to the from_raw methods. However, using the more idiomatic From trait enables easier interoperability with other crates (e.g., deserialization with serde) Co-authored-by: Keith Koskie <vkkoskie@gmail.com>
2022-05-30Add infallible conversion from uid_t and gid_tKeith Koskie
Implements the following traits: * From<uid_t> for Uid * From<gid_t> for Gid
2022-05-30Merge #1725bors[bot]
1725: Use released libc version 0.2.126 r=rtzoeller a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2022-05-30Merge #1726bors[bot]
1726: Clippy cleanup for latest nightly r=rtzoeller a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2022-05-29Clippy cleanup for latest nightlyAlan Somers
2022-05-29Use released libc version 0.2.126Alan Somers
2022-05-16Merge #1722bors[bot]
1722: Fix nightly clippy in tests r=asomers a=rtzoeller `cargo +nightly clippy --tests` currently produces ``` warning: this let-binding has unit value --> test/sys/test_uio.rs:256:20 | 256 | loop { let _ = pause(); } | ^^^^^^^^^^^^^^^^ help: omit the `let` binding: `pause();` | = note: `#[warn(clippy::let_unit_value)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value ``` Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>