Path: utzoo!mnetor!uunet!mcvax!ukc!its63b!simon From: simon@its63b.ed.ac.uk (ECSC68 S Brown CS) Newsgroups: comp.unix.questions Subject: Re: Is there any way to find real tty under shell layers? Message-ID: <1098@its63b.ed.ac.uk> Date: 17 Mar 88 17:31:30 GMT References: <3932@whuts.UUCP> Reply-To: simon@lfcs.ed.ac.uk (Simon Brown) Organization: LFCS, University of Edinburgh Lines: 51 In article <3932@whuts.UUCP> paul@whuts.UUCP (KOLB) writes: >>In article <352@vsi.UUCP>, friedl@vsi.UUCP (Stephen J. Friedl) writes: >> Does anybody know any way to find out the "real" terminal >> name when running under shell layers in Sys V? > > [description of doing this using getutent() to search for a ut_line > that looks like ttyname(0)] > But shl stamps an entry for the current layer "/dev/sxtNNN" in /etc/utmp, so this won't work. The only way I can think of is to look in /dev/kmem at the sxt driver structures and find what real tty has your sxt (device number got from fstat(0,...)) multiplexed onto it. It's hardly portable though (and requires read-permission on /dev/kmem). It'd be *much* better if shl were to store away the original tty name somewhere when it replaces it in utmp. Of course, the real problem is that utmp is simply not good enough any more- it was fine back in the Good Old Days, but when you have windows and ptys and multiplexing and other good stuff like this, it loses badly. -- -------------------------------------------------- | Simon Brown | | Laboratory for Foundations of Computer Science | | Department of Computer Science | | University of Edinburgh, Scotland, UK. | -------------------------------------------------- UUCP: ...!uunet!mcvax!ukc!lfcs!simon ARPA: simon%lfcs.ed@nss.cs.ucl.ac.uk JANET: simon@uk.ac.ed.lfcs -- -------------------------------------------------- | Simon Brown | | Laboratory for Foundations of Computer Science | | Department of Computer Science | | University of Edinburgh, Scotland, UK. | -------------------------------------------------- UUCP: ...!uunet!mcvax!ukc!lfcs!simon ARPA: simon%lfcs.ed@nss.cs.ucl.ac.uk JANET: simon@uk.ac.ed.lfcs -- -------------------------------------------------- | Simon Brown | | Laboratory for Foundations of Computer Science | | Department of Computer Science | | University of Edinburgh, Scotland, UK. | -------------------------------------------------- UUCP: uunet!mcvax!ukc!lfcs!simon ARPA: simon%lfcs.ed@nss.cs.ucl.ac.uk "Life's like that, you know" JANET: simon@uk.ac.ed.lfcs