From ff9ef7b64130048cb0de17257700f769628cf27c Mon Sep 17 00:00:00 2001 From: ume Date: Wed, 14 Jan 2004 17:59:38 +0000 Subject: [PATCH] -DSMALL will remove the need of dump.c (for rtsol) Obtained from: KAME --- sbin/rtsol/Makefile | 4 ++-- usr.sbin/rtsold/rtsold.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sbin/rtsol/Makefile b/sbin/rtsol/Makefile index d6baa1e64c2b..c68ef2dafd61 100644 --- a/sbin/rtsol/Makefile +++ b/sbin/rtsol/Makefile @@ -16,9 +16,9 @@ SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold PROG= rtsol -SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c +SRCS= rtsold.c rtsol.c if.c probe.c rtsock.c -CFLAGS+=-DINET6 -DHAVE_ARC4RANDOM -DHAVE_POLL_H +CFLAGS+=-DINET6 -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL WARNS= 0 NOMAN= yes diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c index bfdbc68e62e4..f9dca79537dd 100644 --- a/usr.sbin/rtsold/rtsold.c +++ b/usr.sbin/rtsold/rtsold.c @@ -84,9 +84,13 @@ int main __P((int, char **)); /* static variables and functions */ static int mobile_node = 0; +#ifndef SMALL static int do_dump; static char *dumpfilename = "/var/run/rtsold.dump"; /* XXX: should be configurable */ +#endif +#if 1 static char *pidfilename = "/var/run/rtsold.pid"; /* should be configurable */ +#endif #if 0 static int ifreconfig __P((char *)); @@ -94,7 +98,9 @@ static int ifreconfig __P((char *)); static int make_packet __P((struct ifinfo *)); static struct timeval *rtsol_check_timer __P((void)); +#ifndef SMALL static void rtsold_set_dump_file __P((int)); +#endif static void usage __P((char *)); int @@ -202,8 +208,10 @@ main(int argc, char **argv) warnx("kernel is configured as a router, not a host"); } +#ifndef SMALL /* initialization to dump internal status to a file */ signal(SIGUSR1, rtsold_set_dump_file); +#endif if (!fflag) daemon(0, 0); /* act as a daemon */ @@ -281,6 +289,7 @@ main(int argc, char **argv) /*NOTREACHED*/ } +#if 1 /* dump the current pid */ if (!once) { pid_t pid = getpid(); @@ -295,6 +304,7 @@ main(int argc, char **argv) fclose(fp); } } +#endif #ifndef HAVE_POLL_H memset(fdsetp, 0, fdmasks); @@ -308,10 +318,12 @@ main(int argc, char **argv) memcpy(selectfdp, fdsetp, fdmasks); #endif +#ifndef SMALL if (do_dump) { /* SIGUSR1 */ do_dump = 0; rtsold_dump_file(dumpfilename); } +#endif timeout = rtsol_check_timer(); @@ -719,11 +731,13 @@ rtsol_timer_update(struct ifinfo *ifinfo) /* timer related utility functions */ #define MILLION 1000000 +#ifndef SMALL static void rtsold_set_dump_file(int sig) { do_dump = 1; } +#endif static void usage(char *progname)