File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ use std::convert::From;
50
50
use std:: mem;
51
51
use std:: os:: unix:: io:: RawFd ;
52
52
53
+ use :: unistd:: Pid ;
54
+
53
55
/// Stores settings for the termios API
54
56
///
55
57
/// This is a wrapper around the `libc::termios` struct that provides a safe interface for the
@@ -883,3 +885,11 @@ pub fn tcflush(fd: RawFd, action: FlushArg) -> Result<()> {
883
885
pub fn tcsendbreak ( fd : RawFd , duration : c_int ) -> Result < ( ) > {
884
886
Errno :: result ( unsafe { libc:: tcsendbreak ( fd, duration) } ) . map ( drop)
885
887
}
888
+
889
+ /// Get the session controlled by the given terminal (see
890
+ /// [tcgetsid(3)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetsid.html)).
891
+ pub fn tcgetsid ( fd : RawFd ) -> Result < Pid > {
892
+ let res = unsafe { libc:: tcgetsid ( fd) } ;
893
+
894
+ Errno :: result ( res) . map ( Pid :: from_raw)
895
+ }
You can’t perform that action at this time.
0 commit comments