From 24cde803d6259d5404c9d1dda40f45acf458c80e Mon Sep 17 00:00:00 2001 From: kiddkai Date: Wed, 5 Oct 2016 13:08:55 +1100 Subject: [PATCH 1/3] add getpgid --- src/unistd.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/unistd.rs b/src/unistd.rs index 4549382df6..2296e0108a 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) -> Result { + let res = unsafe { libc::getpgid(pid.unwrap_or(0 as pid_t)) }; + Errno::result(res) +} #[cfg(any(target_os = "linux", target_os = "android"))] #[inline] @@ -441,6 +446,7 @@ pub fn isatty(fd: RawFd) -> Result { } } + pub fn unlink(path: &P) -> Result<()> { let res = try!(path.with_nix_path(|cstr| { unsafe { From c74d0014bcbeb18c3b646f481ee0abdf59092fab Mon Sep 17 00:00:00 2001 From: kiddkai Date: Wed, 5 Oct 2016 13:14:02 +1100 Subject: [PATCH 2/3] remove extra line in the commit --- src/unistd.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/unistd.rs b/src/unistd.rs index 2296e0108a..a1953115f6 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -446,7 +446,6 @@ pub fn isatty(fd: RawFd) -> Result { } } - pub fn unlink(path: &P) -> Result<()> { let res = try!(path.with_nix_path(|cstr| { unsafe { From ac5193207851191b430cc22033edd54424dfa55e Mon Sep 17 00:00:00 2001 From: kiddkai Date: Wed, 5 Oct 2016 13:16:18 +1100 Subject: [PATCH 3/3] add getpgid in changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 913d09ab0b..b8ae74ca31 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.