Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2009 17:11:18 +0200
From:      Ed Schouten <ed@80386.nl>
To:        Bob Bishop <rb@gid.co.uk>
Cc:        Ivan Radovanovic <rivanr@gmail.com>, Doug Barton <dougb@freebsd.org>, freebsd-current@freebsd.org
Subject:   Re: Weird console bug
Message-ID:  <20090811151118.GF1292@hoeg.nl>
In-Reply-To: <37692697-D7DC-4963-B9D2-6793554D4E07@gid.co.uk>
References:  <50679.1249933434@critter.freebsd.dk> <4A8079FF.1040007@gmail.com> <4A807D12.1000104@FreeBSD.org> <37692697-D7DC-4963-B9D2-6793554D4E07@gid.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

--GWLvvOwKrQC9aCO6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Bob Bishop <rb@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.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--GWLvvOwKrQC9aCO6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkqBihYACgkQ52SDGA2eCwX+ZQCcDMB1Xjlw2pnCZr6ENTDiK4c1
i20An2qup+tJvccDseMVqcToz/8Vl+iJ
=8lhz
-----END PGP SIGNATURE-----

--GWLvvOwKrQC9aCO6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090811151118.GF1292>