Re: [dwm] patch to not reparent children to init

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 4 Dec 2008 20:15:23 +0000

Applied in hg tip, thanks Neale!

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 Thu Dec 04 2008 - 20:15:23 UTC

This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 20:24:07 UTC