Commit 914f9c64 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

dump_exit_statistics(): new function.

main(): Moved some code to dump_exit_statistics.
dump_exit_statistics() now appends to the file, and writes the current
time to the file.
parent 0bd0415c
Tue Oct 29 03:52:34 1991 Per Cederqvist (ceder at robert)
* ramkomd.c (dump_exit_statistics): This function, which is only
run when the server is brought down nicely, writes some
statistics to a log file. The log file is now open in append
mode (and not overwrite mode...)
Mon Oct 21 23:14:22 1991 Per Cederqvist (ceder at robin)
* text.c (create_text): Check that the length of the text is no
......
/*
* $Id: ramkomd.c,v 0.23 1991/09/21 13:06:49 ceder Exp $
* $Id: ramkomd.c,v 0.24 1991/10/29 03:13:04 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -31,7 +31,7 @@
* It has grown! /ceder
*/
static char *rcsid = "$Id: ramkomd.c,v 0.23 1991/09/21 13:06:49 ceder Exp $";
static char *rcsid = "$Id: ramkomd.c,v 0.24 1991/10/29 03:13:04 ceder Exp $";
#include <m-config.h>
......@@ -52,6 +52,7 @@ static char *rcsid = "$Id: ramkomd.c,v 0.23 1991/09/21 13:06:49 ceder Exp $";
#include <netinet/in.h>
#include <unistd.h>
#include <misc.h>
#include <time.h>
#include "s-string.h"
#include <kom-types.h>
#include "string-malloc.h"
......@@ -98,6 +99,9 @@ int listen_mux = -1; /* -"- */
static char *dbase_dir = NULL; /* Directory where database resides */
static void
dump_exit_statistics(void);
static void
server_init( char * client_port, char * mux_port)
{
......@@ -237,7 +241,6 @@ main (int argc,
char **argv)
{
int i;
FILE *stat_file;
#ifdef HAVE_LOCALE
if (setlocale(LC_CTYPE, "iso_8859_1") == NULL)
......@@ -314,11 +317,27 @@ main (int argc,
isc_shutdown(kom_server_mcb);
cache_sync_all();
stat_file = fopen(memusefile, "w");
dump_exit_statistics();
log("ramkomd terminated normally.\n");
return 0;
}
static void
dump_exit_statistics(void)
{
FILE *stat_file;
time_t now;
time(&now);
stat_file = fopen(memusefile, "a");
if ( stat_file == NULL )
restart_kom("Can't open file to save memory usage to.\n");
fprintf(stat_file, "\nLysKOM Server going down at %s\n", ctime(&now));
dump_cache_stats (stat_file);
free_all_tmp();
......@@ -332,12 +351,8 @@ main (int argc,
dump_isc_message_counts(stat_file);
dump_isc_alloc_counts(stat_file);
fclose (stat_file);
log("ramkomd terminated normally.\n");
return 0;
}
void
restart_kom(const char * format, ...)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment