Commit 5774037f authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(go_daemon): Don't go into daemon mode if in debug mode.

(initialize): Fixed a printf statement.
(main): chdir to param.core_dir before the action starts.
(datafilename): Removed.  All users modified
	to use param.datafile_name instead.
(backupfilename): Removed.  All users modified to use
	param.backupfile_name instead.
(textfilename): Removed.  All users modified to use
	param.textfile_name instead.
(statisticfile, pidfile, memusefile): Removed.  All callers modified
	to use param.statistic_name, param.pid_name and
	param.memuse_name instead.
parent a8c453fb
/*
* $Id: ramkomd.c,v 0.54 1994/12/31 15:16:19 ceder Exp $
* $Id: ramkomd.c,v 0.55 1995/10/07 14:32:06 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994 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.54 1994/12/31 15:16:19 ceder Exp $";
static char *rcsid = "$Id: ramkomd.c,v 0.55 1995/10/07 14:32:06 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -103,13 +103,6 @@ unsigned long err_stat = 0;
int buglevel = 0;
#endif
EXPORT char datafilename[BUFSIZ]; /* Full pathname to the database file */
EXPORT char backupfilename[BUFSIZ]; /* Full pathname to the backup file */
EXPORT char textfilename[BUFSIZ]; /* Full pathname to the text file. */
EXPORT char statisticfile[BUFSIZ]; /* Dito to statistics file. */
EXPORT char pidfile[BUFSIZ]; /* Dito pid-file. */
INTERNAL char memusefile[BUFSIZ]; /* Memory usage file. */
static IscSession *listen_client = NULL; /* ISC listen identifier */
static IscSession *listen_mux = NULL; /* -"- */
......@@ -177,15 +170,8 @@ server_init (char * client_port, char * mux_port)
static void
init_data_base(const char *dir_base)
{
sprintf(datafilename, "%s/%s", dir_base, param.datafile_name);
sprintf(backupfilename, "%s/%s", dir_base, param.backupfile_name);
sprintf(textfilename, "%s/%s", dir_base, param.textfile_name);
sprintf(statisticfile, "%s/%s", dir_base, param.statistic_name);
sprintf(pidfile, "%s/%s", dir_base, param.pid_name);
sprintf(memusefile, "%s/%s", dir_base, param.memuse_name);
log("Database = %s\n", datafilename);
log("Backup = %s\n", backupfilename);
log("Database = %s\n", param.datafile_name);
log("Backup = %s\n", param.backupfile_name);
if ( init_cache() == FAILURE )
restart_kom ("Cannot find database.\n");
......@@ -241,7 +227,7 @@ save_pid(void)
{
FILE *fp;
if ( (fp = fopen(pidfile, "w")) == NULL )
if ((fp = fopen(param.pid_name, "w")) == NULL)
return;
fprintf(fp, "%ld\n", (long)getpid());
......@@ -255,6 +241,11 @@ go_daemon(const char *prefix, const char *logf)
int fd;
char *logfile;
if (buglevel != 0)
{
return;
}
if (getppid() != 1)
{
/* We were not invoked from /etc/inittab, so
......@@ -332,9 +323,10 @@ initialize(const char *config_file)
}
if (param.no_files > rlim.rlim_max)
{
fprintf(stderr, "attempt to raise open files from %d to %d, "
"but only %d is allowed\n", rlim.rlim_cur, param.no_files,
rlim.rlim_max);
fprintf(stderr, "attempt to raise open files from %ld to %ld, "
"but only %ld is allowed\n",
(long)rlim.rlim_cur, (long)param.no_files,
(long)rlim.rlim_max);
rlim.rlim_cur = rlim.rlim_max;
}
else
......@@ -427,6 +419,7 @@ main (int argc,
signal(SIGUSR2, sighandler_usr2);
initialize(config_file); /* Read config, listen, and start db */
chdir(param.core_dir);
sfree(default_config_file);
save_pid();
......@@ -451,7 +444,7 @@ dump_exit_statistics(void)
time_t now;
time(&now);
stat_file = fopen(memusefile, "a");
stat_file = fopen(param.memuse_name, "a");
if ( stat_file == NULL )
restart_kom("Can't open file to save memory usage to.\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