Xref: utzoo comp.unix.questions:10160 comp.lang.c:13962 comp.unix.wizards:12267 Path: utzoo!utgpu!attcan!uunet!seismo!esosun!ucsdhub!loral!jmd From: jmd@loral.UUCP (John McDaid) Newsgroups: comp.unix.questions,comp.lang.c,comp.unix.wizards Subject: proc table in /dev/kmem Message-ID: <1865@loral.UUCP> Date: 9 Nov 88 23:10:33 GMT Reply-To: jmd@loral.UUCP (John McDaid) Organization: Loral Instrumentation, San Diego Lines: 30 Hello, I have a situation where given a process id, I need to find the child(ren) of that pid. The only way I can think of doing this, without execing some kind of shell script that runs ps -l through awk, is to get the necessary information out of the process table via /dev/kmem. I am running DEC 3.0 Ultirx on uVAX 2000. The reason I need to be able to find the child of a given pid is this: I am forking off an xterm process from my program and I need to be able to kill the xterm process at will. The problem is that xterm is set uid to root and it will not except my SIGTERM or SIGKILL. I CANNOT set uid to root the parent process. But, using the pid from xterm as the parent, I can kill the csh that xterm invokes (the child of xterm) and then xterm would itself exit. I am guessing that by using /dev/kmem, I could seek to the offset where the process table starts, and then read through the process table until I find my given pid as a parent pid. The only problem is that I do not know how to calculate the offset. I have looked at the source for ps on 4.3BSD but I seem to think that there has to be an easier way. Can anyone out there help me out with this problem or maybe even suggest a way for me to get rid of the xterm process. Please respond via e-mail. Thanks in advance to anyone that gives this some thought. John McDaid jmd@loral.UUCP