Age | Commit message (Collapse) | Author |
|
Constify most functions that can be constified. The exceptions are
mostly accessors for structs that have no const constructor.
|
|
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
|
|
|
|
Add a note in the documentation for sched::clone to point out that the
stack pointer does not neet to be a reference to the highest address of
the stack.
Users who simply read the manpages for clone(2) might assume that they
will need to use unsafe pointer arithmetics in order to create a
reference to the highest address of their buffer, rather than providing
their buffer directly.
|
|
|
|
|
|
|
|
|
|
sched_getaffinity(2) get a process's CPU affinity mask
|
|
* Replace obsolete range syntax "..." with inclusive range "..="
* Use dyn Trait syntax instead of Box<Trait>
* Raise MSRV to 1.27.0 (for dyn Trait syntax)
* Raise MSRV to 1.31.0 (because of rand)
tempfile pulls in rand, and rand pulls in fuchsia-cprng, which requires
1.31.0. Why rand pulls in fuchsia-cprng I don't know. It's specified
as a target-specific dependency, but Cargo tries to build it anyway
(only on Linux, not on FreeBSD or OSX). A bug in Cargo 1.27.0?
|
|
|
|
|
|
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.
|
|
This adds the `sched_yield` function, which is part of POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html
and widely implemented on Unix-family platforms.
|
|
|
|
|
|
cc #664 (unsure if this is everything needed)
|
|
|
|
725: Match syntax of libc_bitflags! with bitflags! r=asomers
Also update a couple of constant declarations while we're at it.
|
|
|
|
Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).
cc #373
|
|
|
|
The officially documented type, and the type in sched.h, for this
argument is pid_t.
|
|
|
|
|
|
|
|
|
|
|
|
This is necessary because of compiler changes. For further information
look at rust-lang/rust#19925.
|
|
Closes #300
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In fact function returns pid of new process (or tid of new thread)
|
|
The limit of 32 cores may not actually be a limit with arm-linux, but
I am not aware of anything in excess of 32 processors out there currently
and this is what I have been running for awhile now on a beaglebone
black (`--target=arm-unknown-linux-gnueabihf`).
This change addresses #95 and relates to #97.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Updated array syntax
- task_rng -> thread_rng
|
|
|
|
|