From 1ba7fe0891fefd00b401cd615e16dc8486862e8f Mon Sep 17 00:00:00 2001 From: zethra Date: Mon, 12 Dec 2016 14:50:21 -0500 Subject: [PATCH] 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). ///