Age | Commit message (Collapse) | Author |
|
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
|
|
|
|
|
|
And fix some documentation lints warned about by the newer rustdoc.
|
|
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
|
|
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>
|
|
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>
|
|
Add the autocfg crate as a build dependency, and introduce
has_doc_alias as a conditional compilation symbol.
|
|
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
|
|
* enabled as much functionality and defines that match
updated libc definitions for haiku
|
|
|
|
|
|
|
|
This commit adds support for the signal timer mechanism in POSIX, the
mirror to timerfd on Linux.
Resolves #1424
Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
|
|
|
|
Using features reduces build time and size for consumer crates. By
default all features are enabled.
|
|
This has previously been done for `killpg`, but not `kill` it seems.
|
|
And this time, start running Clippy in CI
|
|
Because nothing uses it on those OSes.
|
|
Also, test rustdoc in CI, and demote missing_docs from a deny to a
warning (but still deny it in CI).
|
|
Switch from allow(missing_docs) to deny(missing_docs), which should
gradually help us moving forward. Also, add a few missing docs, such as
for sched and aio.
|
|
Constify more functions, since we're raising the MSRV from 1.41.0 to
1.46.0.
Fixes #1477
|
|
1484: Optionally implement TryFrom in libc_enum! r=asomers a=asomers
This saves code in several separate places that need to do this
separately. At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.
Issue #373
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
This saves code in several separate places that need to do this
separately. At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.
Issue #373
|
|
Issue #373
|
|
1473: sys/stat: add a safe wrapper for mknodat(2) r=asomers a=lucab
This introduces a new `mknodat` helper.
Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
1474: Mark most C-derived enums as non_exhaustive r=asomers a=asomers
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
1476: Constify many functions r=asomers a=asomers
Constify most functions that can be constified. The exceptions are
mostly accessors for structs that have no const constructor.
Co-authored-by: Luca BRUNO <luca.bruno@coreos.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
Constify most functions that can be constified. The exceptions are
mostly accessors for structs that have no const constructor.
|
|
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
|
|
For many of Nix's consumers it be convenient to easily convert a Nix
error into a std::io::Error. That's currently not possible because of
the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have
no equivalent in std::io::Error.
However, very few of Nix's public APIs actually return those unusual
errors. So a more useful API would be for Nix's standard error type to
implement Into<std::io::Error>.
This commit makes Error a simple NewType around Errno. For most
functions it's a drop-in replacement. There are only three exceptions:
* clearenv now returns a bespoke error type. It was the only Nix
function whose error couldn't be cleanly mapped onto an Errno.
* sys::signal::signal now returns Error(Errno::ENOTSUP) instead of
Error::UnsupportedOperation when the user passes an incompatible
argument to `handler`.
* When a NixPath exceeds PATH_MAX, it will now return
Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath.
In the latter two cases there is now some abiguity about whether the
error code was generated by Nix or by the OS. But I think the ambiguity
is worth it for the sake of being able to implement Into<io::Error>.
This commit also introduces Error::Sys() as a migration aid. Previously
that as an enum variant. Now it's a function, but it will work in many
of the same contexts as the original.
Fixes #1155
|
|
Beginning with 1.41.0, Rust considers it UB to zero-initialize a
function pointer, even if you try to hide it behind `mem::MaybeUninit`.
Suppress this warning to fix the build until we come up with a better
permanent solution.
Issue #1441
|
|
|
|
Allow nix to compile on Fuchsia by conditionally avoiding libc
functionality that does not exist for Fuchsia.
|
|
|
|
- Make sure all tests pass the CI
- Redox does not (yet) have passwd functions, so remove it
|
|
|
|
|
|
Some things are not implemented yet in redox, so a lot of annotations
were added to remove functions when compiling for redox. Those functions
will hopefully be added in time, but for now it's better to have partial
support than none.
Blocked by https://github.com/rust-lang/libc/pull/1438
|
|
|
|
TryFrom wasn't stable when that function was written.
|
|
Only two instances remain:
* For the deprecated sys::socket::CmsgSpace::new. We should probably
just remove that method.
* For sys::termios::Termios::default_uninit. This will require some
more thought.
Fixes #1096
|
|
|
|
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all
traits are supported by all types, which is why many are missing
some.
|
|
libc just changed the signedness of sigaction.sa_flags for Android.
https://github.com/rust-lang/libc/commit/841b3eb01644283c3c41ac1d1a2ddcec141f15f2
|
|
|
|
It was disabled long ago and nobody remembered to reenable it. I'm
guessing it's fixed by now.
|
|
|
|
Previous versions of Cargo would create and destroy a new thread for
each test. Cargo 1.33.0 instead creates a thread pool and reuses the
same thread for multiple tests. Some Nix tests that changed the
per-thread sigmask began to fail as a result, because they didn't do any
cleanup.
The easiest solution is to spawn a new thread for each of those tests.
|
|
Closes #476
|
|
try! is not available in Rust 2018
|
|
|