Weird console bug
ed at 80386.nl
Tue Aug 11 15:11:20 UTC 2009
* 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
- 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
Ed Schouten <ed at 80386.nl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20090811/7aa09c47/attachment.pgp
More information about the freebsd-current