* Bob Bishop <rb_at_gid.co.uk> wrote: > stat(2) its standard output? It is likely that very old versions of isatty(3) called fstat(2) and looked at st_rdev to determine whether it was a TTY. This is indeed to how various related functions like ptsname(3) worked. Nowadays stuff is implemented as follows: - isatty(3) just calls tcgetattr(3), which uses TIOCGETA. - ttyname(3) first calls isatty(3) and then fdevname(), which uses FIODGNAME. - ptsname(3) first uses TIOCPTMASTER to see whether the file descriptor is a pseudo-terminal master and then fdevname(). Which is nice, because everything goes by name and not by device number. For example, ptsname(3) on Linux generates the name by looking at the major/minor number. -- Ed Schouten <ed_at_80386.nl> WWW: http://80386.nl/
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC