Well, catching all zombies is a tricky task. AFAIK the SIGCHILD
handler on its own is no reliable solution on all systems. There were
several iterations regarding spawn() during the time, most of them
happened at wmii times and the old double-fork() was the most reliable
and simple solution, which was the reason I chose it and keep it.
Kind regards,
Anselm
2008/11/4 Neale Pickett <neale_AT_woozle.org>:
> Reparenting everything to init with the double-fork is a nightmare on a
> many-user machine, especially when I'm logged in more than once. pstree
> becomes useless. This sets up a SIGCHLD handler and only forks once.
> Adds 2 SLOC, but surely there's some reason the double-fork is there that
> I'm just missing...
>
> void
> sigchld(int signal)
> {
> while (0 < waitpid(-1, NULL, WNOHANG));
> }
>
> void
> spawn(const Arg *arg)
> {
> signal(SIGCHLD, sigchld);
> if (fork() == 0) {
> if (dpy) close(ConnectionNumber(dpy));
> setsid();
> execvp(((char **)arg->v)[0], (char **)arg->v);
> fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
> perror(" failed");
> exit(0);
> }
> }
Received on Wed Nov 05 2008 - 09:25:07 UTC
This archive was generated by hypermail 2.2.0 : Wed Nov 05 2008 - 09:36:04 UTC