Skip to content

Commit

Permalink
Auto merge of #491 - zethra:master, r=fiveop
Browse files Browse the repository at this point in the history
Added getpgrp
  • Loading branch information
homu committed Dec 16, 2016
2 parents 2cfeb57 + 0c97f10 commit 618737f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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
- Changed `TimeVal` into an opaque Newtype
Expand Down
11 changes: 11 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
///
Expand Down

0 comments on commit 618737f

Please sign in to comment.