Vanilla Development Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS update: Vanilla/newstartd



Date:	Monday March 22, 1999 @ 20:33
Author:	ahn

Update of /home/netrek/cvsroot/Vanilla/newstartd
In directory cvs.castle.real-time.com:/var/tmp/cvs-serv2352

Modified Files:
	newstartd.c 
Log Message:
Fix to remove zombie processes. -da


****************************************

Index: Vanilla/newstartd/newstartd.c
diff -u Vanilla/newstartd/newstartd.c:1.10 Vanilla/newstartd/newstartd.c:1.11
--- Vanilla/newstartd/newstartd.c:1.10	Mon Mar 15 04:42:39 1999
+++ Vanilla/newstartd/newstartd.c	Mon Mar 22 20:33:58 1999
@@ -1,7 +1,7 @@
-/* 	$Id: newstartd.c,v 1.10 1999/03/15 10:42:39 cameron Exp $	 */
+/* 	$Id: newstartd.c,v 1.11 1999/03/23 02:33:58 ahn Exp $	 */
 
 #ifndef lint
-static char vcid[] = "$Id: newstartd.c,v 1.10 1999/03/15 10:42:39 cameron Exp $";
+static char vcid[] = "$Id: newstartd.c,v 1.11 1999/03/23 02:33:58 ahn Exp $";
 #endif /* lint */
 
 /*
@@ -98,6 +98,32 @@
 extern char peerhostname[];		/* defined in newaccess.c	*/
 int fd;					/* log file file descriptor	*/
 
+
+/* sigaction() is a POSIX signal function.  On some systems, it is
+   incompatible with SysV/BSD signals.  Some SysV signals provide
+   sigaction(), others don't.  If you get odd signal behavior, undef
+   this at the expense of zombie processes.  -da */
+
+#undef REAPER_HANDLER
+/* prevent child zombie processes -da */
+
+
+#ifdef REAPER_HANDLER
+
+void reaper_handler(void) {
+
+  struct sigaction action;
+
+  action.sa_flags = SA_NOCLDWAIT;
+  action.sa_handler = reaper;
+  sigemptyset(&(action.sa_mask));
+  action.sa_sigaction = NULL;
+  sigaction(SIGCHLD, &action, NULL);
+
+}
+
+#endif
+
 int main (int argc, char *argv[])
 {
   char *portfile = PORTFILE;
@@ -121,7 +147,12 @@
   if (argc == 3 && !strcmp(argv[2], "debug")) debug++;
 
   /* set up handlers for signals */
+
+#ifdef REAPER_HANDLER
+  reaper_handler();
+#else
   SIGNAL (SIGCHLD, reaper);
+#endif
   SIGNAL (SIGHUP, hangup);
   SIGNAL (SIGUSR1, SIG_IGN);