Commit 5fe78896 authored by David Byers's avatar David Byers

Documentation

        Fixed uses of @code in texinfo manuals

Database
        Added timestamp to database file format
parent 9a38757d
No preview for this file type
This diff is collapsed.
This diff is collapsed.
/*
* $Id: connections.c,v 0.61 1999/05/21 11:36:44 byers Exp $
* $Id: connections.c,v 0.62 1999/05/23 13:05:12 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -36,7 +36,7 @@
#endif
static const char *
rcsid = "$Id: connections.c,v 0.61 1999/05/21 11:36:44 byers Exp $";
rcsid = "$Id: connections.c,v 0.62 1999/05/23 13:05:12 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -659,6 +659,7 @@ message_request(IscEvent *event)
void
toploop(void)
{
time_t last_time;
IscEvent * event;
Bool pending_input = TRUE; /* Should be TRUE whenever there
is or might be pending input
......@@ -678,7 +679,14 @@ toploop(void)
event = isc_getnextevent(kom_server_mcb,
pending_input ? 0 : timeout );
last_time = current_time;
current_time = time(NULL);
if (current_time < last_time)
{
kom_log("WARNING: Time is moving in the wrong direction");
/* FIXME: Should we take more decisive action here */
}
timeout = 0;
if ( event == NULL )
......
/*
* $Id: dbck-cache.c,v 0.38 1999/05/12 13:25:06 byers Exp $
* $Id: dbck-cache.c,v 0.39 1999/05/23 13:05:13 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -39,7 +39,7 @@
static const char *
rcsid = "$Id: dbck-cache.c,v 0.38 1999/05/12 13:25:06 byers Exp $";
rcsid = "$Id: dbck-cache.c,v 0.39 1999/05/23 13:05:13 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -536,8 +536,11 @@ is_clean(const char *fn)
if ( (fp = fopen(fn, "rb")) == NULL )
return FALSE;
if ( getc(fp) == 'C' && getc(fp) == 'L' && getc(fp) == 'E'
&& getc(fp) == 'A' && getc(fp) == 'N' )
if ( getc(fp) == 'C' &&
getc(fp) == 'L' &&
getc(fp) == 'E' &&
getc(fp) == 'A' &&
getc(fp) == 'N' )
{
fclose(fp);
return TRUE;
......@@ -549,6 +552,29 @@ is_clean(const char *fn)
}
}
static void
sync_output_header(FILE* fp, char *state, int oformat)
{
switch (oformat)
{
case 0:
fprintf(fp, "DIRTY\n");
break;
case 1:
fprintf(fp, "DIRTY:%05ld\n", (long)oformat);
break;
case 2:
fprintf(fp, "DIRTY:%05ld\n", (long)oformat);
fprintf(fp, "%020lu\n", (unsigned long)time(NULL));
break;
default:
restart_kom("sync_output_header(): Unknown output format %d",
oformat);
}
}
#ifdef TIME_SYNC
static long
timerdiff(struct timeval a,
......@@ -606,11 +632,12 @@ cache_sync_all(void)
switch (oformat)
{
case 0:
fprintf(fp, "DIRTY\n"); /* DIRTY-FLAG */
sync_output_header(fp, "DIRTY", oformat);
fprintf(fp, "%d\n", next_free_num); /* NEXT_FREE_NUM */
break;
case 1:
fprintf(fp, "DIRTY:%05ld\n", oformat);
case 2:
sync_output_header(fp, "DIRTY", oformat);
fprintf(fp, "#C %d\n", next_free_num);
fprintf(fp, "#T %ld\n", next_text_num);
fprintf(fp, "I");
......@@ -636,6 +663,7 @@ cache_sync_all(void)
putc('\n', fp);
break;
case 1:
case 2:
if ( conf_arr[ i ] != NULL )
{
fprintf(fp, "C %lu", i);
......@@ -669,6 +697,7 @@ cache_sync_all(void)
putc('\n', fp);
break;
case 1:
case 2:
if ( pers_arr[ i ] != NULL )
{
fprintf(fp, "P %lu", i);
......@@ -719,6 +748,7 @@ cache_sync_all(void)
putc('\n', fp);
break;
case 1:
case 2:
if ( text_arr[ i ] != NULL )
{
fprintf(fp, "T %lu", i);
......@@ -745,6 +775,7 @@ cache_sync_all(void)
case 0:
break;
case 1:
case 2:
break;
default:
restart_kom("Unknown output file format: %ld\n", oformat);
......@@ -759,7 +790,7 @@ cache_sync_all(void)
#endif
rewind(fp);
fprintf(fp, "CLEAN");
sync_output_header(fp, "CLEAN", oformat);
fclose(fp);
#ifdef TIME_SYNC
......@@ -897,11 +928,15 @@ init_cache(void)
}
break;
case 1:
case 2:
fseek(fp, 12, SEEK_SET);
if (vflag)
kom_log("Data file version is '%ld'\n", data_file_version);
break;
case 2:
fseek(fp, 33, SEEK_SET);
if (vflag)
kom_log("Data file version is '%ld'\n", data_file_version);
break;
default:
restart_kom("Unknown input file format: %ld\n", data_file_version);
}
......
/*
* $Id: simple-cache.c,v 0.77 1999/05/21 11:36:58 byers Exp $
* $Id: simple-cache.c,v 0.78 1999/05/23 13:05:14 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -40,7 +40,7 @@
#endif
static const char *
rcsid = "$Id: simple-cache.c,v 0.77 1999/05/21 11:36:58 byers Exp $";
rcsid = "$Id: simple-cache.c,v 0.78 1999/05/23 13:05:14 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -1427,6 +1427,13 @@ get_version(const char *fn)
return version;
}
static void
sync_output_header(FILE* fp, const char *state)
{
fprintf(fp, "%s:%05ld\n", state, 2L); /* DIRTY-FLAG and VERSION*/
fprintf(fp, "%020lu\n", (unsigned long)current_time);
}
static void
pre_sync(void)
{
......@@ -1591,7 +1598,7 @@ pre_sync(void)
fprintf(file_b, "DIRTY:%05ld\n", 2L); /* DIRTY-FLAG and VERSION*/
sync_output_header(file_b, "DIRTY");
fprintf(file_b, "#C %d\n", highest_conf_no);
fprintf(file_b, "#T %ld\n", highest_text_no);
fprintf(file_b, "I");
......@@ -1990,15 +1997,17 @@ save_one_text(void)
return;
}
fprintf(file_b, "CLEAN");
sync_output_header(file_b, "CLEAN");
if ( ferror(file_b) != 0 )
{
kom_log ("save_one_text(): fprintf(CLEAN) failed.\n");
kom_log ("save_one_text(): Set state to CLEAN failed.\n");
sync_state = sync_error;
return;
}
if (fflush(file_b) != 0)
{
kom_log ("save_one_text(): fflush failed.\n");
......@@ -2206,6 +2215,7 @@ init_cache(void)
Bool read_text_no = FALSE;
Bool read_conf_no = FALSE;
int c = 0;
time_t saved_time = 0;
small_conf_arr = smalloc(sizeof(*small_conf_arr) * param.max_conf);
pers_mcb = create_cache_node_mcb(100, param.max_conf);
......@@ -2298,7 +2308,17 @@ init_cache(void)
restart_kom("You need to run dbck to convert your datafile to version 2.\n");
break;
case 2:
/*
* Read timestamp
*/
fseek(file_a, 12, SEEK_SET);
saved_time = fparse_long(file_a);
if (saved_time > current_time)
{
restart_kom("Saved time is later than current time. Exiting.\n");
}
kom_log("Database saved on %s\n", ctime(&saved_time));
break;
default:
restart_kom("Can't read database version %ld. Giving up.\n",
......
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