| ... | @@ -6791,7 +6791,9 @@ pub fn getrusage(who: i32) rusage { | ... | @@ -6791,7 +6791,9 @@ pub fn getrusage(who: i32) rusage { |
| 6791 | } | 6791 | } |
| 6792 | } | 6792 | } |
| 6793 | | 6793 | |
| 6794 | pub const TermiosGetError = error{NotATerminal} || UnexpectedError; | 6794 | pub const TIOCError = error{NotATerminal}; |
| | 6795 | |
| | 6796 | pub const TermiosGetError = TIOCError || UnexpectedError; |
| 6795 | | 6797 | |
| 6796 | pub fn tcgetattr(handle: fd_t) TermiosGetError!termios { | 6798 | pub fn tcgetattr(handle: fd_t) TermiosGetError!termios { |
| 6797 | while (true) { | 6799 | while (true) { |
| ... | @@ -6822,6 +6824,41 @@ pub fn tcsetattr(handle: fd_t, optional_action: TCSA, termios_p: termios) Termio | ... | @@ -6822,6 +6824,41 @@ pub fn tcsetattr(handle: fd_t, optional_action: TCSA, termios_p: termios) Termio |
| 6822 | } | 6824 | } |
| 6823 | } | 6825 | } |
| 6824 | | 6826 | |
| | 6827 | pub const TermioGetPgrpError = TIOCError || UnexpectedError; |
| | 6828 | |
| | 6829 | /// Returns the process group ID for the TTY associated with the given handle. |
| | 6830 | pub fn tcgetpgrp(handle: fd_t) TermioGetPgrpError!pid_t { |
| | 6831 | while (true) { |
| | 6832 | var pgrp: pid_t = undefined; |
| | 6833 | switch (errno(system.tcgetpgrp(handle, &pgrp))) { |
| | 6834 | .SUCCESS => return pgrp, |
| | 6835 | .BADF => unreachable, |
| | 6836 | .INVAL => unreachable, |
| | 6837 | .NOTTY => return error.NotATerminal, |
| | 6838 | else => |err| return unexpectedErrno(err), |
| | 6839 | } |
| | 6840 | } |
| | 6841 | } |
| | 6842 | |
| | 6843 | pub const TermioSetPgrpError = TermioGetPgrpError || error{NotAPgrpMember}; |
| | 6844 | |
| | 6845 | /// Sets the controlling process group ID for given TTY. |
| | 6846 | /// handle must be valid fd_t to a TTY associated with calling process. |
| | 6847 | /// pgrp must be a valid process group, and the calling process must be a member |
| | 6848 | /// of that group. |
| | 6849 | pub fn tcsetpgrp(handle: fd_t, pgrp: pid_t) TermioSetPgrpError!void { |
| | 6850 | while (true) { |
| | 6851 | switch (errno(system.tcsetpgrp(handle, &pgrp))) { |
| | 6852 | .SUCCESS => return, |
| | 6853 | .BADF => unreachable, |
| | 6854 | .INVAL => unreachable, |
| | 6855 | .NOTTY => return error.NotATerminal, |
| | 6856 | .PERM => return TermioSetPgrpError.NotAPgrpMember, |
| | 6857 | else => |err| return unexpectedErrno(err), |
| | 6858 | } |
| | 6859 | } |
| | 6860 | } |
| | 6861 | |
| 6825 | pub const IoCtl_SIOCGIFINDEX_Error = error{ | 6862 | pub const IoCtl_SIOCGIFINDEX_Error = error{ |
| 6826 | FileSystem, | 6863 | FileSystem, |
| 6827 | InterfaceNotFound, | 6864 | InterfaceNotFound, |