Skip to content

Commit 578ba1d

Browse files
Merge branch 'nix-rust:master' into freebsd-fix
2 parents ed33507 + 055818a commit 578ba1d

16 files changed

+74
-79
lines changed

.cirrus.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ cargo_cache:
55
env:
66
# Build by default; don't just check
77
BUILD: build
8-
CLIPPYFLAGS: -D warnings
98
RUSTFLAGS: -D warnings
109
RUSTDOCFLAGS: -D warnings
1110
TOOL: cargo
@@ -19,7 +18,7 @@ build: &BUILD
1918
- . $HOME/.cargo/env || true
2019
- $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets
2120
- $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET
22-
- $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET -- $CLIPPYFLAGS
21+
- $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET -- -D warnings
2322

2423
# Tests that do require executing the binaries
2524
test: &TEST
@@ -224,9 +223,9 @@ task:
224223
env:
225224
TARGET: x86_64-unknown-redox
226225
# Redox requires a nightly compiler.
227-
# If stuff breaks, change nightly to the date in the toolchain_*
228-
# directory at https://static.redox-os.org
229-
TOOLCHAIN: nightly-2020-08-04
226+
# If stuff breaks, change nightly to the date at
227+
# https://gitlab.redox-os.org/redox-os/redox/-/blob/master/rust-toolchain
228+
TOOLCHAIN: nightly-2021-06-15
230229
setup_script:
231230
- rustup target add $TARGET
232231
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
@@ -240,16 +239,16 @@ task:
240239
image: rustlang/rust:nightly
241240
env:
242241
BUILD: check
243-
# Must allow here rather than in lib.rs because this lint doesn't exist
244-
# prior to Rust 1.57.0
245-
# https://github.com/rust-lang/rust-clippy/issues/7718
246-
CLIPPYFLAGS: -D warnings -A clippy::if_then_panic
247242
TOOLCHAIN: nightly
248243
ZFLAGS: -Zbuild-std
249244
matrix:
250245
- name: DragonFly BSD x86_64
251246
env:
252247
TARGET: x86_64-unknown-dragonfly
248+
# Temporarily allow deprecation on DragonflyBSD until an alternative is
249+
# available.
250+
#https://github.com/rust-lang/libc/pull/2522
251+
RUSTFLAGS: -D warnings -A deprecated
253252
- name: OpenBSD x86_64
254253
env:
255254
TARGET: x86_64-unknown-openbsd

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["The nix-rust Project Developers"]
77
repository = "https://github.com/nix-rust/nix"
88
license = "MIT"
99
categories = ["os::unix-apis"]
10-
include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md"]
10+
include = ["src/**/*", "test/**/*", "LICENSE", "README.md", "CHANGELOG.md"]
1111

1212
[package.metadata.docs.rs]
1313
targets = [
@@ -38,6 +38,7 @@ cc = "1"
3838
[dev-dependencies]
3939
assert-impl = "0.1"
4040
lazy_static = "1.2"
41+
parking_lot = "0.11.2"
4142
rand = "0.8"
4243
tempfile = "3.2.0"
4344
semver = "1.0.0"

src/sys/signal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,8 @@ pub fn sigprocmask(how: SigmaskHow, set: Option<&SigSet>, oldset: Option<&mut Si
868868
/// is sent to all processes exclusing system processes.
869869
/// - If less than `-1`, the signal is sent to all processes whose
870870
/// process group ID is equal to the absolute value of `pid`.
871-
/// * `signal` - Signal to send. If 0, error checking if performed but no
872-
/// signal is actually sent.
871+
/// * `signal` - Signal to send. If `None`, error checking is performed
872+
/// but no signal is actually sent.
873873
///
874874
/// See Also
875875
/// [`kill(2)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html)

src/unistd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,10 @@ pub fn pipe() -> std::result::Result<(RawFd, RawFd), Error> {
10751075
/// The following flags are supported, and will be set atomically as the pipe is
10761076
/// created:
10771077
///
1078-
/// `O_CLOEXEC`: Set the close-on-exec flag for the new file descriptors.
1079-
#[cfg_attr(target_os = "linux", doc = "`O_DIRECT`: Create a pipe that performs I/O in \"packet\" mode. ")]
1080-
#[cfg_attr(target_os = "netbsd", doc = "`O_NOSIGPIPE`: Return `EPIPE` instead of raising `SIGPIPE`. ")]
1081-
/// `O_NONBLOCK`: Set the non-blocking flag for the ends of the pipe.
1078+
/// - `O_CLOEXEC`: Set the close-on-exec flag for the new file descriptors.
1079+
#[cfg_attr(target_os = "linux", doc = "- `O_DIRECT`: Create a pipe that performs I/O in \"packet\" mode.")]
1080+
#[cfg_attr(target_os = "netbsd", doc = "- `O_NOSIGPIPE`: Return `EPIPE` instead of raising `SIGPIPE`.")]
1081+
/// - `O_NONBLOCK`: Set the non-blocking flag for the ends of the pipe.
10821082
///
10831083
/// See also [pipe(2)](https://man7.org/linux/man-pages/man2/pipe.2.html)
10841084
#[cfg(any(target_os = "android",

test/sys/test_aio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ extern fn sigfunc(_: c_int) {
406406
#[test]
407407
#[cfg_attr(any(all(target_env = "musl", target_arch = "x86_64"), target_arch = "mips", target_arch = "mips64"), ignore)]
408408
fn test_write_sigev_signal() {
409-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
409+
let _m = crate::SIGNAL_MTX.lock();
410410
let sa = SigAction::new(SigHandler::Handler(sigfunc),
411411
SaFlags::SA_RESETHAND,
412412
SigSet::empty());
@@ -544,7 +544,7 @@ fn test_liocb_listio_nowait() {
544544
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
545545
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64", target_env = "musl"), ignore)]
546546
fn test_liocb_listio_signal() {
547-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
547+
let _m = crate::SIGNAL_MTX.lock();
548548
const INITIAL: &[u8] = b"abcdef123456";
549549
const WBUF: &[u8] = b"CDEF";
550550
let mut rbuf = vec![0; 4];

test/sys/test_ptrace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn test_ptrace_cont() {
6969

7070
require_capability!("test_ptrace_cont", CAP_SYS_PTRACE);
7171

72-
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
72+
let _m = crate::FORK_MTX.lock();
7373

7474
// FIXME: qemu-user doesn't implement ptrace on all architectures
7575
// and retunrs ENOSYS in this case.
@@ -127,7 +127,7 @@ fn test_ptrace_interrupt() {
127127

128128
require_capability!("test_ptrace_interrupt", CAP_SYS_PTRACE);
129129

130-
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
130+
let _m = crate::FORK_MTX.lock();
131131

132132
match unsafe{fork()}.expect("Error: Fork Failed") {
133133
Child => {
@@ -173,7 +173,7 @@ fn test_ptrace_syscall() {
173173

174174
require_capability!("test_ptrace_syscall", CAP_SYS_PTRACE);
175175

176-
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
176+
let _m = crate::FORK_MTX.lock();
177177

178178
match unsafe{fork()}.expect("Error: Fork Failed") {
179179
Child => {

test/sys/test_select.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ use nix::sys::time::{TimeSpec, TimeValLike};
55

66
#[test]
77
pub fn test_pselect() {
8-
let _mtx = crate::SIGNAL_MTX
9-
.lock()
10-
.expect("Mutex got poisoned by another test");
8+
let _mtx = crate::SIGNAL_MTX.lock();
119

1210
let (r1, w1) = pipe().unwrap();
1311
write(w1, b"hi!").unwrap();

test/sys/test_signal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn test_killpg_none() {
1919

2020
#[test]
2121
fn test_old_sigaction_flags() {
22-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
22+
let _m = crate::SIGNAL_MTX.lock();
2323

2424
extern "C" fn handler(_: ::libc::c_int) {}
2525
let act = SigAction::new(
@@ -41,7 +41,7 @@ fn test_sigprocmask_noop() {
4141

4242
#[test]
4343
fn test_sigprocmask() {
44-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
44+
let _m = crate::SIGNAL_MTX.lock();
4545

4646
// This needs to be a signal that rust doesn't use in the test harness.
4747
const SIGNAL: Signal = Signal::SIGCHLD;
@@ -89,15 +89,15 @@ extern fn test_sigaction_action(_: libc::c_int, _: *mut libc::siginfo_t, _: *mut
8989
#[test]
9090
#[cfg(not(target_os = "redox"))]
9191
fn test_signal_sigaction() {
92-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
92+
let _m = crate::SIGNAL_MTX.lock();
9393

9494
let action_handler = SigHandler::SigAction(test_sigaction_action);
9595
assert_eq!(unsafe { signal(Signal::SIGINT, action_handler) }.unwrap_err(), Errno::ENOTSUP);
9696
}
9797

9898
#[test]
9999
fn test_signal() {
100-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
100+
let _m = crate::SIGNAL_MTX.lock();
101101

102102
unsafe { signal(Signal::SIGINT, SigHandler::SigIgn) }.unwrap();
103103
raise(Signal::SIGINT).unwrap();

test/sys/test_signalfd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn test_signalfd() {
66
use nix::sys::signal::{self, raise, Signal, SigSet};
77

88
// Grab the mutex for altering signals so we don't interfere with other tests.
9-
let _m = crate::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
9+
let _m = crate::SIGNAL_MTX.lock();
1010

1111
// Block the SIGUSR1 signal from automatic processing for this thread
1212
let mut mask = SigSet::empty();

test/sys/test_termios.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn write_all(f: RawFd, buf: &[u8]) {
1919
#[test]
2020
fn test_tcgetattr_pty() {
2121
// openpty uses ptname(3) internally
22-
let _m = crate::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
22+
let _m = crate::PTSNAME_MTX.lock();
2323

2424
let pty = openpty(None, None).expect("openpty failed");
2525
assert!(termios::tcgetattr(pty.slave).is_ok());
@@ -46,7 +46,7 @@ fn test_tcgetattr_ebadf() {
4646
#[test]
4747
fn test_output_flags() {
4848
// openpty uses ptname(3) internally
49-
let _m = crate::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
49+
let _m = crate::PTSNAME_MTX.lock();
5050

5151
// Open one pty to get attributes for the second one
5252
let mut termios = {
@@ -88,7 +88,7 @@ fn test_output_flags() {
8888
#[test]
8989
fn test_local_flags() {
9090
// openpty uses ptname(3) internally
91-
let _m = crate::PTSNAME_MTX.lock().expect("Mutex got poisoned by another test");
91+
let _m = crate::PTSNAME_MTX.lock();
9292

9393
// Open one pty to get attributes for the second one
9494
let mut termios = {

0 commit comments

Comments
 (0)