Skip to content

Commit

Permalink
Auto merge of #433 - kiddkai:getpgid, r=posborne
Browse files Browse the repository at this point in the history
add getpgid call

Add a `getpgid` function to nix.

Argument is required, either pass in `None` or `Some(pid_t)`. It should have the same behavior
as the `libc` one.
  • Loading branch information
homu committed Oct 28, 2016
2 parents 8d0e312 + ac51932 commit b05c1e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#410](https://github.com/nix-rust/nix/pull/410))
- Added `setresuid` and `setresgid` for Linux in `::nix::unistd`
([#448](https://github.com/nix-rust/nix/pull/448))
- Added `getpgid` in `::nix::unistd`
([#433](https://github.com/nix-rust/nix/pull/433))

### Changed
- The minimum supported version of rustc is now 1.7.0.
Expand Down
5 changes: 5 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ pub fn setpgid(pid: pid_t, pgid: pid_t) -> Result<()> {
let res = unsafe { libc::setpgid(pid, pgid) };
Errno::result(res).map(drop)
}
#[inline]
pub fn getpgid(pid: Option<pid_t>) -> Result<pid_t> {
let res = unsafe { libc::getpgid(pid.unwrap_or(0 as pid_t)) };
Errno::result(res)
}

#[cfg(any(target_os = "linux", target_os = "android"))]
#[inline]
Expand Down

0 comments on commit b05c1e4

Please sign in to comment.