Skip to content

Commit 1ba7fe0

Browse files
committed
Added getpgrp
1 parent 5d0b170 commit 1ba7fe0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/unistd.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ pub fn tcsetpgrp(fd: c_int, pgrp: pid_t) -> Result<()> {
151151
Errno::result(res).map(drop)
152152
}
153153

154+
155+
/// Get the group id of the calling process (see
156+
///[getpgrp(3)](http://man7.org/linux/man-pages/man3/getpgrp.3p.html)).
157+
///
158+
/// Get the process group id (PGID) of the calling process.
159+
/// According to the man page it is always successful.
160+
#[inline]
161+
pub fn getpgrp() -> pid_t {
162+
unsafe { libc::getpgrp() }
163+
}
164+
154165
/// Get the caller's thread ID (see
155166
/// [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html).
156167
///

0 commit comments

Comments
 (0)