summaryrefslogtreecommitdiff
path: root/src/sys/signal.rs
AgeCommit message (Collapse)Author
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)
2017-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-11-11Alphabetize some target_os configurationsWolfgang Ginolas
2017-11-05Use libc_enum! where possibleWolfgang Ginolas
Some enums which use different names for values than libc still set the discriminators manually. closes #254
2017-10-08Replace most Linux man page links with Open Group man page linksAlan Somers
But leave in place Linux links for non-standard functions. Also, add brief docs for some functions that were lacking them.
2017-08-17Merge #725bors[bot]
725: Match syntax of libc_bitflags! with bitflags! r=asomers Also update a couple of constant declarations while we're at it.
2017-08-16Match libc_bitflags! syntax to upstream bitflags!Bryant Mairs
2017-08-11Get rid of a lot of transmutesJonas Schievink
Most could be replaced by simple raw pointer casts (or even perfectly safe coercions!). cc #373
2017-08-05Add OpenBSD compatibility to signalsWesley Moore
2017-07-19Remove c_int and c_void from rootBryant Mairs
These were exported for some weird reason and then left in for documentation. Also some parts of certain modules used them and others used the libc:: prefix. This was removed to improve the docs and also code consistency
2017-07-08SIGSTKFLT doesn't exist on Linux/GNU/mips(64)Bryant Mairs
2017-07-04Allow nix to compile on android targetsroblabla