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

From: Neale Pickett <>
Date: Thu, 06 Nov 2008 09:53:26 -0700

"Donald Chai" <> writes:

> On Tue, Nov 4, 2008 at 9:09 AM, Neale Pickett <> wrote:
>> 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...
> If you quit dwm, what happens to any programs that you've launched?

Nothing, the setsid() call makes children process group leaders so they
don't receive any of the signals the parent gets.

> What happens if you suddenly decide to manage all your windows with a
> different window manager?

Suddenly all my windows have title bars, there are background menus, and
I find myself using the mouse a lot ;)

Given that dwm doesn't come with a facility to launch a new wm, I'm not
terribly worried about either of these cases. But here's a function to
restart dwm or change to a new wm (why would you want to do that?!),
anyway, so you can try it out for yourself and see what happens:

restart(const Arg *arg)
  if (arg->v) {
    execvp(((char **)arg->v[0]), (char **)arg->v);
  } else {
    execlp("dwm", "dwm", NULL);

In all seriousness, the only thing this changes for me is making the
output of pstree useful. When there are 20 X sessions on the machine
and I need to kill a stuck firefox, having useful pstree output is super
handy. If everything's a child of init, the output is flat, and I have
to pull out my hair. Nobody wants that, least of all my head.

Received on Thu Nov 06 2008 - 16:53:26 UTC

This archive was generated by hypermail 2.2.0 : Thu Nov 06 2008 - 17:00:05 UTC