proc table in /dev/kmem

John McDaid jmd at loral.UUCP
Thu Nov 10 09:10:33 AEST 1988


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 at loral.UUCP



More information about the Comp.unix.questions mailing list