summaryrefslogtreecommitdiff
path: root/src/sys/signal.rs
AgeCommit message (Collapse)Author
2021-12-30Introduce timer_* supportBrian L. Troutwine
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>
2021-12-26Fix typosRyan Zoeller
2021-12-20feature-gate most Nix functionsVincent Dagonneau
Using features reduces build time and size for consumer crates. By default all features are enabled.
2021-11-26Update doc comment to match type `Option<Signal>`Johannes Schilling
This has previously been done for `killpg`, but not `kill` it seems.
2021-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
2021-09-04Remove SigevNotify on OpenBSD and RedoxAlan Somers
Because nothing uses it on those OSes.
2021-09-04Document more thingsAlan Somers
Also, test rustdoc in CI, and demote missing_docs from a deny to a warning (but still deny it in CI).
2021-08-28More rust docsAlan Somers
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.
2021-08-13constify more functionsAlan Somers
Constify more functions, since we're raising the MSRV from 1.41.0 to 1.46.0. Fixes #1477
2021-08-11Merge #1484bors[bot]
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>
2021-08-09Optionally implement TryFrom in libc_enum!Alan Somers
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
2021-08-09Replace some mem::transmute calls in signal.rs with pointer castsAlan Somers
Issue #373
2021-07-29Merge #1473 #1474 #1476bors[bot]
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>
2021-07-24Constify many functionsAlan Somers
Constify most functions that can be constified. The exceptions are mostly accessors for structs that have no const constructor.
2021-07-24Mark most C-derived enums as non_exhaustiveAlan Somers
Since libc may add new variants at any time, Nix's consumers should not use exhaustive match patterns. Fixes #1182
2021-07-07Overhaul Nix's error typesAlan Somers
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
2021-05-30Suppress a build warning on FuchsiaAlan Somers
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
2021-05-13Use https instead of httpRyan Zoeller
2020-12-19Add fuchsia supportAmanda Tait
Allow nix to compile on Fuchsia by conditionally avoiding libc functionality that does not exist for Fuchsia.
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-17Fix test and remove group & user for redoxXavier L'Heureux
- Make sure all tests pass the CI - Redox does not (yet) have passwd functions, so remove it
2020-05-17Add wait, fdatasync, poll and pause for RedoxXavier L'Heureux
2020-05-17Remove more unsupported functions and make it possible to run testsXavier L'Heureux
2020-05-17Add Redox support for most of the modulesXavier L'Heureux
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
2019-10-29Implement Signal::as_str()Mikail Bagishov
2019-09-04Replace Signal::from_c_int by Signal::try_fromAlan Somers
TryFrom wasn't stable when that function was written.
2019-09-03Replace most instances of mem::uninitialized with mem::MaybeUninitAlan Somers
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
2019-08-29Clippy cleanupAlan Somers
2019-06-09Add extra traits for all typesBryant Mairs
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.
2019-06-02Fix build on Android with recent libcAlan Somers
libc just changed the signedness of sigaction.sa_flags for Android. https://github.com/rust-lang/libc/commit/841b3eb01644283c3c41ac1d1a2ddcec141f15f2
2019-03-16feat: Add killpgDanSnow
2019-03-03Reenable test_sigwait on OSXAlan Somers
It was disabled long ago and nobody remembered to reenable it. I'm guessing it's fixed by now.
2019-03-03Delete a useless unit test that never did anything.Alan Somers
2019-03-03Fix test_thread_signal* test failures with Cargo 1.33.0Alan Somers
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.
2019-01-13Implement nix wrapper for libc::signalRobert Gardner
Closes #476
2018-12-08Replace try! with ?Alan Somers
try! is not available in Rust 2018
2018-12-01Fix missing SIGSTKFLT on sparc64-linuxBryant Mairs
2018-09-05Merge #884bors[bot]
884: impl FromStr for sys::Signal r=Susurrus a=quodlibetor This implements both ALLCAPS and lowercase full name (including SIG) and short name. This matches what `kill` accepts in many shells, and it also allows the `Debug` representation of `Signal`, which means it can be round-tripped, if desired. Co-authored-by: Brandon W Maister <quodlibetor@gmail.com>
2018-09-04impl FromStr and Display for sys::SignalBrandon W Maister
This is a subset of what `kill` accepts in many shells. The Display implementation matches the `Debug` representation of `Signal`. The `FromStr` matches both Debug/Display which means it can be round-tripped, if desired.
2018-05-05Add documentation to signal-handling functionsRoss Light
2018-03-02Change SigAction::flags to use from_bits_truncatedAntti Keränen
On Linux, if the signal trampoline code is in the C library, sigaction sets the SA_RESTORER flag (0x04000000) in the sa_flags field of old sigaction (see sigreturn(2)). This is not intended for application use and is missing from SaFlags, therefore from_bits fails and unwrapping panics the user program. This fix just drops the bits that are not defined in SaFlags.
2018-01-28Require Debug impls for all typesBryant Mairs
2018-01-28Implement Copy/Clone for all types missing itBryant Mairs
2018-01-06Add sigprocmaskThomas de Zeeuw
2017-12-20Replace boolean match with if/elseBryant Mairs
2017-12-20Don't clone Copy typesBryant Mairs
2017-12-20Remove redundant closureBryant Mairs
2017-12-20Use backticks around types/functions in docsBryant Mairs
2017-12-20Dereference in match head insteadBryant Mairs
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)