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/1c095b96d584
branches:  trunk
changeset: 473505:1c095b96d584
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jun 06 02:38:00 1999 +0000

description:
Use pidfile(3).

diffstat:

 usr.sbin/rpc.bootparamd/Makefile       |   6 +++---
 usr.sbin/rpc.bootparamd/bootparamd.c   |   6 ++++--
 usr.sbin/rpc.yppasswdd/rpc.yppasswdd.c |   4 +++-
 usr.sbin/ypbind/Makefile               |   5 ++++-
 usr.sbin/ypbind/ypbind.c               |   6 ++++--
 usr.sbin/ypserv/common/ypdef.h         |   3 +--
 usr.sbin/ypserv/ypserv/Makefile        |   6 +++---
 usr.sbin/ypserv/ypserv/ypserv.c        |  18 ++++--------------
 8 files changed, 26 insertions(+), 28 deletions(-)

diffs (211 lines):

diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/rpc.bootparamd/Makefile
--- a/usr.sbin/rpc.bootparamd/Makefile  Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/rpc.bootparamd/Makefile  Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.15 1997/10/25 06:58:36 lukem Exp $
+#      $NetBSD: Makefile,v 1.16 1999/06/06 02:47:47 thorpej Exp $
 
 PROG=  rpc.bootparamd
 SRCS=  bootparamd.c bootparam_prot_svc.c
@@ -6,8 +6,8 @@
 MLINKS=        rpc.bootparamd.8 bootparamd.8
 CPPFLAGS+=-DYP
 
-DPADD= ${LIBRPCSVC}
-LDADD= -lrpcsvc
+DPADD= ${LIBRPCSVC} ${LIBUTIL}
+LDADD= -lrpcsvc -lutil
 
 bootparam_prot_svc.c: ${DESTDIR}/usr/include/rpcsvc/bootparam_prot.x
        rm -f bootparam_prot.x
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/rpc.bootparamd/bootparamd.c
--- a/usr.sbin/rpc.bootparamd/bootparamd.c      Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/rpc.bootparamd/bootparamd.c      Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootparamd.c,v 1.19 1999/04/26 02:35:17 abs Exp $      */
+/*     $NetBSD: bootparamd.c,v 1.20 1999/06/06 02:47:48 thorpej Exp $  */
 
 /*
  * This code is not copyright, and is placed in the public domain.
@@ -11,7 +11,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: bootparamd.c,v 1.19 1999/04/26 02:35:17 abs Exp $");
+__RCSID("$NetBSD: bootparamd.c,v 1.20 1999/06/06 02:47:48 thorpej Exp $");
 #endif
 
 #include <sys/types.h>
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
+#include <util.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -117,6 +118,7 @@
                if (daemon(0, 0))
                        err(1, "can't detach from terminal");
        }
+       pidfile(NULL);
 
        (void) pmap_unset(BOOTPARAMPROG, BOOTPARAMVERS);
 
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/rpc.yppasswdd/rpc.yppasswdd.c
--- a/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.c    Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/rpc.yppasswdd/rpc.yppasswdd.c    Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc.yppasswdd.c,v 1.2 1997/07/18 07:47:30 thorpej Exp $        */
+/*     $NetBSD: rpc.yppasswdd.c,v 1.3 1999/06/06 02:44:52 thorpej Exp $        */
 
 /*
  * Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -40,6 +40,7 @@
 #include <string.h>
 #include <signal.h>
 #include <unistd.h>
+#include <util.h>
 
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
@@ -86,6 +87,7 @@
 
        if (daemon(0, 0))
                err(1, "can't detach");
+       pidfile(NULL);
 
        (void) pmap_unset(YPPASSWDPROG, YPPASSWDVERS);
 
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/ypbind/Makefile
--- a/usr.sbin/ypbind/Makefile  Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/ypbind/Makefile  Sun Jun 06 02:38:00 1999 +0000
@@ -1,8 +1,11 @@
-#      $NetBSD: Makefile,v 1.14 1997/10/25 06:58:56 lukem Exp $
+#      $NetBSD: Makefile,v 1.15 1999/06/06 02:38:00 thorpej Exp $
 #      from: @(#)Makefile      5.8 (Berkeley) 7/28/90
 
 PROG=  ypbind
 MAN=   ypbind.8
 CPPFLAGS+=-DHEURISTIC
 
+LDADD+=        -lutil
+DPADD+=        ${LIBUTIL}
+
 .include <bsd.prog.mk>
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/ypbind/ypbind.c
--- a/usr.sbin/ypbind/ypbind.c  Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/ypbind/ypbind.c  Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypbind.c,v 1.38 1999/02/12 15:04:01 kleink Exp $       */
+/*     $NetBSD: ypbind.c,v 1.39 1999/06/06 02:38:00 thorpej Exp $      */
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #ifndef LINT
-__RCSID("$NetBSD: ypbind.c,v 1.38 1999/02/12 15:04:01 kleink Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.39 1999/06/06 02:38:00 thorpej Exp $");
 #endif
 
 #include <sys/param.h>
@@ -70,6 +70,7 @@
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_rmt.h>
 #include <unistd.h>
+#include <util.h>
 #include <rpcsvc/yp_prot.h>
 #include <rpcsvc/ypclnt.h>
 
@@ -636,6 +637,7 @@
                        if (!debug)
 #endif
                                daemon(0, 0);
+                       pidfile(NULL);
                }
        }
 }
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/ypserv/common/ypdef.h
--- a/usr.sbin/ypserv/common/ypdef.h    Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/ypserv/common/ypdef.h    Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypdef.h,v 1.2 1999/01/22 02:37:00 thorpej Exp $        */
+/*     $NetBSD: ypdef.h,v 1.3 1999/06/06 02:43:04 thorpej Exp $        */
 
 /*
  * Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -71,6 +71,5 @@
 #endif
 
 #define YPXFR_PROC     "/usr/sbin/ypxfr"
-#define YPSERV_PID_PATH        "/var/run/ypserv.pid"
 
 #endif /* !_YPDEF_H_ */
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/ypserv/ypserv/Makefile
--- a/usr.sbin/ypserv/ypserv/Makefile   Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/ypserv/ypserv/Makefile   Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.11 1999/01/22 02:36:12 thorpej Exp $
+#      $NetBSD: Makefile,v 1.12 1999/06/06 02:43:05 thorpej Exp $
 
 PROG=  ypserv
 SRCS=  ypserv.c ypserv_proc.c ypserv_db.c ypserv_xdr.c \
@@ -10,8 +10,8 @@
 CPPFLAGS+=-DYY_NO_UNPUT -DOPTIMIZE_DB -DLIBWRAP -I. -I${LIBCDIR}/include
 YHEADER=1
 
-LDADD+=        -lwrap
-DPADD+=        ${LIBWRAP}
+LDADD+=        -lwrap -lutil
+DPADD+=        ${LIBWRAP} ${LIBUTIL}
 
 .include <bsd.prog.mk>
 
diff -r d05271db72c8 -r 1c095b96d584 usr.sbin/ypserv/ypserv/ypserv.c
--- a/usr.sbin/ypserv/ypserv/ypserv.c   Sun Jun 06 02:00:32 1999 +0000
+++ b/usr.sbin/ypserv/ypserv/ypserv.c   Sun Jun 06 02:38:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ypserv.c,v 1.9 1999/02/18 06:03:47 abs Exp $   */
+/*     $NetBSD: ypserv.c,v 1.10 1999/06/06 02:43:05 thorpej Exp $      */
 
 /*
  * Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ypserv.c,v 1.9 1999/02/18 06:03:47 abs Exp $");
+__RCSID("$NetBSD: ypserv.c,v 1.10 1999/06/06 02:43:05 thorpej Exp $");
 #endif
 
 #include <sys/types.h>
@@ -50,6 +50,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
+#include <util.h>
 
 #include <rpc/rpc.h>
 #include <rpc/xdr.h>
@@ -357,18 +358,7 @@
 
        openlog(__progname, LOG_PID, LOG_DAEMON);
        syslog(LOG_INFO, "starting");
-
-       {
-               FILE *pidfile = fopen(YPSERV_PID_PATH, "w");
-
-               if (pidfile != NULL) {
-                       fprintf(pidfile, "%d\n", getpid());
-                       fclose(pidfile);
-               } else {
-                       _msgout("can't write PID file: %m");
-                       exit(1);
-               }
-       }
+       pidfile(NULL);
 
        sock = RPC_ANYSOCK;
        (void) pmap_unset(YPPROG, YPVERS);



Home | Main Index | Thread Index | Old Index