diff --git a/reverie-process/src/exit_status.rs b/reverie-process/src/exit_status.rs index 8fcfb59..e6b63a8 100644 --- a/reverie-process/src/exit_status.rs +++ b/reverie-process/src/exit_status.rs @@ -89,9 +89,7 @@ impl ExitStatus { rlim_cur: 0, rlim_max: 0, }; - unsafe { - libc::setrlimit(libc::RLIMIT_CORE, &limit) - }; + unsafe { libc::setrlimit(libc::RLIMIT_CORE, &limit) }; } // Raise the same signal, which may or may not be fatal. @@ -203,9 +201,7 @@ mod tests_non_sanitized { // Note: We also can't use the normal exit function here because we // don't want to call atexit handlers since `execve` was never // called. - unsafe { - ::libc::_exit(code) - }; + unsafe { ::libc::_exit(code) }; } } } @@ -213,25 +209,19 @@ mod tests_non_sanitized { #[test] fn normal_exit() { assert_eq!( - run_forked(|| { - unsafe { libc::_exit(0) } - }), + run_forked(|| { unsafe { libc::_exit(0) } }), Ok(ExitStatus::Exited(0)) ); assert_eq!( - run_forked(|| { - unsafe { libc::_exit(42) } - }), + run_forked(|| { unsafe { libc::_exit(42) } }), Ok(ExitStatus::Exited(42)) ); // Thread exit assert_eq!( run_forked(|| { - unsafe { - libc::syscall(libc::SYS_exit, 42) - }; + unsafe { libc::syscall(libc::SYS_exit, 42) }; unreachable!(); }), Ok(ExitStatus::Exited(42)) @@ -240,9 +230,7 @@ mod tests_non_sanitized { // exit_group. Should be identical to `libc::_exit`. assert_eq!( run_forked(|| { - unsafe { - libc::syscall(libc::SYS_exit_group, 42) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 42) }; unreachable!(); }), Ok(ExitStatus::Exited(42)) diff --git a/reverie-ptrace/src/trace/waitid.rs b/reverie-ptrace/src/trace/waitid.rs index 6b880fd..033c49f 100644 --- a/reverie-ptrace/src/trace/waitid.rs +++ b/reverie-ptrace/src/trace/waitid.rs @@ -168,9 +168,7 @@ mod tests { ForkResult::Child => { let hundred_millies = std::time::Duration::from_millis(100); std::thread::sleep(hundred_millies); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; } } } @@ -189,9 +187,7 @@ mod tests { ForkResult::Child => { let hundred_millies = std::time::Duration::from_millis(100); std::thread::sleep(hundred_millies); - unsafe { - libc::syscall(libc::SYS_exit_group, 1) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 1) }; } } } @@ -238,9 +234,7 @@ mod tests { ForkResult::Child => { let hundred_millies = std::time::Duration::from_millis(100); std::thread::sleep(hundred_millies); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; } } } @@ -263,9 +257,7 @@ mod tests { ForkResult::Child => { let hundred_millies = std::time::Duration::from_millis(100); std::thread::sleep(hundred_millies); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; } } } diff --git a/tests/basics.rs b/tests/basics.rs index 3bd7f77..e1421fa 100644 --- a/tests/basics.rs +++ b/tests/basics.rs @@ -258,17 +258,13 @@ fn child_should_inherit_fds() { assert_eq!(unistd::read(fdread, &mut buf), Ok(8)); assert_eq!(buf, msg); assert_eq!(wait::waitpid(child, None), Ok(WaitStatus::Exited(child, 0))); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; unreachable!(); } Ok(ForkResult::Child) => { assert!(unistd::close(fdread).is_ok()); assert_eq!(unistd::write(fdwrite, &msg), Ok(8)); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; unreachable!(); } Err(err) => { diff --git a/tests/delay_signal.rs b/tests/delay_signal.rs index 690f14c..92f2f36 100644 --- a/tests/delay_signal.rs +++ b/tests/delay_signal.rs @@ -293,9 +293,7 @@ mod tests { check_fn::(|| { assert!(unsafe { restore_sig_handlers(&[Signal::SIGVTALRM]) }.is_ok()); assert!(unsafe { unblock_signals(&[Signal::SIGVTALRM]) }.is_ok()); - unsafe { - libc::signal(libc::SIGVTALRM, libc::SIG_IGN) - }; + unsafe { libc::signal(libc::SIGVTALRM, libc::SIG_IGN) }; let now = time::Instant::now(); thread::sleep(time::Duration::from_millis(10)); assert!(signal::raise(Signal::SIGVTALRM).is_ok()); @@ -322,9 +320,7 @@ mod tests { let (sender, receiver) = mpsc::channel(); let handle = thread::spawn(move || { assert!(sender.send(nix::unistd::gettid()).is_ok()); - unsafe { - libc::signal(libc::SIGBUS, libc::SIG_DFL) - }; + unsafe { libc::signal(libc::SIGBUS, libc::SIG_DFL) }; assert_eq!( unsafe { sigtimedwait(&[Signal::SIGBUS], 1000000000000u64) }.unwrap(), Signal::SIGBUS, @@ -349,9 +345,7 @@ mod tests { let (sender, receiver) = mpsc::channel(); let handle = thread::spawn(move || { assert!(sender.send(nix::unistd::gettid()).is_ok()); - unsafe { - libc::signal(libc::SIGBUS, libc::SIG_DFL) - }; + unsafe { libc::signal(libc::SIGBUS, libc::SIG_DFL) }; assert_eq!( unsafe { sigsuspend(&[]) } .err() @@ -398,9 +392,7 @@ mod tests { let (sender, receiver) = mpsc::channel(); let _handle = thread::spawn(move || { assert!(sender.send(nix::unistd::gettid()).is_ok()); - unsafe { - libc::signal(libc::SIGSYS, libc::SIG_DFL) - }; + unsafe { libc::signal(libc::SIGSYS, libc::SIG_DFL) }; assert_eq!( unsafe { sigsuspend(&[Signal::SIGPROF, Signal::SIGVTALRM]) } diff --git a/tests/parallelism.rs b/tests/parallelism.rs index e2f611c..741133b 100644 --- a/tests/parallelism.rs +++ b/tests/parallelism.rs @@ -126,9 +126,7 @@ fn kill_blocked_child() { let barrier = barrier.clone(); std::thread::spawn(move || { barrier.wait(); - unsafe { - libc::syscall(libc::SYS_gettid, 0) - }; + unsafe { libc::syscall(libc::SYS_gettid, 0) }; }) }; @@ -137,9 +135,7 @@ fn kill_blocked_child() { // This should cause the handler future for the thread to get dropped the // next time it is polled. - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; unreachable!() } diff --git a/tests/signal.rs b/tests/signal.rs index bd79877..ca434c8 100644 --- a/tests/signal.rs +++ b/tests/signal.rs @@ -105,9 +105,7 @@ mod tests { assert!(signal::raise(Signal::SIGVTALRM).is_ok()); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; }); } } diff --git a/tests/signalfd.rs b/tests/signalfd.rs index db16f7c..9f2fc61 100644 --- a/tests/signalfd.rs +++ b/tests/signalfd.rs @@ -109,9 +109,7 @@ mod tests { let mut file = unsafe { File::from_raw_fd(fd) }; let mut siginfo = [0; mem::size_of::()]; - unsafe { - libc::alarm(1) - }; + unsafe { libc::alarm(1) }; assert!(file.read_exact(&mut siginfo).is_ok()); @@ -119,9 +117,7 @@ mod tests { assert_eq!(siginfo.ssi_signo, libc::SIGALRM as u32); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; }); } } diff --git a/tests/stack.rs b/tests/stack.rs index 6c270a5..639f4e6 100644 --- a/tests/stack.rs +++ b/tests/stack.rs @@ -168,9 +168,7 @@ mod tests { fn stack_allocator_should_work() { check_fn::(|| { assert_ne!(nix::sys::utsname::uname().sysname(), ""); - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; }); } @@ -180,9 +178,7 @@ mod tests { #[should_panic] fn stack_two_allocs_bad() { check_fn::(|| { - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; }); } @@ -190,9 +186,7 @@ mod tests { #[test] fn stack_two_allocs_good() { check_fn::(|| { - unsafe { - libc::syscall(libc::SYS_exit_group, 0) - }; + unsafe { libc::syscall(libc::SYS_exit_group, 0) }; }); } }