Got a process struct / need a tty.

Conor P. Cahill cpcahil at virtech.uucp
Tue Feb 27 02:01:31 AEST 1990


In article <598 at uncw.UUCP> english at 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     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.wizards mailing list