Use pidfile(3).
This commit is contained in:
parent
ad9c4f4fa5
commit
bcd4659148
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 @@ __COPYRIGHT(
|
|||
#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 @@ static char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
|
|||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
|
||||
#ifdef LIBWRAP
|
||||
# include <tcpd.h>
|
||||
|
@ -211,6 +212,7 @@ main(argc, argv)
|
|||
|
||||
if (!debugging && daemon(0, 0))
|
||||
err(1, "fork failed");
|
||||
pidfile(NULL);
|
||||
|
||||
openlog(__progname, debugging ? LOG_PID | LOG_PERROR : LOG_PID,
|
||||
LOG_DAEMON);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
|||
#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 @@ __RCSID("$NetBSD: rwhod.c,v 1.14 1998/07/08 15:17:57 mrg Exp $");
|
|||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
#include <utmp.h>
|
||||
|
||||
/*
|
||||
|
@ -132,6 +133,7 @@ main(argc, argv)
|
|||
errx(1, "udp/who: unknown service");
|
||||
#ifndef DEBUG
|
||||
daemon(1, 0);
|
||||
pidfile(NULL);
|
||||
#endif
|
||||
if (chdir(_PATH_RWHODIR) < 0)
|
||||
err(1, "%s", _PATH_RWHODIR);
|
||||
|
|
|
@ -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 @@ CPPFLAGS+=-DHAVE_FBIO
|
|||
PROG= screenblank
|
||||
MAN= screenblank.1
|
||||
|
||||
LDADD+= -lutil
|
||||
DPADD+= ${LIBUTIL}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 @@ __RCSID("$NetBSD: screenblank.c,v 1.9 1998/12/18 01:15:45 thorpej Exp $");
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <util.h>
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
|
||||
|
@ -93,7 +94,6 @@ int main __P((int, char *[]));
|
|||
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 @@ main(argc, argv)
|
|||
/* Detach. */
|
||||
if (daemon(0, 0))
|
||||
err(1, "daemon");
|
||||
logpid();
|
||||
pidfile(NULL);
|
||||
|
||||
/* Start the state machine. */
|
||||
for (;;) {
|
||||
|
@ -308,7 +308,6 @@ sighandler(sig)
|
|||
{
|
||||
|
||||
/* Kill the pid file and re-enable the framebuffer before exit. */
|
||||
(void)unlink(_PATH_SCREENBLANKPID);
|
||||
change_state(videoon);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -373,17 +372,6 @@ cvt_arg(arg, tvp)
|
|||
tvp->tv_usec = microseconds;
|
||||
}
|
||||
|
||||
static void
|
||||
logpid()
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if ((fp = fopen(_PATH_SCREENBLANKPID, "w")) != NULL) {
|
||||
fprintf(fp, "%u\n", getpid());
|
||||
(void)fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
|
|
|
@ -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 @@ __COPYRIGHT(
|
|||
#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 @@ __RCSID("$NetBSD: timed.c,v 1.10 1998/07/06 07:06:13 mrg Exp $");
|
|||
#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 @@ main(int argc, char **argv)
|
|||
#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)
|
||||
|
|
Loading…
Reference in New Issue