Re: mmotm 2009-08-24-16-24 uploaded

From: KAMEZAWA Hiroyuki
Date: Thu Aug 27 2009 - 06:19:23 EST


On Thu, 27 Aug 2009 18:43:03 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> Can't get it. It seems reaped.
> ==
> [root@bluextal mmotm-2.6.31-Aug27]# kill -s 0 2990(CHILD's pid)
> bash: kill: (2990) - No such process
>

I think I found something. rpc.statd did...

==
[pid 3372] rt_sigaction(SIGCHLD, {0x1, [CHLD], SA_RESTORER|SA_RESTART, 0x7f688fb52f90}, {SIG_DFL, [], 0}, 8) = 0
[pid 3372] rt_sigaction(SIGPIPE, {0x1, [PIPE], SA_RESTORER|SA_RESTART, 0x7f688fb52f90}, {SIG_DFL, [], 0}, 8) = 0
[pid 3372] unlink("/var/run/rpc.statd.pid") = 0
.....
[pid 3372] clone(Process 3373 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f68902a0780) = 3373
[pid 3372] wait4(3373, Process 3372 suspended
<unfinished ...>
==

Then, SIG_IGN is set to SIGCHLD handler and children's p->exit_signal == -1.

In old bahaivor, parent, who calls wait, was waken up even if SIG_IGN.
Now, filtered, not wake up.

>From man.
==
POSIX.1-2001 specifies that if the disposition of SIGCHLD is set to SIG_IGN or the SA_NOCLDWAIT
flag is set for SIGCHLD (see sigaction(2)), then children that terminate do not become zombies and
a call to wait() or waitpid() will block until all children have terminated, and then fail with
errno set to ECHILD. (The original POSIX standard left the behavior of setting SIGCHLD to SIG_IGN
unspecified. Note that even though the default disposition of SIGCHLD is "ignore", explicitly
setting the disposition to SIG_IGN results in different treatment of zombie process children.)
==
I can't undestand what happens to a parent process which does
1. set SIG_CHLD to SIG_IGN
2. call waitpid()
3. all children goes away.



Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/