File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1616 ([ #448 ] ( https://github.com/nix-rust/nix/pull/448 ) )
1717- Added ` getpgid ` in ` ::nix::unistd `
1818 ([ #433 ] ( https://github.com/nix-rust/nix/pull/433 ) )
19+ - Added ` tcgetpgrp ` and ` tcsetpgrp ` in ` ::nix::unistd `
20+ ([ #451 ] ( https://github.com/nix-rust/nix/pull/451 ) )
1921
2022### Changed
2123- The minimum supported version of rustc is now 1.7.0.
Original file line number Diff line number Diff line change @@ -129,6 +129,28 @@ pub fn setsid() -> Result<pid_t> {
129129 Errno :: result ( unsafe { libc:: setsid ( ) } )
130130}
131131
132+
133+ /// Get the terminal foreground process group (see
134+ /// [tcgetpgrp(3)](http://man7.org/linux/man-pages/man3/tcgetpgrp.3.html)).
135+ ///
136+ /// Get the group process id (GPID) of the foreground process group on the
137+ /// terminal associated to file descriptor (FD).
138+ #[ inline]
139+ pub fn tcgetgrp ( fd : c_int ) -> Result < pid_t > {
140+ let res = unsafe { libc:: tcgetpgrp ( fd) } ;
141+ Errno :: result ( res)
142+ }
143+ /// Set the terminal foreground process group (see
144+ /// [tcgetpgrp(3)](http://man7.org/linux/man-pages/man3/tcgetpgrp.3.html)).
145+ ///
146+ /// Get the group process id (PGID) to the foreground process group on the
147+ /// terminal associated to file descriptor (FD).
148+ #[ inline]
149+ pub fn tcsetpgrp ( fd : c_int , pgrp : pid_t ) -> Result < ( ) > {
150+ let res = unsafe { libc:: tcsetpgrp ( fd, pgrp) } ;
151+ Errno :: result ( res) . map ( drop)
152+ }
153+
132154/// Get the caller's thread ID (see
133155/// [gettid(2)](http://man7.org/linux/man-pages/man2/gettid.2.html).
134156///
You can’t perform that action at this time.
0 commit comments