Howdy,
I noticed that starting tmux initially, where the client
would fork() the server, would leave a zombie process[0]
around until detaching from session.
This patch[1] sets SIGCHLD handler to SIG_IGN, which solves
the zombied process issue.
I'm not sure if this is the best place to put this code,
or if there is a better way to fix this issue. I'm sure
more qualified folks will chime in with a better diff.
Thanks,
--patrick
[0] Pre-patch:
$ tmux
$ ps auxw | grep tmux
sidster 20630 0.0 0.2 884 1612 ?? Rs 12:01AM 0:00.07 tmux: server
(/tmp/tmux-1000/default) (tmux)
sidster 3663 0.0 0.0 0 0 p2 Z+ - 0:00.00 (tmux)
sidster 11892 0.0 0.2 768 1276 p2 S+ 12:01AM 0:00.03 tmux: client
(/tmp/tmux-1000/default) (tmux)
[1] tmux_zombie.diff
Index: tmux.c
===================================================================
RCS file: /cvs/obsd/src/usr.bin/tmux/tmux.c,v
retrieving revision 1.73
diff -u -p tmux.c
--- tmux.c 22 Feb 2010 20:41:16 -0000 1.73
+++ tmux.c 7 Apr 2010 07:55:23 -0000
@@ -244,6 +244,16 @@ main(int argc, char **argv)
size_t len;
int opt, flags, quiet = 0, cmdflags = 0;
short events;
+ struct sigaction sigact;
+
+ /*
+ * For when we fork() the server, it doesn't zombie around.
+ */
+ memset(&sigact, 0, sizeof sigact);
+ sigemptyset(&sigact.sa_mask);
+ sigact.sa_handler = SIG_IGN;
+ if (sigaction(SIGCHLD, &sigact, NULL) != 0)
+ fatal("sigaction failed");
#ifdef DEBUG
malloc_options = (char *) "AFGJPX";