Age | Commit message (Collapse) | Author |
|
This was an oversight from 974320d09fbd1fae79da537383c2144ed9aa4967
|
|
* kmod tests must run exclusively, because they load and unload a module
with a constant name.
* A few tests were doing some variant of chdir, but weren't taking the
CWD_MTX.
* The kmod tests read files by path relative to CWD, so they need the
CWD_MTX. But they don't need it exclusively, so convert the CWD_MTX
into an RwLock.
* Tests that do change the cwd need to change it back when they're done.
|
|
* On Linux, it requires the CAP_SYS_PACCT capability.
* Reenable the test on FreeBSD, because our FreeBSD CI environment is no
longer jailed (since we switched from BuildBot to CirrusCI), but check
at runtime whether the process is jailed.
* test_acct needs the FORK_MTX because it uses Command::new .
* Fix a race condition. acct(2) isn't synchronous. It starts a kernel
thread but does not wait for it to become ready. Fix it by running
the test command within the polling loop.
|
|
It's not sufficient to check for root privileges, because a
containerized process may have root's euid but still lack important
capabilities. Fix these tests by checking for the CAP_SYS_MOD
capability.
|
|
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.
|
|
On musl, pthread_t is a pointer type.
|
|
received using recvmsg.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
993: Don't reference packed structs. r=asomers a=pusateri
Fixes #992.
Don't merge this yet. I have more testing to do. I just am pushing it up for others.
Co-authored-by: Tom Pusateri <pusateri@bangj.com>
|
|
990: Add cmsg PKTINFO for IPv4 and IPv6. r=asomers a=pusateri
Replaces #891 and attempts to address all previous concerns.
Co-authored-by: Tom Pusateri <pusateri@bangj.com>
|
|
Some tests have been disabled and will need further review.
|
|
ignore pktinfo tests on qemu mips,mips64,powerpc64
Original work by @mcginty.
|
|
|
|
|
|
977: Error as i32 r=asomers a=asomers
Add Error::as_errno
This method is useful when it can be statically determined that a nix::Error be an errno, which I find to be very common.
Also, fix some recently introduced compiler warnings.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
967: Add a wrapper for lutimes(2) r=asomers a=jmmv
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
This should have been part of PR #946, which added a wrapper for
utimes(2) following this same rationale, but missed lutimes(2) because
I simply didn't notice it existed.
Co-authored-by: Julio Merino <julio@meroh.net>
|
|
|
|
|
|
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
This should have been part of PR #946, which added a wrapper for
utimes(2) following this same rationale, but missed lutimes(2) because
I simply didn't notice it existed.
|
|
This patch adds a wrapper for the acct(2) syscall, with two functions
for enabling and disabling process accounting.
|
|
* Moved ptrace API into it's own module with cfg'ed modules exported for linux/android or BSDs.
* Replicated current linux API for BSD
* Added API functions to peek and poke memory to avoid needing to replicate deprecated linux API and remaining feature complete
* Added helper function for `PTRACE_KILL` requests
* Updated tests based on new API changes
* Added addition kill calls to `test_ptrace_cont` as inferior death doesn't happen immediately on OSX which caused issues in the tests.
|
|
These are mostly to ensure that all the platforms we care about in our
CI can reference these primitives.
|
|
This also adds a test for truncate (obviously) but, while doing so, also
adds a test for the already-existing ftruncate.
|
|
|
|
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2),
but unfortunately these APIs are not available on old-ish systems.
In particular, macOS Sierra and below don't implement them, making the
new APIs unusable. Whether we should care about such "old" systems is
debatable, but the problem is that, at the moment, this is the only
macOS version usable on Travis to test kexts and, thus, to test FUSE
file systems.
|
|
|
|
- init_module and finit_module to load kernel modules
- delete_module to unload kernel modules
Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
|
|
This macro can be used in tests to skip the test if it requires root to sucssfully run.
|
|
|
|
This avoids having both 0.4 and 0.5 (required by tempfile)
|
|
This is a lower-level interface than `std::fs::ReadDir`. Notable differences:
* can be opened from a file descriptor (as returned by `openat`, perhaps
before knowing if the path represents a file or directory). Uses
`fdopendir` for this, available on all Unix platforms as of
rust-lang/libc#1018.
* implements `AsRawFd`, so it can be passed to `fstat`, `openat`, etc.
* can be iterated through multiple times without closing and reopening the
file descriptor. Each iteration rewinds when finished.
* returns entries for `.` (current directory) and `..` (parent directory).
* returns entries' names as a `CStr` (no allocation or conversion beyond
whatever libc does).
|
|
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
|
|
|
918: Fix passing multiple file descriptors / control messages via sendmsg r=asomers a=jonas-schievink
Fixes #464
Closes #874 because it's incorporated here
Closes #756 because it adds the test from that issue (with fixes)
Co-authored-by: alecmocatta <alec@mocatta.net>
|
|
|
|
|
|
|
|
|
|
Rather than using the native implementation of these constants
on supported platforms, the native implementation was instead
emulated. This was also hidden from the user even though this
could result in data races and the functionality being broken.
Native functionality is, however, not support on macos/ios.
Rather than enable this emulation solely for this platform, it
should be removed as this is a dangerous abstraction.
|