From: Ted Lemon Date: Mon, 20 Oct 1997 22:11:44 +0000 (+0000) Subject: systat -> sysconf X-Git-Tag: NetBSD_1_3_Alpha~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60e173c0a201d7eca6efdf221b53374c71c4f913;p=thirdparty%2Fdhcp.git systat -> sysconf --- diff --git a/Makefile.dist b/Makefile.dist index f8e802e4c..724b9b061 100644 --- a/Makefile.dist +++ b/Makefile.dist @@ -30,7 +30,7 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. # -SUBDIRS= common server client relay statmsg systatd +SUBDIRS= common server client relay statmsg sysconfd all: @for dir in ${SUBDIRS}; do \ diff --git a/common/Makefile.dist b/common/Makefile.dist index dd32df0db..81f8969c8 100644 --- a/common/Makefile.dist +++ b/common/Makefile.dist @@ -32,11 +32,11 @@ SRC = raw.c parse.c nit.c icmp.c dispatch.c conflex.c upf.c bpf.c socket.c \ packet.c memory.c print.c options.c inet.c convert.c \ tree.c tables.c hash.c alloc.c errwarn.c inet_addr.c dns.c \ - resolv.c systat.c + resolv.c sysconf.c OBJ = raw.o parse.o nit.o icmp.o dispatch.o conflex.o upf.o bpf.o socket.o \ packet.o memory.o print.o options.o inet.o convert.o \ tree.o tables.o hash.o alloc.o errwarn.o inet_addr.o dns.o \ - resolv.o systat.o + resolv.o sysconf.o DEBUG = -g INCLUDES = -I.. -I../includes diff --git a/common/sysconf.c b/common/sysconf.c index fac3c06de..2795d006d 100644 --- a/common/sysconf.c +++ b/common/sysconf.c @@ -1,4 +1,4 @@ -/* systat.c +/* sysconf.c System status watcher... @@ -44,84 +44,84 @@ #ifndef lint static char copyright[] = -"$Id: sysconf.c,v 1.1 1997/09/16 18:15:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: sysconf.c,v 1.2 1997/10/20 22:10:59 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" -int systat_initialized; -int systat_fd; +int sysconf_initialized; +int sysconf_fd; -void systat_startup (handler) - void (*handler) PROTO ((struct systat_header *, void *)); +void sysconf_startup (handler) + void (*handler) PROTO ((struct sysconf_header *, void *)); { struct sockaddr_un name; static int once; - /* Only initialize systat once. */ - if (systat_initialized) - error ("attempted to reinitialize systat protocol"); - systat_initialized = 1; + /* Only initialize sysconf once. */ + if (sysconf_initialized) + error ("attempted to reinitialize sysconf protocol"); + sysconf_initialized = 1; - systat_fd = socket (AF_UNIX, SOCK_STREAM, 0); - if (systat_fd < 0) - error ("unable to create systat socket: %m"); + sysconf_fd = socket (AF_UNIX, SOCK_STREAM, 0); + if (sysconf_fd < 0) + error ("unable to create sysconf socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; - strcpy (name.sun_path, "/var/run/systat"); + strcpy (name.sun_path, "/var/run/sysconf"); name.sun_len = ((sizeof name) - (sizeof name.sun_path) + strlen (name.sun_path)); - if (connect (systat_fd, (struct sockaddr *)&name, name.sun_len) < 0) { + if (connect (sysconf_fd, (struct sockaddr *)&name, name.sun_len) < 0) { if (!once) - warn ("can't connect to systat socket: %m"); + warn ("can't connect to sysconf socket: %m"); once = 1; - close (systat_fd); - systat_initialized = 0; - add_timeout (cur_time + 60, systat_restart, handler); + close (sysconf_fd); + sysconf_initialized = 0; + add_timeout (cur_time + 60, sysconf_restart, handler); } else - add_protocol ("systat", systat_fd, systat_message, handler); + add_protocol ("sysconf", sysconf_fd, sysconf_message, handler); } -void systat_restart (v) +void sysconf_restart (v) void *v; { - void (*handler) PROTO ((struct systat_header *, void *)) = v; + void (*handler) PROTO ((struct sysconf_header *, void *)) = v; - systat_startup (handler); + sysconf_startup (handler); } -void systat_message (proto) +void sysconf_message (proto) struct protocol *proto; { - struct systat_header hdr; + struct sysconf_header hdr; int status; char *buf; - void (*handler) PROTO ((struct systat_header *, void *)); + void (*handler) PROTO ((struct sysconf_header *, void *)); - status = read (systat_fd, &hdr, sizeof hdr); + status = read (sysconf_fd, &hdr, sizeof hdr); if (status < 0) { - warn ("systat_message: %m"); + warn ("sysconf_message: %m"); lose: - add_timeout (cur_time + 60, systat_restart, proto -> local); + add_timeout (cur_time + 60, sysconf_restart, proto -> local); remove_protocol (proto); return; } if (status < sizeof (hdr)) { - warn ("systat_message: short message"); + warn ("sysconf_message: short message"); goto lose; } if (hdr.length) { buf = malloc (hdr.length); if (!buf) - error ("systat_message: can't buffer payload"); - status = read (systat_fd, buf, hdr.length); + error ("sysconf_message: can't buffer payload"); + status = read (sysconf_fd, buf, hdr.length); if (status < 0) - error ("systat_message payload read: %m"); + error ("sysconf_message payload read: %m"); if (status != hdr.length) - error ("systat_message payload: short read"); + error ("sysconf_message payload: short read"); } else buf = (char *)0; diff --git a/configure b/configure index 29a931e33..81d948982 100755 --- a/configure +++ b/configure @@ -68,7 +68,7 @@ fi echo "System Type: $sysname" -for foo in . client server relay statmsg systatd common; do +for foo in . client server relay statmsg sysconfd common; do (sed -e "/^##--${sysname}--/,/^##--${sysname}--/s/^#//" \ $foo/Makefile diff --git a/includes/dhcpd.h b/includes/dhcpd.h index b9433f651..202b17121 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -66,7 +66,7 @@ #include "tree.h" #include "hash.h" #include "inet.h" -#include "systat.h" +#include "sysconf.h" struct option_data { int len; @@ -825,7 +825,7 @@ int script_go PROTO ((struct interface_info *)); struct client_lease *packet_to_lease PROTO ((struct packet *)); void go_daemon PROTO ((void)); void write_client_pid_file PROTO ((void)); -void status_message PROTO ((struct systat_header *, void *)); +void status_message PROTO ((struct sysconf_header *, void *)); void client_location_changed PROTO ((void)); /* db.c */ @@ -934,7 +934,7 @@ struct sockaddr_in *pick_name_server PROTO ((void)); int inet_aton PROTO ((char *, struct in_addr *)); #endif -/* systat.c */ -void systat_startup PROTO ((void (*) (struct systat_header *, void *))); -void systat_restart PROTO ((void *)); -void systat_message PROTO ((struct protocol *proto)); +/* sysconf.c */ +void sysconf_startup PROTO ((void (*) (struct sysconf_header *, void *))); +void sysconf_restart PROTO ((void *)); +void sysconf_message PROTO ((struct protocol *proto)); diff --git a/sysconfd/Makefile.dist b/sysconfd/Makefile.dist index 57eb89855..169e8ed9e 100644 --- a/sysconfd/Makefile.dist +++ b/sysconfd/Makefile.dist @@ -31,9 +31,9 @@ # CATMANPAGES = -SRCS = systatd.c -OBJS = systatd.o -PROG = systatd +SRCS = sysconfd.c +OBJS = sysconfd.o +PROG = sysconfd MAN = DEBUG = -g @@ -44,14 +44,14 @@ CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) all: $(PROG) $(CATMANPAGES) install: $(PROG) $(CATMANPAGES) - $(INSTALL) systatd $(BINDIR) - $(CHMOD) 755 $(BINDIR)/systatd + $(INSTALL) sysconfd $(BINDIR) + $(CHMOD) 755 $(BINDIR)/sysconfd if [ ! -d $(ADMMANDIR) ]; then \ mkdir $(ADMMANDIR); \ chmod 755 $(ADMMANDIR); \ fi -# $(MANINSTALL) $(MANFROM) systatd.cat8 $(MANTO) \ -# $(ADMMANDIR)/systatd$(ADMMANEXT) +# $(MANINSTALL) $(MANFROM) sysconfd.cat8 $(MANTO) \ +# $(ADMMANDIR)/sysconfd$(ADMMANEXT) clean: -rm -f $(OBJS) @@ -66,10 +66,10 @@ distclean: realclean # macros aren't available on older unices. Catted man pages are # provided in the distribution so that this doesn't become a problem. -systatd.cat8: systatd.8 +sysconfd.cat8: sysconfd.8 sed -e "s#ETCDIR#$(ETC)#" -e "s#DBDIR#$(VARDB)#" \ - -e "s#RUNDIR#$(VARRUN)#" < systatd.8 \ - | nroff -man >systatd.cat8 + -e "s#RUNDIR#$(VARRUN)#" < sysconfd.8 \ + | nroff -man >sysconfd.cat8 $(PROG): $(OBJS) $(DHCPLIB) $(CC) $(LFLAGS) -o $(PROG) $(OBJS) $(DHCPLIB) $(LIBS) diff --git a/sysconfd/sysconfd.c b/sysconfd/sysconfd.c index caedb7f31..5d59816ef 100644 --- a/sysconfd/sysconfd.c +++ b/sysconfd/sysconfd.c @@ -1,6 +1,6 @@ /* main.c - System status daemon... + System configuration status daemon... !!!Boy, howdy, is this ever not guaranteed not to change!!! */ @@ -44,15 +44,15 @@ #ifndef lint static char copyright[] = -"$Id: sysconfd.c,v 1.1 1997/09/16 18:21:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: sysconfd.c,v 1.2 1997/10/20 22:11:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" -int systat_fd; +int sysconf_fd; -struct systat_client { - struct systat_client *next; +struct sysconf_client { + struct sysconf_client *next; int fd; } *clients; @@ -73,14 +73,14 @@ int main (argc, argv, envp) char **envp; { struct sockaddr_un name; - int systat_fd; + int sysconf_fd; int pid; #ifdef SYSLOG_4_2 - openlog ("systatd", LOG_NDELAY); + openlog ("sysconfd", LOG_NDELAY); log_priority = LOG_DAEMON; #else - openlog ("systatd", LOG_NDELAY, LOG_DAEMON); + openlog ("sysconfd", LOG_NDELAY, LOG_DAEMON); #endif #if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__)) @@ -88,24 +88,24 @@ int main (argc, argv, envp) #endif /* Make a socket... */ - systat_fd = socket (AF_UNIX, SOCK_STREAM, 0); - if (systat_fd < 0) - error ("unable to create systat socket: %m"); + sysconf_fd = socket (AF_UNIX, SOCK_STREAM, 0); + if (sysconf_fd < 0) + error ("unable to create sysconf socket: %m"); /* XXX for now... */ name.sun_family = PF_UNIX; - strcpy (name.sun_path, "/var/run/systat"); + strcpy (name.sun_path, "/var/run/sysconf"); name.sun_len = ((sizeof name) - (sizeof name.sun_path) + strlen (name.sun_path)); unlink (name.sun_path); /* Bind to it... */ - if (bind (systat_fd, (struct sockaddr *)&name, name.sun_len) < 0) - error ("can't bind to systat socket: %m"); + if (bind (sysconf_fd, (struct sockaddr *)&name, name.sun_len) < 0) + error ("can't bind to sysconf socket: %m"); /* Listen for connections... */ - if (listen (systat_fd, 1) < 0) - error ("can't listen on systat socket: %m"); + if (listen (sysconf_fd, 1) < 0) + error ("can't listen on sysconf socket: %m"); /* Stop logging to stderr... */ log_perror = 0; @@ -120,7 +120,7 @@ int main (argc, argv, envp) (void)setsid (); /* Set up a protocol structure for it... */ - add_protocol ("listener", systat_fd, new_connection, 0); + add_protocol ("listener", sysconf_fd, new_connection, 0); /* Kernel status stuff goes here... */ @@ -135,10 +135,10 @@ void new_connection (proto) { struct sockaddr_un name; int namelen; - struct systat_client *tmp; + struct sysconf_client *tmp; int new_fd; - tmp = (struct systat_client *)malloc (sizeof *tmp); + tmp = (struct sysconf_client *)malloc (sizeof *tmp); if (tmp < 0) error ("Can't find memory for new client!"); memset (tmp, 0, sizeof *tmp); @@ -158,11 +158,11 @@ void new_connection (proto) void client_input (proto) struct protocol *proto; { - struct systat_header hdr; + struct sysconf_header hdr; int status; char *buf; - void (*handler) PROTO ((struct systat_header *, void *)); - struct systat_client *client; + void (*handler) PROTO ((struct sysconf_header *, void *)); + struct sysconf_client *client; status = read (proto -> fd, &hdr, sizeof hdr); if (status < 0) {