From 1ba7fe0891fefd00b401cd615e16dc8486862e8f Mon Sep 17 00:00:00 2001 From: zethra Date: Mon, 12 Dec 2016 14:50:21 -0500 Subject: [PATCH 1/2] Added getpgrp --- src/unistd.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/unistd.rs b/src/unistd.rs index f06f708b83..f7efbdee61 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -151,6 +151,17 @@ pub fn tcsetpgrp(fd: c_int, pgrp: pid_t) -> Result<()> { Errno::result(res).map(drop) } + +/// Get the group id of the calling process (see +///[getpgrp(3)](http://man7.org/linux/man-pages/man3/getpgrp.3p.html)). +/// +/// Get the process group id (PGID) of the calling process. +/// According to the man page it is always successful. +#[inline] +pub fn getpgrp() -> pid_t { + unsafe { libc::getpgrp() } +} + /// Get the caller's thread ID (see /// [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html). /// From 0c97f104aeeb4b6b6a33f29079fab7f89fd75bc1 Mon Sep 17 00:00:00 2001 From: zethra Date: Mon, 12 Dec 2016 14:52:29 -0500 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b05f7684..1445af5e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ([#451](https://github.com/nix-rust/nix/pull/451)) - Added `CLONE_NEWCGROUP` in `::nix::sched` ([#457](https://github.com/nix-rust/nix/pull/457)) +- Added `getpgrp` in `::nix::unistd` + ([#491](https://github.com/nix-rust/nix/pull/491)) ### Changed - `kill`'s signature, defined in `::nix::sys::signal`, changed, so that the