Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.wizards Subject: Re: Got a process struct / need a tty. Summary: it's (sort of) in the user structure Keywords: unix tty process Message-ID: <1990Feb26.150131.22713@virtech.uucp> Date: 26 Feb 90 15:01:31 GMT References: <598@uncw.UUCP> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 21 In article <598@uncw.UUCP> english@uncw.UUCP (Warren R. English Jr.) writes: > How would one go about finding the control terminal >of a process? After reading all the process structures from /dev/kmem >into any array, I can't seem to figure out how to get the filename >of the controlling tty. This is usually stored in the user structure as a pointer to the inode (or probably vnode for vnode systems) associated with the controlling terminal. Since the name itself is not stored in the kernel anywhere, you must then act like ttyname() and look up the correct /dev entry for the device. PS-> Getting to the user structure for a process other than the currently running process is not a simple feat, since the user structure can be swapped out to disk somewhere. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+