Hi Marcel, On Tue, 2021-01-26 at 10:02 +0100, Marcel Holtmann wrote: Hi Inga, When an ell main loop based process is spun off as a child and the parent process dies due to a segfault, the child process is still left running and needs to detect the segfault condition. To address this need, add watch and signal handler for SIGSEGV. --- ell/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ell/main.c b/ell/main.c index a479b74..712cfb7 100644 --- a/ell/main.c +++ b/ell/main.c @@ -619,6 +619,14 @@ static void sigterm_handler(void *user_data) data->callback(SIGTERM, data->user_data); } +static void sigsegv_handler(void *user_data) +{ + struct signal_data *data = user_data; + + if (data->callback) + data->callback(SIGSEGV, data->user_data); +} + actually this is not enough. I never included SIGSEGV here for the simple reason since you have to do a lot of work when that signal happens. What we need to do is to add proper child spawning handling that does all the nasty signal handling for you. Otherwise you are just about to create zombies. For now if you need child handling, then add your own signal handler instead trying to overload l_main_run_with_signal with it. I don't disagree that this is not enough. However, this is the easiest way I could come up that allows a child to detect a parent process crash. Not very elegant as I had to add prctl() call to the child (but only in testing mode, so should not be awful). Do you have better suggestions on to how to catch a segfault originating in another process without modifying ell? Best regards, Inga