Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove return value from pause #836

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Both `ip_mreq` and `ipv6_mreq` have been replaced with `IpMembershipRequest` and
`Ipv6MembershipRequest`.
([#814](https://github.com/nix-rust/nix/pull/814))

- Removed return type from `pause`.
([#829](https://github.com/nix-rust/nix/pull/829))

### Fixed
- Fix compilation and tests for OpenBSD targets
Expand Down
10 changes: 4 additions & 6 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,14 +1316,12 @@ pub fn initgroups(user: &CStr, group: Gid) -> Result<()> {
Errno::result(res).map(|_| ())
}

/// Suspend the thread until a signal is received
/// Suspend the thread until a signal is received.
///
/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html)
/// See also [pause(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pause.html).
#[inline]
pub fn pause() -> Result<()> {
let res = unsafe { libc::pause() };

Errno::result(res).map(drop)
pub fn pause() {
unsafe { libc::pause() };
}

/// Suspend execution for an interval of time
Expand Down
5 changes: 4 additions & 1 deletion test/sys/test_wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ fn test_wait_signal() {

// Safe: The child only calls `pause` and/or `_exit`, which are async-signal-safe.
match fork().expect("Error: Fork Failed") {
Child => pause().unwrap_or_else(|_| unsafe { _exit(123) }),
Child => {
pause();
unsafe { _exit(123) }
},
Parent { child } => {
kill(child, Some(SIGKILL)).expect("Error: Kill Failed");
assert_eq!(waitpid(child, None), Ok(WaitStatus::Signaled(child, SIGKILL, false)));
Expand Down