Age | Commit message (Collapse) | Author |
|
`ptsname()` mutates global variables and mutating global variables is
always considered `unsafe` by Rust.
Reference:
https://github.com/nix-rust/nix/pull/742#issuecomment-324385919
|
|
This adds fexecve() to `nix::unistd`. It is available in libc since 0.2.29.
Ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
|
|
700: Get rid of a lot of transmutes r=asomers
Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).
cc #373
|
|
701: Calculate `nfds` parameter for `select` r=asomers
Doing this behind the scenes makes the API less error-prone and easier
to use. It should also fix my issue in https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
|
|
Most could be replaced by simple raw pointer casts (or even perfectly
safe coercions!).
cc #373
|
|
Doing this behind the scenes makes the API less error-prone and easier
to use. It should also fix https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
|
|
|
|
688: Support for OpenBSD r=Susurrus
Fixes #685
These changes get nix building on OpenBSD 6.1. There is one failing test that I want a little guidance on:
```
error[E0308]: mismatched types
--> src/sys/event.rs:333:30
|
333 | assert!(expected.data == actual.data());
| ^^^^^^^^^^^^^ expected i64, found isize
```
`KEvent::data` is:
```
pub fn data(&self) -> intptr_t {
self.kevent.data as intptr_t
}
```
I assume the test should be updated to cast to the expected type but wanted to confirm that before making the change.
|
|
|
|
There appears to be some interaction with test_pathconf_limited and
another one when they are run in parallel, causing it to return ENOENT
so the path has been changed from . to /.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
672: add poll module in Android r=Susurrus
`poll` functions are defined in Android as well.
libc is missing some constant, but once rust-lang/libc#663 is merged, it'll be good to merge here.
Closes #711
|
|
|
|
These include:
* PTRACE_TRACEME
* PTRACE_CONT
* PTRACE_ATTACH
* PTRACE_SYSCALL
|
|
|
|
|
|
These are assumed to be QEMU issues, as they also fail on mips.
|
|
Note that ptrace isn't documented as signal-safe, but it's supposed to
just be a light syscall wrapper, so it should be fine.
|
|
|
|
Some tests were invoking non-async-signal-safe functions from the child
process after a `fork`. Since they might be invoked in parallel, this
could lead to problems.
|
|
|
|
|
|
The recommended way to trace syscalls with ptrace is to set the
PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from
receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return
SIGTRAP | 0x80, but nix wants to parse that as an actual signal.
Add another wait status type for syscall stops (in the language of the
ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are
different things), and mask out bit 0x80 from signals before trying to
parse it.
Closes #550
|
|
|
|
|
|
ptsname(3) returns a pointer to a global variable, so it isn't
thread-safe. Protect it with a mutex.
|
|
Instead of relying on the macro user to calculate the length in bytes
do that within the macro itself
|
|
|
|
There two different write semantics used with ioctls: one involves
passing a pointer the other involves passing an int. Previously the
ioctl! macro did not distinguish between these cases and left it up
to the user to set the proper datatype. This previous version was
not type safe and prone to errors. The solution here is to split the
"write" variant into a "write_ptr" and "write_int" variant that makes
the semantics more explicit and improves type safety by specifying
arguments better.
|
|
|
|
|
|
These are assumed to be QEMU issues, as they also fail on mips.
|
|
693: fix some tests for Android r=asomers
I tested the crate on an Android emulator and quite all the tests passed. Only 6 were failing.
> failures:
>
> ---- sys::test_pthread::test_pthread_self stdout ----
> thread 'sys::test_pthread::test_pthread_self' panicked at 'assertion failed: tid > 0', test/sys/test_pthread.rs:6
> note: Run with `RUST_BACKTRACE=1` for a backtrace.
>
> ---- sys::test_socket::test_getsockname stdout ----
> thread 'sys::test_socket::test_getsockname' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859
>
> ---- sys::test_socket::test_unixdomain stdout ----
> thread 'sys::test_socket::test_unixdomain' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859
>
> ---- sys::test_termios::test_local_flags stdout ----
> thread 'sys::test_termios::test_local_flags' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:329
>
> ---- test_net::test_if_nametoindex stdout ----
> thread 'test_net::test_if_nametoindex' panicked at 'assertion failed: if_nametoindex(&LOOPBACK[..]).is_ok()', test/test_net.rs:11
>
> ---- test_unistd::test_mkstemp stdout ----
> thread 'test_unistd::test_mkstemp' panicked at 'mkstemp failed: ENOENT: No such file or directory', test/test_unistd.rs:73
This PR fixes 3 of those:
- `test_pthread_self`: pthread_t is unsigned, so it can be negative (and it is often the case)
- `test_if_nametoindex`: constant `LOOPBACK` is the same than on Linux
- `test_mkstemp`: directory `/tmp` does not exist in Android
Two are still failing (`test_unixdomain` and `test_getsockname`) because we need some special permissions on Android for playing with sockets. On a rooted physical device, they passed. So, if tests for Android are integrated in CI, we should try to embed the tests to run in an APK with requested permissions or find a way to give the permission to a native program.
`test_local_flags` is still failing also because `O_LARGEFILE` is hardcoded and is not the right value in Android. Then `fcntl::OFlag::from_bits(flags).unwrap()` fails because this flag is then not recognised.
I made a PR in `libc` so that we can rely on libc definitions for all `O_*` flags. (rust-lang/libc#683)
Do you prefer to wait for this one to be fixed for this PR to merged as well ?
|
|
661: Allow doc attributes in ioctl r=asomers
fixes #571 . Note that this is a breaking change because it also changes
```
ioctl!(some_name with 12);
```
to
```
ioctl!(bad some_name with 12);
```
This is to work around a bug in the rust compiler whereby rules around matching idents are overly strict. See https://github.com/rust-lang/rust/issues/24189
It doesn't break anything else though.
|
|
Note that ptrace isn't documented as signal-safe, but it's supposed to
just be a light syscall wrapper, so it should be fine.
|
|
|
|
Some tests were invoking non-async-signal-safe functions from the child
process after a `fork`. Since they might be invoked in parallel, this
could lead to problems.
|
|
|
|
|
|
|
|
The recommended way to trace syscalls with ptrace is to set the
PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from
receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return
SIGTRAP | 0x80, but nix wants to parse that as an actual signal.
Add another wait status type for syscall stops (in the language of the
ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are
different things), and mask out bit 0x80 from signals before trying to
parse it.
Closes #550
|
|
Fix thread safety issues in pty and termios tests
|
|
|