Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rpc.statd Add a handler for SIGCHLD which collects ...
details: https://anonhg.NetBSD.org/src/rev/3d1747b1bbf5
branches: trunk
changeset: 517983:3d1747b1bbf5
user: tron <tron%NetBSD.org@localhost>
date: Thu Nov 22 12:23:15 2001 +0000
description:
Add a handler for SIGCHLD which collects dead childs via wait3(2) so that
"rpc.statd" won't leave zombies arround.
diffstat:
usr.sbin/rpc.statd/statd.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (54 lines):
diff -r 235567c5b3d4 -r 3d1747b1bbf5 usr.sbin/rpc.statd/statd.c
--- a/usr.sbin/rpc.statd/statd.c Thu Nov 22 12:17:00 2001 +0000
+++ b/usr.sbin/rpc.statd/statd.c Thu Nov 22 12:23:15 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: statd.c,v 1.18 2001/02/19 23:22:47 cgd Exp $ */
+/* $NetBSD: statd.c,v 1.19 2001/11/22 12:23:15 tron Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: statd.c,v 1.18 2001/02/19 23:22:47 cgd Exp $");
+__RCSID("$NetBSD: statd.c,v 1.19 2001/11/22 12:23:15 tron Exp $");
#endif
/* main() function for status monitor daemon. Some of the code in this */
@@ -45,6 +45,7 @@
/* The actual program logic is in the file procs.c */
#include <sys/param.h>
+#include <sys/wait.h>
#include <err.h>
#include <ctype.h>
@@ -88,6 +89,7 @@
static void init_file __P((char *));
static int notify_one_host __P((char *));
static void die __P((int)) __attribute__((__noreturn__));
+static void sigchld_handler __P((int));
int main __P((int, char **));
@@ -98,6 +100,8 @@
{
int ch;
+ (void)signal(SIGCHLD, sigchld_handler);
+
while ((ch = getopt(argc, argv, "d")) != (-1)) {
switch (ch) {
case 'd':
@@ -623,3 +627,10 @@
(*db->close)(db);
exit(n);
}
+
+static void
+sigchld_handler(dontcare)
+ int dontcare;
+{
+ while (wait3(&dontcare, WNOHANG, NULL) > 0);
+}
Home |
Main Index |
Thread Index |
Old Index