How to mix kernel_thread and SIGCHLD ?

From: Roberto Zunino (zunino@cibs.sns.it)
Date: Mon Jul 10 2000 - 09:58:20 EST


I'm modifying the 2.2.16 kernel to spawn a user process on certain
conditions. Do do this, I do

kernel_thread(kmyownd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);

at the end of init/main.c:do_basic_setup.

>From kmyownd I wait for someone to wake me up and then I do another

kernel_thread(spawn_process, param, 0);

where spawn_process calls, well, kmod.c:exec_usermodehelper in order to
execve() the user process.

This runs nicely but for some reason I don't understand, kmyownd doesn't
get woken up when the child process dies. Therefore kmyownd cannot
waitpid() and a lot of zombies remain pending.

The signal mask should be ok since I siginitsetinv(&current->blocked,
sigmask(SIGCHLD)) in the parent. It seems that send_sig_info is doing
no-op because signal_ignored().

A possible solution (maybe) would be to spawn a process, wait for it to
die, spawn another, wait again for the new one, etc. etc. but I'd like to
have concurrent processes running and to server them when they die.

Could someone give me a hint? What should a kernel thread do to let its
children rest in peace?

Please note that I don't know the linux internals very well -- therefore
expect the most stupid mistakes from me :-)

Thanks,
Zun.

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



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:11 EST