Commit 625275c2 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

POSIXized include files.

Replaced u_ with unsigned.
(restart_kom): Use getcwd() (which is POSIX) to get
	the current working directory. Fall back on getwd() if getcwd() is
	not available.
(main): Use sysconf(_SC_OPEN_MAX) instead of
	getdtablesize(), if available.
parent 9a8953cb
/*
* $Id: ramkomd.c,v 0.34 1993/10/08 17:43:48 ceder Exp $
* $Id: ramkomd.c,v 0.35 1993/10/10 16:57:43 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -31,52 +31,47 @@
* It has grown! /ceder
*/
static char *rcsid = "$Id: ramkomd.c,v 0.34 1993/10/08 17:43:48 ceder Exp $";
static char *rcsid = "$Id: ramkomd.c,v 0.35 1993/10/10 16:57:43 ceder Exp $";
#include "rcs.h"
USE(rcsid);
#include "getopt.h"
#include <stdlib.h>
#include <signal.h>
#include <locale.h>
#include <stdio.h>
#include <ctype.h>
#include <netdb.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* Not all machines have locale.h - for those
that don't have it we supply an empty
<locale.h>. gcc -M tries to include files,
even if they are #ifdef'd out. */
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <netinet/in.h>
#include <unistd.h>
#include <errno.h>
#include <setjmp.h>
#if defined(HAVE_SYS_PARAM_H) && !defined(HAVE_GETCWD)
# include <sys/param.h>
#endif
#if defined(HAVE_GETCWD)
# include <errno.h>
#endif
#include "s-string.h"
#include <kom-types.h>
#include "string-malloc.h"
#include "exp.h"
#include "kom-types.h"
#include "misc-types.h"
#include "com.h"
#include "connections.h"
#include "internal-connections.h"
#include "kom-errno.h"
#include "isc-malloc.h"
#include <kom-errno.h>
#include "internal-services.h"
#include "lyskomd.h"
#include "isc-interface.h"
#include <server/smalloc.h>
#include "config.h"
#include "cache.h"
#include "string-malloc.h"
#include "lyskomd.h"
#include "log.h"
#include "com.h"
#include "connections.h"
#include "config.h"
#include "exp.h"
#include "memory.h"
#include "internal-connections.h"
#include "internal-services.h"
#include "server/smalloc.h"
#include "kom-memory.h"
Kom_err kom_errno;
u_long err_stat;
unsigned long err_stat;
Bool send_async_messages = TRUE;
......@@ -294,8 +289,12 @@ main (int argc,
}
#endif
#ifdef HAVE_GETDTABLESIZE
#if defined (HAVE_SYSCONF)
MAX_NO_OF_CONNECTIONS = sysconf(_SC_OPEN_MAX) - PROTECTED_FDS;
#else
# ifdef HAVE_GETDTABLESIZE
MAX_NO_OF_CONNECTIONS = getdtablesize() - PROTECTED_FDS;
# endif
#endif
/* If we don't have getdtablesize MAX_NO_OF_CONNECTIONS is
set at compile time. */
......@@ -409,21 +408,38 @@ dump_exit_statistics(void)
}
void
restart_kom(const char * format, ...)
{
va_list AP;
char pathname[MAXPATHLEN];
#if defined(HAVE_GETCWD)
char pathname[1026];
#else /* !defined(HAVE_GETCWD) */
char *getwd(char *); /* +++ should be in sys/param.h */
# if defined(MAXPATHLEN)
char pathname[MAXPATHLEN];
# else
char pathname[1024];
# endif /* !defined(MAXPATHLEN) */
#endif /* !defined(HAVE_GETCWD) */
va_start(AP, format);
logv(format, AP);
va_end(AP);
log("Previous message is fatal. Will dump core now.\n");
#ifdef HAVE_GETCWD
/* getcwd is POSIX, so try that first. */
if (getcwd(pathname, 1026) == NULL)
log("getcwd failed: errno %d\n", errno);
else
log("Search for the core in %s\n", pathname);
#else
if ( getwd(pathname) == NULL )
log("getwd failed: %s\n", pathname);
else
log("Search for the core in %s\n", pathname);
#endif
abort();
}
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