PTY/TTY - What Can't You Do With Only Slave FD PTY/TTY - What Can't You Do With Only Slave FD unix unix

PTY/TTY - What Can't You Do With Only Slave FD


Thanks to StackOverflow's related-questions suggestions and other online searching since asking this, I've found a (partial?) answer:

  • Enabling or disabling packet mode on a PTY in Linux can only be done if you have the master FD [See TIOCPKT at this manpage]
  • Getting the Session ID associated with a TTY in Linux can only be done if you have the master FD (unclear if this is expected/intended behavior) [See TIOCGSID at this manpage]
  • Re-sizing the TTY is only portable from the master FD in practice (a terminal emulator might resize the TTY when it's resized, but an application with just the slave FD has no real certainty that the master size resizes accordingly, or that the terminal driver will even accept a resize from the slave end). [Source]
  • There is a trick for telling if the slave end of a TTY is opened, that you can't do if you don't have the master FD. [Source]

I'll try to keep coming back to edit this as I learn more.