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/d58cd5a41fdd
branches:  trunk
changeset: 473508:d58cd5a41fdd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 06 03:27:35 1999 +0000

description:
Use pidfile(3).

diffstat:

 usr.sbin/mrouted/pathnames.h       |   4 +---
 usr.sbin/portmap/Makefile          |   6 +++---
 usr.sbin/portmap/portmap.c         |   6 ++++--
 usr.sbin/rwhod/Makefile            |   5 ++++-
 usr.sbin/rwhod/rwhod.c             |   4 +++-
 usr.sbin/screenblank/Makefile      |   5 ++++-
 usr.sbin/screenblank/pathnames.h   |   4 +---
 usr.sbin/screenblank/screenblank.c |  20 ++++----------------
 usr.sbin/timed/timed/timed.c       |  11 +++++++----
 9 files changed, 31 insertions(+), 34 deletions(-)

diffs (265 lines):

diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/mrouted/pathnames.h
--- a/usr.sbin/mrouted/pathnames.h      Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/mrouted/pathnames.h      Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pathnames.h,v 1.4 1995/12/10 10:07:08 mycroft Exp $    */
+/*     $NetBSD: pathnames.h,v 1.5 1999/06/06 03:27:35 thorpej Exp $    */
 
 /*
  * The mrouted program is covered by the license in the accompanying file
@@ -12,12 +12,10 @@
 #define _PATH_MROUTED_CONF     "/etc/mrouted.conf"
 
 #if (defined(BSD) && (BSD >= 199103))
-#define _PATH_MROUTED_PID      "/var/run/mrouted.pid"
 #define _PATH_MROUTED_GENID    "/var/run/mrouted.genid"
 #define _PATH_MROUTED_DUMP     "/var/tmp/mrouted.dump"
 #define _PATH_MROUTED_CACHE    "/var/tmp/mrouted.cache"
 #else
-#define _PATH_MROUTED_PID      "/etc/mrouted.pid"
 #define _PATH_MROUTED_GENID    "/etc/mrouted.genid"
 #define _PATH_MROUTED_DUMP     "/usr/tmp/mrouted.dump"
 #define _PATH_MROUTED_CACHE    "/usr/tmp/mrouted.cache"
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/portmap/Makefile
--- a/usr.sbin/portmap/Makefile Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/portmap/Makefile Sun Jun 06 03:27:35 1999 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: Makefile,v 1.9 1999/01/11 20:51:09 jwise Exp $
+#      $NetBSD: Makefile,v 1.10 1999/06/06 03:29:14 thorpej Exp $
 #      from: @(#)Makefile      8.1 (Berkeley) 6/6/93
 
 PROG=  portmap
 MAN=   portmap.8
 
 CPPFLAGS+=-DLIBWRAP
-LDADD+= -lwrap
-DPADD+= ${LIBWRAP}
+LDADD+= -lwrap -lutil
+DPADD+= ${LIBWRAP} ${LIBUTIL}
 
 .include <bsd.prog.mk>
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/portmap/portmap.c
--- a/usr.sbin/portmap/portmap.c        Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/portmap/portmap.c        Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: portmap.c,v 1.20 1999/04/12 17:29:31 drochner Exp $    */
+/*     $NetBSD: portmap.c,v 1.21 1999/06/06 03:29:14 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)portmap.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: portmap.c,v 1.20 1999/04/12 17:29:31 drochner Exp $");
+__RCSID("$NetBSD: portmap.c,v 1.21 1999/06/06 03:29:14 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,6 +109,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
+#include <util.h>
 
 #ifdef LIBWRAP
 # include <tcpd.h>
@@ -211,6 +212,7 @@
 
        if (!debugging && daemon(0, 0))
                err(1, "fork failed");
+       pidfile(NULL);
 
        openlog(__progname, debugging ? LOG_PID | LOG_PERROR : LOG_PID,
            LOG_DAEMON);
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/rwhod/Makefile
--- a/usr.sbin/rwhod/Makefile   Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/rwhod/Makefile   Sun Jun 06 03:27:35 1999 +0000
@@ -1,7 +1,10 @@
 #      from: @(#)Makefile      5.3 (Berkeley) 5/11/90
-#      $NetBSD: Makefile,v 1.8 1997/10/18 04:38:04 lukem Exp $
+#      $NetBSD: Makefile,v 1.9 1999/06/06 03:33:08 thorpej Exp $
 
 PROG=  rwhod
 MAN=   rwhod.8
 
+LDADD+=        -lutil
+DPADD+=        ${LIBUTIL}
+
 .include <bsd.prog.mk>
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/rwhod/rwhod.c
--- a/usr.sbin/rwhod/rwhod.c    Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/rwhod/rwhod.c    Sun Jun 06 03:27:35 1999 +0000
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)rwhod.c    8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: rwhod.c,v 1.14 1998/07/08 15:17:57 mrg Exp $");
+__RCSID("$NetBSD: rwhod.c,v 1.15 1999/06/06 03:33:08 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -70,6 +70,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
+#include <util.h>
 #include <utmp.h>
 
 /*
@@ -132,6 +133,7 @@
                errx(1, "udp/who: unknown service");
 #ifndef DEBUG
        daemon(1, 0);
+       pidfile(NULL);
 #endif
        if (chdir(_PATH_RWHODIR) < 0)
                err(1, "%s", _PATH_RWHODIR);
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/screenblank/Makefile
--- a/usr.sbin/screenblank/Makefile     Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/screenblank/Makefile     Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.7 1998/12/18 01:15:43 thorpej Exp $
+#      $NetBSD: Makefile,v 1.8 1999/06/06 03:35:36 thorpej Exp $
 #      @(#)Makefile    8.1 (Berkeley) 5/31/93
 
 .if ${MACHINE} == "pmax" || ${MACHINE} == "sun3" || ${MACHINE} == "sun3x"\
@@ -9,4 +9,7 @@
 PROG=  screenblank
 MAN=   screenblank.1
 
+LDADD+=        -lutil
+DPADD+=        ${LIBUTIL}
+
 .include <bsd.prog.mk>
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/screenblank/pathnames.h
--- a/usr.sbin/screenblank/pathnames.h  Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/screenblank/pathnames.h  Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pathnames.h,v 1.4 1998/12/18 01:15:45 thorpej Exp $    */
+/*     $NetBSD: pathnames.h,v 1.5 1999/06/06 03:35:36 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -36,8 +36,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define _PATH_SCREENBLANKPID   "/var/run/screenblank.pid"
-
 #ifdef HAVE_FBIO
 #define        _PATH_KEYBOARD          "/dev/kbd"
 #define _PATH_MOUSE            "/dev/mouse"
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/screenblank/screenblank.c
--- a/usr.sbin/screenblank/screenblank.c        Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/screenblank/screenblank.c        Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: screenblank.c,v 1.9 1998/12/18 01:15:45 thorpej Exp $  */
+/*     $NetBSD: screenblank.c,v 1.10 1999/06/06 03:35:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
 __COPYRIGHT(
 "@(#) Copyright (c) 1996, 1998 \
        The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: screenblank.c,v 1.9 1998/12/18 01:15:45 thorpej Exp $");
+__RCSID("$NetBSD: screenblank.c,v 1.10 1999/06/06 03:35:36 thorpej Exp $");
 #endif
 
 #include <sys/types.h>
@@ -65,6 +65,7 @@
 #include <string.h>
 #include <signal.h>
 #include <unistd.h>
+#include <util.h>
 
 #include <dev/wscons/wsconsio.h>
 
@@ -93,7 +94,6 @@
 static void add_dev __P((const char *, int));
 static void change_state __P((int));
 static void cvt_arg __P((char *, struct timeval *));
-static void logpid __P((void));
 static void sighandler __P((int));
 static void usage __P((void));
 
@@ -219,7 +219,7 @@
        /* Detach. */
        if (daemon(0, 0))
                err(1, "daemon");
-       logpid();
+       pidfile(NULL);
 
        /* Start the state machine. */
        for (;;) {
@@ -308,7 +308,6 @@
 {
 
        /* Kill the pid file and re-enable the framebuffer before exit. */
-       (void)unlink(_PATH_SCREENBLANKPID);
        change_state(videoon);
        exit(0);
 }
@@ -374,17 +373,6 @@
 }
 
 static void
-logpid()
-{
-       FILE *fp;
-
-       if ((fp = fopen(_PATH_SCREENBLANKPID, "w")) != NULL) {
-               fprintf(fp, "%u\n", getpid());
-               (void)fclose(fp);
-       }
-}
-
-static void
 usage()
 {
 
diff -r f2dff18dff93 -r d58cd5a41fdd usr.sbin/timed/timed/timed.c
--- a/usr.sbin/timed/timed/timed.c      Sun Jun 06 03:27:06 1999 +0000
+++ b/usr.sbin/timed/timed/timed.c      Sun Jun 06 03:27:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: timed.c,v 1.10 1998/07/06 07:06:13 mrg Exp $   */
+/*     $NetBSD: timed.c,v 1.11 1999/06/06 03:37:28 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -44,12 +44,12 @@
 #if 0
 static char sccsid[] = "@(#)timed.c    8.2 (Berkeley) 3/26/95";
 #else
-__RCSID("$NetBSD: timed.c,v 1.10 1998/07/06 07:06:13 mrg Exp $");
+__RCSID("$NetBSD: timed.c,v 1.11 1999/06/06 03:37:28 thorpej Exp $");
 #endif
 #endif /* not lint */
 
 #ifdef sgi
-#ident "$Revision: 1.10 $"
+#ident "$Revision: 1.11 $"
 #endif /* sgi */
 
 #define TSPTYPES
@@ -67,6 +67,7 @@
 #include <sys/syssgi.h>
 #include <sys/schedctl.h>
 #endif /* sgi */
+#include <util.h>
 
 int trace = 0;
 int sock, sock_raw = -1;
@@ -499,8 +500,10 @@
 #ifdef sgi
        (void)_daemonize(debug ? _DF_NOFORK|_DF_NOCHDIR : 0, sock, -1, -1);
 #else
-       if (!debug)
+       if (!debug) {
                daemon(debug, 0);
+               pidfile(NULL);
+       }
 #endif /* sgi */
 
        if (trace)



Home | Main Index | Thread Index | Old Index