-DSMALL will remove the need of dump.c (for rtsol)

Obtained from:	KAME
This commit is contained in:
ume 2004-01-14 17:59:38 +00:00
parent 7fa7bd6ad2
commit ff9ef7b641
2 changed files with 16 additions and 2 deletions

View File

@ -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

View File

@ -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)