diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/unistd.rs | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 913d09ab..b8ae74ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/unistd.rs b/src/unistd.rs index 4549382d..a1953115 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -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] |