diff options
author | kiddkai <kiddkai@gmail.com> | 2016-10-05 13:08:55 +1100 |
---|---|---|
committer | kiddkai <kiddkai@gmail.com> | 2016-10-28 22:26:10 +1100 |
commit | 24cde803d6259d5404c9d1dda40f45acf458c80e (patch) | |
tree | b91d051bc0dd8fe4b7fca545149ef5e4c3b87da8 | |
parent | 8d0e312844fb7372f20efc022187f1c493672059 (diff) | |
download | nix-24cde803d6259d5404c9d1dda40f45acf458c80e.zip |
add getpgid
-rw-r--r-- | src/unistd.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index 4549382d..2296e010 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<pid_t>) -> Result<pid_t> { + 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<bool> { } } + pub fn unlink<P: ?Sized + NixPath>(path: &P) -> Result<()> { let res = try!(path.with_nix_path(|cstr| { unsafe { |