Subject: Re: remotely exitting a process
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Frank van der Linden <fvdl@netbsd.org>
List: tech-kern
Date: 11/28/2005 22:00:58
Emmanuel Dreyfus wrote:
>Hi
>
>Linux's exit_group system call is meant to exit a whole group of processes.
>In order to emulate it correctly, I must be able to cause a process to exit
>from another process.
>
>How could this be done correctly? I tried sending SIGKILL to the members
>of the program group, but that does not work very well, as it fires an
>unwanted SIGCHLD to the parent.
>
>Calling sys_exit(l, v, retval) within the context of a lwp different than
>l does not work. What alternative do I have?
>
>
>
I'd just set the "sig" argument that is passed by linux_sys_clone to
fork1() to 0, iff CLONE_THREAD is set. That way, when a clone/"thread"
exits (really a process), it will not send the parent a signal.
Glancing at the Linux kernel, it seems like the desired emulated behavior.
So then, the SIGKILL approach will work, if we ignore the case of
processes waiting in the kernel. I bet there are tons of places in the
kernel where the code doesn't expect to exit from a ltsleep() by a
forced exit, so a change in semantics there would require a lot of code
changes.
- Frank