Age | Commit message (Collapse) | Author |
|
|
|
|
|
This is a minor optimization that allows for reduced sizes of datatypes. Since this pointer
will never be NULL, it's safe to use here
|
|
Abstract paths should always be N-1 in length where N is the length of
the `sun_path` field (first byte is \0). Given that,
`UnixAddr::new_abstract()` should always return this N-1 length, not
just the length of the string provided (the rest of the array will be
\0s).
|
|
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.
|
|
Support under bionic/android is the same as under Linux for what is exposed
by this code.
Signed-off-by: Paul Osborne <osbpau@gmail.com>
|
|
MSG_WAITALL can be useful with recv() to wait the full amount of data
requested.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
It's not sufficient to check for root privileges. In a container, the
euid may be root even though the user lacks some capabilities. Replace
this test's root check with a check for the CAP_NET_ADMIN capability
instead.
|
|
|
|
libc just changed the signedness of sigaction.sa_flags for Android.
https://github.com/rust-lang/libc/commit/841b3eb01644283c3c41ac1d1a2ddcec141f15f2
|
|
libc just undefined MADV_SOFT_OFFLINE on mips.
https://github.com/rust-lang/libc/pull/1365
Fixes #1074
|
|
|
|
|
|
|
|
Finish off the work started in 8c9ac5a70 allowing the use of macros
without needing to import local inner macros.
|
|
Just a minor typo in the docs of `O_RDWR`. It read:
```
/// Allow both reading and writing.
///
/// This should not be combined with `O_WRONLY` or `O_RDWR`.
O_RDWR;
```
but I believe it should read
```
/// Allow both reading and writing.
///
/// This should not be combined with `O_WRONLY` or `O_RDONLY`.
O_RDWR;
```
instead :-)
|
|
1050: Implement `sched_yield`. r=asomers a=sunfishcode
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.
Co-authored-by: Dan Gohman <sunfish@mozilla.com>
|
|
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.
|
|
|
|
libc just removed some symbols on linux/arm32 and linux/s390x that never
should've been defined in the first place.
https://github.com/rust-lang/libc/commit/24f8972b8d2d915b1687fc8197e1ed95e349a82e
https://github.com/rust-lang/libc/commit/d2695436ba5072078796c76f727a296e0f43caa6
|
|
received using recvmsg.
|
|
|
|
|
|
|
|
1044: Add unistd::{seteuid,setegid} r=asomers a=jmmv
This is for the benefit of those platforms that do not provide setresuid
nor setresgid, like macOS.
Co-authored-by: Julio Merino <julio@meroh.net>
|
|
1041: allow importing macros without helpers in the 2018 edition r=asomers a=euclio
~This PR adds the `$crate::` prefix to all uses of helper macros, which will allow users of the 2018 edition to import the macros without needing to also import their helpers.~
See https://doc.rust-lang.org/edition-guide/rust-2018/macros/macro-changes.html#macros-with-crate-prefix for more info.
~While this is a cleaner solution than using `#[macro_export(local_inner_macros)]`, it also requires bumping the minimum supported compiler version to 1.30. If this is acceptable, I'll add a commit to update the Travis configuration and docs.~
This PR now uses `local_inner_macros` to preserve compatibility with the current minimum Rust version.
Co-authored-by: Andy Russell <arussell123@gmail.com>
|
|
This is for the benefit of those platforms that do not provide setresuid
nor setresgid, like macOS.
|
|
|
|
This will allow users of the 2018 edition to import the macros without
needing to also import their helpers.
|
|
|
|
While ENOTSUP is defined as equal to EOPNOTSUPP on these platforms,
exposing the ENOTSUP symbol (as libc does) allows for writing portable
code that may want to reference this error code.
|
|
|
|
|
|
1016: Added inotify bindings. r=asomers a=vdagonneau
Hi !
I needed inotify bindings and noticed that nix did not have any so here is a PR to add it.
There was another PR from 2015 to add support for inotify that was never merged. I took some of the feedback and applied it here.
Co-authored-by: Vincent Dagonneau <vincentdagonneau@gmail.com>
|
|
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.
|
|
Several symbols are now marked as deprecated on OSX. Fix the build by
marking these symbols' Nix wrappers as deprecated, too.
|
|
|
|
This was an oversight from PR #1002
|
|
On some platforms the alignment of cmsg_data could be less than the
alignment of the messages that it contains. That led to unaligned
reads
on those platforms. This change fixes the issue by always copying the
message contents into aligned objects. The change is not 100%
backwards
compatible when using recvmsg. Users may have to replace code like
this:
```rust
if let ControlMessage::ScmRights(&fds) = cmsg {
```
with this:
```rust
if let ControlMessageOwned::ScmRights(fds) = cmsg {
```
Fixes #999
|
|
CmsgSpace had three problems:
1) It would oversize buffers that expect multiple control messages
2) It didn't use the libc CMSG_SPACE(3) macro, so it might actually
undersize a buffer for a single control message.
3) It could do bad things on drop, if you instantiate it with a type
that implements Drop (which none of the currently supported
ControlMessage types do).
Fixes #994
|
|
There were two problems:
1) It would always return Ok, even on error
2) It could panic if there was an error, because
sockaddr_storage_to_addr would be called on uninitialized memory.
|
|
Our hand-rolled logic had subtle alignment bugs that caused
test_scm_rights to fail on OpenBSD (and probably could cause problems on
other platforms too). Using cmsg(3) is much cleaner, shorter, and more
portable. No user-visible changes.
|
|
Most of the EventFlags have been renamed already, but Poll was the only one remaining. This commit fixes that.
Issue 317 https://github.com/nix-rust/nix/issues/317
|
|
Include IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
|
|
|
|
1) lutimes doesn't exist on OpenBSD so it needs to be under conditional
compilation.
The only "reference" that I could find related to this is the discussion
here: https://github.com/rust-lang/libc/pull/790 .
2) fexecve doesn't exist on OpenBSD so add conditional compilation for it
in unistd and in related tests.
The only "reference" that I could find is a mention that fexecve is
not implemented on OpenBSD in the manual pages for signal(3) and
sigaction(2):
Official repository (search for "fexecve"):
https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup
Github mirror:
https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619
3) AIO doesn't work on OpenBSD so put test_aio_drop under conditional
compilation.
4) Add relevant changelog entries.
P.S. On OpenBSD remains the issue of test_scm_rights which builds
correctly but fails at runtime.
|
|
Closes #476
|
|
|