Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin Use pidfile(3).
details: https://anonhg.NetBSD.org/src/rev/c02e732699b8
branches: trunk
changeset: 473506:c02e732699b8
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Jun 06 02:52:16 1999 +0000
description:
Use pidfile(3).
diffstat:
usr.sbin/apmd/Makefile | 5 ++++-
usr.sbin/apmd/apmd.c | 4 +++-
usr.sbin/mopd/mopd/Makefile | 5 ++++-
usr.sbin/mopd/mopd/mopd.c | 7 +++++--
usr.sbin/rarpd/Makefile | 4 +++-
usr.sbin/rarpd/pathnames.h | 31 -------------------------------
usr.sbin/rarpd/rarpd.c | 21 +++++----------------
usr.sbin/rbootd/Makefile | 5 ++++-
usr.sbin/rbootd/conf.c | 5 ++---
usr.sbin/rbootd/defs.h | 3 +--
usr.sbin/rbootd/rbootd.c | 22 ++++------------------
usr.sbin/rpc.lockd/Makefile | 6 +++---
usr.sbin/rpc.lockd/lockd.c | 6 ++++--
usr.sbin/rpc.statd/Makefile | 6 +++---
usr.sbin/rpc.statd/statd.c | 6 ++++--
15 files changed, 49 insertions(+), 87 deletions(-)
diffs (truncated from 434 to 300 lines):
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/apmd/Makefile
--- a/usr.sbin/apmd/Makefile Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/apmd/Makefile Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 1997/10/18 06:42:35 lukem Exp $
+# $NetBSD: Makefile,v 1.6 1999/06/06 03:17:23 thorpej Exp $
.if ${MACHINE} == "i386"
PROG= apmd
@@ -8,4 +8,7 @@
MAN= apmd.8
MANSUBDIR=/i386
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
+
.include <bsd.prog.mk>
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/apmd/apmd.c
--- a/usr.sbin/apmd/apmd.c Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/apmd/apmd.c Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apmd.c,v 1.10 1998/12/19 15:27:58 christos Exp $ */
+/* $NetBSD: apmd.c,v 1.11 1999/06/06 03:17:23 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
#include <syslog.h>
#include <fcntl.h>
#include <unistd.h>
+#include <util.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
@@ -390,6 +391,7 @@
openlog(__progname, LOG_CONS, LOG_DAEMON);
setlogmask(LOG_UPTO(LOG_NOTICE));
daemon(0, 0);
+ pidfile(NULL);
}
if (statonly) {
power_status(ctl_fd, 1, 0);
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/mopd/mopd/Makefile
--- a/usr.sbin/mopd/mopd/Makefile Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/mopd/mopd/Makefile Sun Jun 06 02:52:16 1999 +0000
@@ -1,7 +1,10 @@
-# $NetBSD: Makefile,v 1.7 1997/10/16 07:36:58 lukem Exp $
+# $NetBSD: Makefile,v 1.8 1999/06/06 03:21:43 thorpej Exp $
PROG= mopd
SRCS= mopd.c process.c
MAN= mopd.8
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
+
.include <bsd.prog.mk>
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/mopd/mopd/mopd.c
--- a/usr.sbin/mopd/mopd/mopd.c Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/mopd/mopd/mopd.c Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mopd.c,v 1.5 1997/10/16 23:25:17 lukem Exp $ */
+/* $NetBSD: mopd.c,v 1.6 1999/06/06 03:21:43 thorpej Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mopd.c,v 1.5 1997/10/16 23:25:17 lukem Exp $");
+__RCSID("$NetBSD: mopd.c,v 1.6 1999/06/06 03:21:43 thorpej Exp $");
#endif
/*
@@ -53,6 +53,8 @@
#include "process.h"
#include "rc.h"
+#include <util.h>
+
/*
* The list of all interfaces that are being listened to.
* "selects" on the descriptors in this list.
@@ -141,6 +143,7 @@
/* Fade into the background */
daemon(0, 0);
+ pidfile(NULL);
}
syslog(LOG_INFO, "%s %s started.", __progname, version);
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rarpd/Makefile
--- a/usr.sbin/rarpd/Makefile Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rarpd/Makefile Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 1997/11/24 18:43:19 is Exp $
+# $NetBSD: Makefile,v 1.8 1999/06/06 02:58:22 thorpej Exp $
PROG= rarpd
SRCS= rarpd.c mkarp.c
@@ -8,5 +8,7 @@
# to exist for a rarp reply to be sent.
# CPPFLAGS+=-DREQUIRE_TFTPBOOT -DTFTP_DIR=\"/tftpboot\"
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
.include <bsd.prog.mk>
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rarpd/pathnames.h
--- a/usr.sbin/rarpd/pathnames.h Sun Jun 06 02:38:00 1999 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/* $NetBSD: pathnames.h,v 1.1 1998/04/23 02:48:33 mrg Exp $ */
-
-/*
- * Copyright (c) 1998 Matthew R. Green
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
- #define _PATH_RARPDPID "/var/run/rarpd.pid"
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rarpd/rarpd.c
--- a/usr.sbin/rarpd/rarpd.c Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rarpd/rarpd.c Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rarpd.c,v 1.32 1999/02/13 19:58:29 thorpej Exp $ */
+/* $NetBSD: rarpd.c,v 1.33 1999/06/06 02:58:23 thorpej Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -28,7 +28,7 @@
#endif /* not lint */
#ifndef lint
-__RCSID("$NetBSD: rarpd.c,v 1.32 1999/02/13 19:58:29 thorpej Exp $");
+__RCSID("$NetBSD: rarpd.c,v 1.33 1999/06/06 02:58:23 thorpej Exp $");
#endif
@@ -69,8 +69,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
-
-#include "pathnames.h"
+#include <util.h>
#define FATAL 1 /* fatal error occurred */
#define NONFATAL 0 /* non fatal error occurred */
@@ -176,16 +175,9 @@
init_one(ifname, INADDR_ANY);
if ((!fflag) && (!dflag)) {
- FILE *fp;
-
if (daemon(0, 0))
rarperr(FATAL, "daemon");
-
- /* write pid file */
- if ((fp = fopen(_PATH_RARPDPID, "w")) != NULL) {
- fprintf(fp, "%u\n", getpid());
- (void)fclose(fp);
- }
+ pidfile(NULL);
}
rarp_loop();
/* NOTREACHED */
@@ -738,7 +730,6 @@
*addrp = ((struct sockaddr_in *) & ifr.ifr_addr)->sin_addr.s_addr;
if (ioctl(fd, SIOCGIFNETMASK, (char *) &ifr) < 0) {
perror("SIOCGIFNETMASK");
- unlink(_PATH_RARPDPID);
exit(1);
}
*netmaskp = ((struct sockaddr_in *) & ifr.ifr_addr)->sin_addr.s_addr;
@@ -952,10 +943,8 @@
}
vsyslog(LOG_ERR, fmt, ap);
va_end(ap);
- if (fatal) {
- unlink(_PATH_RARPDPID);
+ if (fatal)
exit(1);
- }
/* NOTREACHED */
}
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rbootd/Makefile
--- a/usr.sbin/rbootd/Makefile Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rbootd/Makefile Sun Jun 06 02:52:16 1999 +0000
@@ -1,8 +1,11 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
-# $NetBSD: Makefile,v 1.6 1997/10/17 12:49:57 lukem Exp $
+# $NetBSD: Makefile,v 1.7 1999/06/06 03:11:40 thorpej Exp $
PROG= rbootd
SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c
MAN= rbootd.8
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
+
.include <bsd.prog.mk>
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rbootd/conf.c
--- a/usr.sbin/rbootd/conf.c Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rbootd/conf.c Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.6 1997/07/28 05:39:18 thorpej Exp $ */
+/* $NetBSD: conf.c,v 1.7 1999/06/06 03:11:40 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -51,7 +51,7 @@
#if 0
static char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: conf.c,v 1.6 1997/07/28 05:39:18 thorpej Exp $");
+__RCSID("$NetBSD: conf.c,v 1.7 1999/06/06 03:11:40 thorpej Exp $");
#endif
#endif /* not lint */
@@ -73,7 +73,6 @@
*/
char MyHost[MAXHOSTNAMELEN+1]; /* host name */
-pid_t MyPid; /* process id */
int DebugFlg = 0; /* set true if debugging */
int BootAny = 0; /* set true if we boot anyone */
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rbootd/defs.h
--- a/usr.sbin/rbootd/defs.h Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rbootd/defs.h Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.6 1998/07/06 06:57:52 mrg Exp $ */
+/* $NetBSD: defs.h,v 1.7 1999/06/06 03:11:40 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -129,7 +129,6 @@
* All these variables are defined in "conf.c".
*/
extern char MyHost[MAXHOSTNAMELEN+1]; /* this hosts' name */
-extern pid_t MyPid; /* this processes' ID */
extern int DebugFlg; /* set true if debugging */
extern int BootAny; /* set true if we can boot anyone */
diff -r 1c095b96d584 -r c02e732699b8 usr.sbin/rbootd/rbootd.c
--- a/usr.sbin/rbootd/rbootd.c Sun Jun 06 02:38:00 1999 +0000
+++ b/usr.sbin/rbootd/rbootd.c Sun Jun 06 02:52:16 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rbootd.c,v 1.9 1998/07/06 06:57:52 mrg Exp $ */
+/* $NetBSD: rbootd.c,v 1.10 1999/06/06 03:11:40 thorpej Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -57,7 +57,7 @@
#if 0
static char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: rbootd.c,v 1.9 1998/07/06 06:57:52 mrg Exp $");
+__RCSID("$NetBSD: rbootd.c,v 1.10 1999/06/06 03:11:40 thorpej Exp $");
#endif
#endif /* not lint */
@@ -73,6 +73,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <util.h>
#include "defs.h"
int main __P((int, char *[]));
@@ -137,6 +138,7 @@
} else {
if (daemon(0, 0))
err(1, "can't detach from terminal");
+ pidfile(NULL);
Home |
Main Index |
Thread Index |
Old Index