Arnt:
...
> Processes cannot adopt children; the kernel foists processes on pid 1 
> without asking either pid 1 or any other process.

??? I see no problems doing a wait() in a program to catch a childs
termination. There even is an example in wait()'s manpage.

> Bash's source code is very, very large compared to zsh, which offers 
> roughly the same functionality. The extra lines of code code have to do 
> something, so it's entirely possible that bash tries to duplicate the 
> kernel's list of children. Or not. I'm not going to look, it doesn't seem a 
> useful thing to do.

Messages like:

$ xpdf ~/a.pdf &
[1] 11127
$ 
[1]+  Done                    xpdf ~/a.pdf
$ 

do point to some ability in bash to detect when children finishes.
That could be done by catching SIGCHLD. Using sigaction() when setting
up a signal handler gives you the possibility to extract the sending
process pid so you can wait() it without blocking.

And bash do have a list of its direct childrens:

$ for i in 1 2 3; do xpdf ~/a.pdf & done
[1] 11294
[2] 11295
[3] 11296
$ jobs
[1]   Running                 xpdf ~/a.pdf &
[2]-  Running                 xpdf ~/a.pdf &
[3]+  Running                 xpdf ~/a.pdf &
$

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57


_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to