From owner-freebsd-current@FreeBSD.ORG Tue Aug 11 15:11:20 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55BB1106566B; Tue, 11 Aug 2009 15:11:20 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id E85168FC50; Tue, 11 Aug 2009 15:11:19 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id D67011CD3E; Tue, 11 Aug 2009 17:11:18 +0200 (CEST) Date: Tue, 11 Aug 2009 17:11:18 +0200 From: Ed Schouten To: Bob Bishop Message-ID: <20090811151118.GF1292@hoeg.nl> References: <50679.1249933434@critter.freebsd.dk> <4A8079FF.1040007@gmail.com> <4A807D12.1000104@FreeBSD.org> <37692697-D7DC-4963-B9D2-6793554D4E07@gid.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GWLvvOwKrQC9aCO6" Content-Disposition: inline In-Reply-To: <37692697-D7DC-4963-B9D2-6793554D4E07@gid.co.uk> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Ivan Radovanovic , Doug Barton , freebsd-current@freebsd.org Subject: Re: Weird console bug X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2009 15:11:20 -0000 --GWLvvOwKrQC9aCO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Bob Bishop 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 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--