diff options
author | zethra <jediben97@gmail.com> | 2016-11-08 10:23:14 -0500 |
---|---|---|
committer | zethra <jediben97@gmail.com> | 2016-11-08 10:23:14 -0500 |
commit | baf6b8d520fe11aa88d202415f637c01c1ba7044 (patch) | |
tree | ed9e1e0ff6f463c797f9b84991e147bd950ecf8e /src | |
parent | c0d6829cc43ffd37d535de0465018cb3b05af753 (diff) | |
download | nix-baf6b8d520fe11aa88d202415f637c01c1ba7044.zip |
Added documention to tcgetpgrp and tcsetpgrp
Diffstat (limited to 'src')
-rw-r--r-- | src/unistd.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index 771a50fb..838b11eb 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -129,6 +129,28 @@ pub fn setsid() -> Result<pid_t> { Errno::result(unsafe { libc::setsid() }) } + +/// Get the terminal foreground process group (see +/// [tcgetpgrp(3)](http://man7.org/linux/man-pages/man3/tcgetpgrp.3.html)). +/// +/// Get the group process id (GPID) of the foreground process group on the +/// terminal associated to file descriptor (FD). +#[inline] +pub fn tcgetgrp(fd: c_int) -> Result<pid_t> { + let res = unsafe { libc::tcgetpgrp(fd) }; + Errno::result(res) +} +/// Set the terminal foreground process group (see +/// [tcgetpgrp(3)](http://man7.org/linux/man-pages/man3/tcgetpgrp.3.html)). +/// +/// Get the group process id (PGID) to the foreground process group on the +/// terminal associated to file descriptor (FD). +#[inline] +pub fn tcsetpgrp(fd: c_int, pgrp: pid_t) -> Result<c_int> { + let res = unsafe { libc::tcsetpgrp(fd, pgrp) }; + Errno::result(res) +} + /// Get the caller's thread ID (see /// [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html). /// |