Skip to content

Commit

Permalink
-DSMALL will remove the need of dump.c (for rtsol)
Browse files Browse the repository at this point in the history
Obtained from:	KAME
  • Loading branch information
Hajimu UMEMOTO authored and Hajimu UMEMOTO committed Jan 14, 2004
1 parent fcdaee3 commit 5538fd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sbin/rtsol/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions usr.sbin/rtsold/rtsold.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,23 @@ 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 *));
#endif
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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -281,6 +289,7 @@ main(int argc, char **argv)
/*NOTREACHED*/
}

#if 1
/* dump the current pid */
if (!once) {
pid_t pid = getpid();
Expand All @@ -295,6 +304,7 @@ main(int argc, char **argv)
fclose(fp);
}
}
#endif

#ifndef HAVE_POLL_H
memset(fdsetp, 0, fdmasks);
Expand All @@ -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();

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5538fd1

Please sign in to comment.