mirror of
https://github.com/facebookexperimental/reverie.git
synced 2025-01-22 21:04:53 +00:00
Reformat with new rustfmt 4/7
Summary:
Generated by `tools/arcanist/lint/codemods/rustfmt-fbsource` with the rustfmt executable added by D35234535 (ce519e0af4
).
drop-conflicts
Reviewed By: zertosh
Differential Revision: D35234536
fbshipit-source-id: 3e8b23b4abbb9bdd052d86dcd619f88bbcc5d454
This commit is contained in:
parent
ce519e0af4
commit
924aff3d5e
8 changed files with 24 additions and 72 deletions
|
@ -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))
|
||||
|
|
|
@ -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) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -293,9 +293,7 @@ mod tests {
|
|||
check_fn::<LocalState, _>(|| {
|
||||
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]) }
|
||||
|
|
|
@ -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!()
|
||||
}
|
||||
|
|
|
@ -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) };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,9 +109,7 @@ mod tests {
|
|||
let mut file = unsafe { File::from_raw_fd(fd) };
|
||||
let mut siginfo = [0; mem::size_of::<libc::signalfd_siginfo>()];
|
||||
|
||||
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) };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,9 +168,7 @@ mod tests {
|
|||
fn stack_allocator_should_work() {
|
||||
check_fn::<LocalState, _>(|| {
|
||||
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::<LocalState2, _>(|| {
|
||||
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::<LocalState3, _>(|| {
|
||||
unsafe {
|
||||
libc::syscall(libc::SYS_exit_group, 0)
|
||||
};
|
||||
unsafe { libc::syscall(libc::SYS_exit_group, 0) };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue