#include <roken.h>
#ifdef AFS_NT40_ENV
-#include <windows.h>
-#include <WINNT/afsevent.h>
+# include <windows.h>
+# include <WINNT/afsevent.h>
#endif
#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
+# include <sys/file.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
+# include <sys/resource.h>
#endif
#undef SHARED
#include <afs/partition.h>
#include <afs/dir.h>
#ifndef AFS_NT40_ENV
-#include <afs/netutils.h>
+# include <afs/netutils.h>
#endif
#include "viced_prototypes.h"
#include "viced.h"
#include "host.h"
#ifdef AFS_PTHREAD_ENV
-#include <afs/softsig.h>
+# include <afs/softsig.h>
#endif
#if defined(AFS_SGI_ENV)
-#include "sys/schedctl.h"
-#include "sys/lock.h"
+# include "sys/schedctl.h"
+# include "sys/lock.h"
#endif
#include <rx/rx_globals.h>
void *ShutDown(void *);
static void ClearXStatValues(void);
-static void NewParms(int);
static void PrintCounters(void);
static void ResetCheckDescriptors(void);
static void ResetCheckSignal(void);
#endif /* AFS_PTHREAD_ENV */
#ifdef AFS_NT40_ENV
-#define NT_OPEN_MAX 1024 /* This is an arbitrary no. we came up with for
+# define NT_OPEN_MAX 1024 /* This is an arbitrary no. we came up with for
* now. We hope this will be replaced by a more
* intelligent estimate later. */
#endif
* disk
*/
-#if !defined(PTHREAD_RWLOCK_INITIALIZER) && defined(AFS_DARWIN80_ENV)
-#define PTHREAD_RWLOCK_INITIALIZER {0x2DA8B3B4, {0}}
-#endif
+# if !defined(PTHREAD_RWLOCK_INITIALIZER) && defined(AFS_DARWIN80_ENV)
+# define PTHREAD_RWLOCK_INITIALIZER {0x2DA8B3B4, {0}}
+# endif
-#ifndef AFS_NT40_ENV
+# ifndef AFS_NT40_ENV
struct fs_state fs_state =
{ FS_MODE_NORMAL,
0,
PTHREAD_COND_INITIALIZER,
PTHREAD_RWLOCK_INITIALIZER
};
-#else /* AFS_NT40_ENV */
+# else /* AFS_NT40_ENV */
struct fs_state fs_state;
static int fs_stateInit(void)
CV_INIT(&fs_state.worker_done_cv, "worker done", CV_DEFAULT, 0);
osi_Assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0);
}
-#endif /* AFS_NT40_ENV */
+# endif /* AFS_NT40_ENV */
#endif /* AFS_DEMAND_ATTACH_FS */
/*
#if defined(AFS_HPUX_ENV)
signo = SIGPOLL;
-#else
-#if defined(AFS_NT40_ENV)
+#elif defined(AFS_NT40_ENV)
signo = SIGUSR2;
#else
signo = SIGXCPU;
#endif
-#endif
#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
softsig_signal(signo, CheckSignal_Signal);
ResetCheckDescriptors(void)
{
#ifndef AFS_NT40_ENV
-#if defined(AFS_PTHREAD_ENV)
+# if defined(AFS_PTHREAD_ENV)
softsig_signal(SIGTERM, CheckDescriptors_Signal);
-#else
+# else
(void)signal(SIGTERM, CheckDescriptors_Signal);
-#endif
+# endif
#endif
}
viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
afs_uint32 rcode;
-#ifndef AFS_LINUX20_ENV
+# ifndef AFS_LINUX20_ENV
void (*old) (int);
old = (void (*)(int))signal(SIGSYS, SIG_IGN);
-#endif
+# endif
rcode = syscall(AFS_SYSCALL, 28 /* AFSCALL_CALL */ , a3, a4, a5);
-#ifndef AFS_LINUX20_ENV
+# ifndef AFS_LINUX20_ENV
signal(SIGSYS, old);
-#endif
+# endif
return rcode;
}
#endif
#if !defined(AFS_NT40_ENV)
-#include "AFS_component_version_number.c"
+# include "AFS_component_version_number.c"
#endif /* !AFS_NT40_ENV */
#define MAXADMINNAME 64
* declared in param.h. If such a thing is not defined, we bitch
* and declare ourselves to be an unknown system type.
*/
-#ifdef SYS_NAME_ID
+# ifdef SYS_NAME_ID
afs_perfstats.sysname_ID = SYS_NAME_ID;
-#else
-#ifndef AFS_NT40_ENV
+# else
+# ifndef AFS_NT40_ENV
ViceLog(0, ("Sys name ID constant not defined in param.h!!\n"));
ViceLog(0, ("[Choosing ``undefined'' sys name ID.\n"));
-#endif
+# endif
afs_perfstats.sysname_ID = SYS_NAME_ID_UNDEFINED;
-#endif /* SYS_NAME_ID */
+# endif /* SYS_NAME_ID */
#endif
} /*ClearXStatValues */
static int
max_fileserver_thread(void)
{
-#if defined(AFS_PTHREAD_ENV)
-#if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
+#if defined(AFS_PTHREAD_ENV) && (defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV))
long ans;
ans = sysconf(_SC_THREAD_THREADS_MAX);
if (0 < ans && ans < MAX_FILESERVER_THREAD)
return (int)ans;
-#endif
#endif /* defined(AFS_PTHREAD_ENV) */
return MAX_FILESERVER_THREAD;
}
} /*ParseArgs */
-
-#define MAXPARMS 15
-
+/* Once upon a time, in a galaxy far far away, IBM AFS supported the use of
+ * a file /vice/file/parms, the contents of which would override any command
+ * line parameters. We no longer support the use of such a file, but we warn
+ * if we encounter its presence from an older release
+ */
static void
-NewParms(int initializing)
+CheckParms(void)
{
- static struct afs_stat sbuf;
- int i, fd;
- char *parms;
- char *argv[MAXPARMS];
- int argc;
-
- if (!(afs_stat("/vice/file/parms", &sbuf))) {
- parms = (char *)malloc(sbuf.st_size);
- if (!parms)
- return;
- fd = afs_open("parms", O_RDONLY, 0666);
- if (fd <= 0) {
- ViceLog(0, ("Open for parms failed with errno = %d\n", errno));
- return;
- }
-
- i = read(fd, parms, sbuf.st_size);
- close(fd);
- if (i != sbuf.st_size) {
- if (i < 0) {
- ViceLog(0, ("Read on parms failed with errno = %d\n", errno));
- } else {
- ViceLog(0,
- ("Read on parms failed; expected %ld bytes but read %d\n",
- (long) sbuf.st_size, i));
- }
- free(parms);
- return;
- }
-
- for (i = 0; i < MAXPARMS; argv[i++] = 0);
-
- for (argc = i = 0; i < sbuf.st_size; i++) {
- if ((*(parms + i) != ' ') && (*(parms + i) != '\n')) {
- if (argv[argc] == 0)
- argv[argc] = (parms + i);
- } else {
- *(parms + i) = '\0';
- if (argv[argc] != 0) {
- if (++argc == MAXPARMS)
- break;
- }
- while ((*(parms + i + 1) == ' ')
- || (*(parms + i + 1) == '\n'))
- i++;
- }
- }
- if (ParseArgs(argc, argv) == 0) {
- ViceLog(0, ("Change parameters to:"));
- } else {
- ViceLog(0, ("Invalid parameter in:"));
- }
- for (i = 0; i < argc; i++) {
- ViceLog(0, (" %s", argv[i]));
- }
- ViceLog(0, ("\n"));
- free(parms);
- } else if (!initializing)
- ViceLog(0,
- ("Received request to change parms but no parms file exists\n"));
-
-} /*NewParms */
+ struct afs_stat sbuf;
+ if (afs_stat("/vice/file/parms", &sbuf) == 0) {
+ ViceLog(0, ("Using /vice/file/parms to override command line "
+ "options is no longer supported"));
+ }
+}
/* Miscellaneous routines */
void
/* set ihandle package defaults prior to parsing args */
ih_PkgDefaults();
+ /* check for the parameter file */
+ CheckParms();
+
if (ParseArgs(argc, argv)) {
FlagMsg();
exit(-1);
exit(-1);
}
- NewParms(1);
-
/* Open FileLog on stdout, stderr, fd 1 and fd2 (for perror), sigh. */
#ifndef AFS_NT40_ENV
serverLogSyslogTag = "fileserver";
schedctl(NDPRI, 0, NDPNORMMAX);
if (SawLock)
plock(PROCLOCK);
-#else
-#ifndef AFS_NT40_ENV
+#elif !defined(AFS_NT40_ENV)
nice(-5); /* TODO: */
#endif
-#endif
- osi_Assert(DInit(buffs) == 0);
+ DInit(buffs);
#ifdef AFS_DEMAND_ATTACH_FS
FS_STATE_INIT;
#endif