Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: What is the name of /dev/tty? Message-ID: <9030@mimsy.UUCP> Date: Sun, 18-Oct-87 12:05:25 EDT Article-I.D.: mimsy.9030 Posted: Sun Oct 18 12:05:25 1987 Date-Received: Mon, 19-Oct-87 01:49:18 EDT References: <1418@zyx.UUCP> <2903@aw.sei.cmu.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 23 In article <2903@aw.sei.cmu.edu> pdb@sei.cmu.edu (Patrick Barron) writes: >On 4BSD, you can find out the terminal connected to /dev/tty by digging >it out of your process's u area. If you don't have read access to /dev/kmem, >your process can fork off a child temporarily, and use ptrace(2) to get at >the info. Ewwww, gross! On 4BSD Vaxen, at least, the u. area is easily read with struct user *u = (struct user *)(0x80000000 - UPAGES*NBPG); where UPAGES and NBPG can be obtained with #include You can then read `u->u_ttyd' and other miscellany directly. (And no, you cannot write over them.) This, too, is ugly (but effective). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris