summaryrefslogtreecommitdiff
path: root/server/main.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1988-02-28 08:20:29 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1988-02-28 08:20:29 +0000
commitfd0be6b8b797a2673631687bbd81c1880c12175c (patch)
tree193a8f76c9e2ccb6ca3552a9279ac58beed8cad6 /server/main.c
parent03568ec7e22092452630d694182db032ae886099 (diff)
increment version number
add support for ascii database dumps
Diffstat (limited to 'server/main.c')
-rw-r--r--server/main.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/server/main.c b/server/main.c
index 91331d1..9c5e918 100644
--- a/server/main.c
+++ b/server/main.c
@@ -6,7 +6,7 @@
* $Source$
* $Author$
*
- * Copyright (c) 1987 by the Massachusetts Institute of Technology.
+ * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
* "mit-copyright.h".
*/
@@ -20,9 +20,9 @@ char copyright[] = "Copyright (c) 1987 Massachusetts Institute of Technology.\nP
#endif SABER
#endif lint
#ifdef DEBUG
-char version[] = "Zephyr Server (DEBUG) 2.5";
+char version[] = "Zephyr Server (DEBUG) 2.6;
#else
-char version[] = "Zephyr Server 2.5";
+char version[] = "Zephyr Server 2.6";
#endif DEBUG
#ifdef CONCURRENT
char concurrent[] = "Brain-dump concurrency enabled";
@@ -66,6 +66,7 @@ char concurrent[] = "no brain-dump concurrency";
<sys/file.h>
<syslog.h>
<strings.h>
+ <signal.h>
timer.h
zsrv_err.h
*/
@@ -74,7 +75,6 @@ char concurrent[] = "no brain-dump concurrency";
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/ioctl.h>
-#include <signal.h>
#include <sys/resource.h>
#define EVER (;;) /* don't stop looping */
@@ -82,7 +82,7 @@ char concurrent[] = "no brain-dump concurrency";
static int do_net_setup(), initialize();
static void usage();
static int bye();
-static void dbug_on(), dbug_off();
+static void dbug_on(), dbug_off(), dump_db();
#ifndef DEBUG
static void detach();
#endif DEBUG
@@ -211,6 +211,7 @@ char **argv;
#endif DEBUG
(void) signal(SIGUSR1, dbug_on);
(void) signal(SIGUSR2, dbug_off);
+ (void) signal(SIGFPE, dump_db);
/* GO! */
uptime = NOW;
@@ -407,6 +408,27 @@ dbug_off()
zdebug = 0;
}
+static void
+dump_db()
+{
+ /* dump the in-core database to human-readable form on disk */
+ FILE *fp;
+
+ if ((fp = fopen("/usr/tmp/zephyr.db", "w")) == (FILE *)0) {
+ syslog(LOG_ERR, "can't open dump database");
+ return;
+ }
+ syslog(LOG_INFO, "dumping to disk");
+ server_dump_servers(fp);
+ uloc_dump_locs(fp);
+ hostm_dump_hosts(fp);
+ syslog(LOG_INFO, "dump done");
+ if (fclose(fp) == EOF) {
+ syslog(LOG_ERR, "can't close dump db");
+ }
+ return;
+}
+
#ifndef DEBUG
/*
* detach from the terminal