LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Parent PIDs (https://www.linuxquestions.org/questions/linux-newbie-8/parent-pids-238387/)

Sinope 10-03-2004 07:26 PM

Parent PIDs
 
When I run a program, is there a way I can specify a parent PID for that program? I want all of my X programs (yammi, thunderbird, various dockapps, etc) to be parented to .xsession.

trickykid 10-03-2004 07:50 PM

My first question is why? And no, well at least not that I know of. It all depends on how the program is designed to run, etc. But I'm still wondering why you'd want a parent PID for all your X related programs, etc.

Sinope 10-04-2004 06:22 PM

Why? Because when I end my X session, I sometimes have a bunch of programs floating around still running that chew up memory and sometimes interfere with new instances.

Tinkster 10-04-2004 06:34 PM

And having the PPID will change that how?

If a program is written badly and goes AWOL on
exit you won't benefit from all having the same PPID
because in that situation they probably won't respond
to a kill either ...


Cheers,
Tink

Sinope 10-05-2004 08:32 PM

Hmm... I thought that when a process is killed, all its child processes are killed as well. So right now i've got
Code:

init
  |-kdm---.xsession
  |              |-fluxbox---xterm---bash---vi
  |              `-xscreensaver
  `-juk

and when .xsession terminates i have:

Code:

init
  |-kdm
  `-juk

Blecch.

What I want is:
Code:

init
  `-kdm---.xsession
                  |-fluxbox
                  |-xterm--bash---vi
                  |-juk
                  `-xscreensaver

Not possible? :(

darthtux 10-05-2004 09:45 PM

For a process to be a child of a parent process, that parent has to spawn that process. I don't know of any way you can start a process and force it to attach itself to a parent.

I guess you could try to put everything you want to start in a ~/.xsession file to start when X does. But just starting a process once X is already started which seems to be what you want to do is not going to work.

btmiller 10-05-2004 11:46 PM

Besides, this won't work anyhow since children are definitely not killed when their parents exit.* Instead they are "adopted" by init, which will clean them up when they exit.

* Unless, in some situations, when you get an entire process group orphaned. See section 9.10 of W. Richard Stevens Advanced Programming the Unix Environment for all the gory details.


All times are GMT -5. The time now is 08:42 AM.