2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
9 * Portions Copyright (c) 2006 Sine Nomine Associates
12 /* viced.c - File Server main loop */
16 /* Function - This routine has the initialization code for */
19 /* ********************************************************************** */
21 #include <afsconfig.h>
22 #include <afs/param.h>
25 #include <afs/procmgmt.h>
30 # include <WINNT/afsevent.h>
33 #ifdef HAVE_SYS_FILE_H
34 # include <sys/file.h>
37 #ifdef HAVE_SYS_RESOURCE_H
38 # include <sys/resource.h>
45 #include <afs/afs_assert.h>
49 #include <afs/ptclient.h>
50 #include <afs/afsint.h>
51 #include <afs/vldbint.h>
52 #include <afs/errors.h>
53 #include <afs/ihandle.h>
54 #include <afs/vnode.h>
55 #include <afs/volume.h>
57 #include <afs/cellconfig.h>
59 #include <afs/prs_fs.h>
61 #include <rx/rxstat.h>
63 #include <afs/afs_args.h>
64 #include <afs/vlserver.h>
65 #include <afs/afsutil.h>
66 #include <afs/fileutil.h>
67 #include <afs/ptuser.h>
68 #include <afs/audit.h>
69 #include <afs/partition.h>
72 # include <afs/netutils.h>
74 #include "viced_prototypes.h"
77 #ifdef AFS_PTHREAD_ENV
78 # include <afs/softsig.h>
80 #if defined(AFS_SGI_ENV)
81 # include "sys/schedctl.h"
82 # include "sys/lock.h"
84 #include <rx/rx_globals.h>
88 void *ShutDown(void *);
89 static void ClearXStatValues(void);
90 static void PrintCounters(void);
91 static void ResetCheckDescriptors(void);
92 static void ResetCheckSignal(void);
93 static void *CheckSignal(void *);
95 static afs_int32 Do_VLRegisterRPC(void);
97 int eventlog = 0, rxlog = 0;
100 #ifdef AFS_PTHREAD_ENV
101 pthread_mutex_t fsync_glock_mutex;
102 pthread_cond_t fsync_cond;
105 #endif /* AFS_PTHREAD_ENV */
108 # define NT_OPEN_MAX 1024 /* This is an arbitrary no. we came up with for
109 * now. We hope this will be replaced by a more
110 * intelligent estimate later. */
113 int SystemId; /* ViceID of "Administrators" */
114 int SystemAnyUser; /* Viceid of "System:AnyUser" */
115 prlist SystemAnyUserCPS; /* CPS for "system:AnyUser */
116 int AnonymousID = 0; /* ViceId of "Anonymous" */
117 prlist AnonCPS; /* CPS for "Anonymous" */
119 struct afsconf_dir *confDir; /* Configuration dir object */
121 int restartMode = RESTART_ORDINARY;
124 * Home for the performance statistics.
126 struct afs_PerfStats afs_perfstats;
129 extern int Statistics;
134 int rxJumbograms = 0; /* default is to not send and receive jumbograms. */
135 int rxBind = 0; /* don't bind */
136 int rxkadDisableDotCheck = 0; /* disable check for dot in principal name */
138 afs_int32 implicitAdminRights = PRSFS_LOOKUP; /* The ADMINISTER right is
140 afs_int32 readonlyServer = 0;
143 int stackSize = 24000;
144 int fiveminutes = 300; /* 5 minutes. Change this for debugging only */
145 int CurrentConnections = 0;
146 int hostaclRefresh = 7200; /* refresh host clients' acls every 2 hrs */
147 #if defined(AFS_SGI_ENV)
153 * seconds to wait until forcing a panic during ShutDownAndCore(PANIC)
154 * in case we get stuck.
156 #ifdef AFS_DEMAND_ATTACH_FS
157 static int panic_timeout = 2 * 60;
159 static int panic_timeout = 30 * 60;
162 int rxpackets = 150; /* 100 */
163 int nSmallVns = 400; /* 200 */
164 int large = 400; /* 200 */
165 int volcache = 400; /* 400 */
166 int numberofcbs = 60000; /* 60000 */
167 int lwps = 9; /* 6 */
168 int buffs = 90; /* 70 */
169 int novbc = 0; /* Enable Volume Break calls */
170 int busy_threshold = 600;
171 int abort_threshold = 10;
172 int udpBufSize = 0; /* UDP buffer size for receive */
173 int sendBufSize = 16384; /* send buffer size */
174 int saneacls = 0; /* Sane ACLs Flag */
175 static int unsafe_attach = 0; /* avoid inUse check on vol attach? */
176 static int offline_timeout = -1; /* -offline-timeout option */
177 static int offline_shutdown_timeout = -1; /* -offline-shutdown-timeout option */
181 #ifdef AFS_PTHREAD_ENV
182 pthread_key_t viced_uclient_key;
185 #ifdef AFS_PTHREAD_ENV
186 pthread_key_t viced_uclient_key;
190 * FileServer's name and IP address, both network byte order and
193 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
195 char FS_HostName[128] = "localhost";
196 afs_uint32 FS_HostAddr_NBO;
197 afs_uint32 FS_HostAddr_HBO;
198 afs_uint32 FS_HostAddrs[ADDRSPERSITE], FS_HostAddr_cnt = 0, FS_registered = 0;
199 /* All addresses in FS_HostAddrs are in NBO */
202 #ifdef AFS_DEMAND_ATTACH_FS
205 * fileserver mode support
207 * during fileserver shutdown, we have to track the graceful shutdown of
208 * certain background threads before we are allowed to dump state to
212 # if !defined(PTHREAD_RWLOCK_INITIALIZER) && defined(AFS_DARWIN80_ENV)
213 # define PTHREAD_RWLOCK_INITIALIZER {0x2DA8B3B4, {0}}
216 # ifndef AFS_NT40_ENV
217 struct fs_state fs_state =
224 PTHREAD_COND_INITIALIZER,
225 PTHREAD_RWLOCK_INITIALIZER
227 # else /* AFS_NT40_ENV */
228 struct fs_state fs_state;
230 static int fs_stateInit(void)
232 fs_state.mode = FS_MODE_NORMAL;
233 fs_state.FiveMinuteLWP_tranquil = 0;
234 fs_state.HostCheckLWP_tranquil = 0;
235 fs_state.FsyncCheckLWP_tranquil = 0;
236 fs_state.salvsync_fatal_error = 0;
238 fs_state.options.fs_state_save = 1;
239 fs_state.options.fs_state_restore = 1;
240 fs_state.options.fs_state_verify_before_save = 1;
241 fs_state.options.fs_state_verify_after_restore = 1;
243 CV_INIT(&fs_state.worker_done_cv, "worker done", CV_DEFAULT, 0);
244 osi_Assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0);
246 # endif /* AFS_NT40_ENV */
247 #endif /* AFS_DEMAND_ATTACH_FS */
250 * Home for the performance statistics.
255 CheckDescriptors(void *unused)
258 struct afs_stat status;
259 int tsize = getdtablesize();
261 for (i = 0; i < tsize; i++) {
262 if (afs_fstat(i, &status) != -1) {
263 printf("%d: dev %x, inode %u, length %u, type/mode %x\n", i,
264 (unsigned int) status.st_dev,
265 (unsigned int) status.st_ino,
266 (unsigned int) status.st_size,
271 ResetCheckDescriptors();
274 } /*CheckDescriptors */
277 #ifdef AFS_PTHREAD_ENV
279 CheckSignal_Signal(int x)
285 ShutDown_Signal(int x)
291 CheckDescriptors_Signal(int x)
293 CheckDescriptors(NULL);
295 #else /* AFS_PTHREAD_ENV */
297 CheckSignal_Signal(int x)
299 IOMGR_SoftSig(CheckSignal, 0);
303 ShutDown_Signal(int x)
305 IOMGR_SoftSig(ShutDown, 0);
309 CheckDescriptors_Signal(int x)
311 IOMGR_SoftSig(CheckDescriptors, 0);
313 #endif /* AFS_PTHREAD_ENV */
315 /* check whether caller is authorized to manage RX statistics */
317 fs_rxstat_userok(struct rx_call *call)
319 return afsconf_SuperUser(confDir, call, NULL);
323 ResetCheckSignal(void)
327 #if defined(AFS_HPUX_ENV)
329 #elif defined(AFS_NT40_ENV)
335 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
336 softsig_signal(signo, CheckSignal_Signal);
338 signal(signo, CheckSignal_Signal);
343 ResetCheckDescriptors(void)
346 # if defined(AFS_PTHREAD_ENV)
347 softsig_signal(SIGTERM, CheckDescriptors_Signal);
349 (void)signal(SIGTERM, CheckDescriptors_Signal);
356 viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
359 # ifndef AFS_LINUX20_ENV
362 old = (void (*)(int))signal(SIGSYS, SIG_IGN);
364 rcode = syscall(AFS_SYSCALL, 28 /* AFSCALL_CALL */ , a3, a4, a5);
365 # ifndef AFS_LINUX20_ENV
373 #if !defined(AFS_NT40_ENV)
374 # include "AFS_component_version_number.c"
375 #endif /* !AFS_NT40_ENV */
377 #define MAXADMINNAME 64
378 char adminName[MAXADMINNAME];
384 struct afs_stat status;
386 if ((afs_stat("/AdminName", &status)) || /* if file does not exist */
387 (status.st_size <= 0) || /* or it is too short */
388 (status.st_size >= (MAXADMINNAME)) || /* or it is too long */
389 !(fd = afs_open("/AdminName", O_RDONLY, 0))) { /* or the open fails */
390 strcpy(adminName, "System:Administrators"); /* use the default name */
392 (void)read(fd, adminName, status.st_size); /* use name from the file */
395 close(fd); /* close fd if it was opened */
397 } /*CheckAdminName */
403 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
406 /* set our 'thread-id' so that the host hold table works */
407 threadId = rx_SetThreadNum();
408 afs_pthread_setname_self(s);
409 ViceLog(0, ("Set thread id 0x%x for '%s'\n", threadId, s));
413 /* This LWP does things roughly every 5 minutes */
415 FiveMinuteCheckLWP(void *unused)
420 ViceLog(1, ("Starting five minute check process\n"));
421 setThreadId("FiveMinuteCheckLWP");
423 #ifdef AFS_DEMAND_ATTACH_FS
425 while (fs_state.mode == FS_MODE_NORMAL) {
426 fs_state.FiveMinuteLWP_tranquil = 1;
432 #ifdef AFS_PTHREAD_ENV
434 #else /* AFS_PTHREAD_ENV */
435 IOMGR_Sleep(fiveminutes);
436 #endif /* AFS_PTHREAD_ENV */
438 #ifdef AFS_DEMAND_ATTACH_FS
440 if (fs_state.mode != FS_MODE_NORMAL) {
443 fs_state.FiveMinuteLWP_tranquil = 0;
447 /* close the log so it can be removed */
448 ReOpenLog(AFSDIR_SERVER_FILELOG_FILEPATH); /* don't trunc, just append */
449 ViceLog(2, ("Cleaning up timed out callbacks\n"));
450 if (CleanupTimedOutCallBacks())
451 ViceLog(5, ("Timed out callbacks deleted\n"));
452 ViceLog(2, ("Set disk usage statistics\n"));
454 if (FS_registered == 1)
456 /* Force wakeup in case we missed something; pthreads does timedwait */
457 #ifndef AFS_PTHREAD_ENV
458 LWP_NoYieldSignal(fsync_wait);
460 if (printBanner && (++msg & 1)) { /* Every 10 minutes */
461 time_t now = FT_ApproxTime();
463 strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
464 localtime_r(&now, &tm));
466 ("File server is running at %s\n", tbuffer));
468 #ifdef AFS_DEMAND_ATTACH_FS
472 #ifdef AFS_DEMAND_ATTACH_FS
473 fs_state.FiveMinuteLWP_tranquil = 1;
475 CV_BROADCAST(&fs_state.worker_done_cv);
480 } /*FiveMinuteCheckLWP */
483 /* This LWP does host checks every 5 minutes: it should not be used for
484 * other 5 minute activities because it may be delayed by timeouts when
485 * it probes the workstations
489 HostCheckLWP(void *unused)
491 ViceLog(1, ("Starting Host check process\n"));
492 setThreadId("HostCheckLWP");
493 #ifdef AFS_DEMAND_ATTACH_FS
495 while (fs_state.mode == FS_MODE_NORMAL) {
496 fs_state.HostCheckLWP_tranquil = 1;
502 #ifdef AFS_PTHREAD_ENV
504 #else /* AFS_PTHREAD_ENV */
505 IOMGR_Sleep(fiveminutes);
506 #endif /* AFS_PTHREAD_ENV */
508 #ifdef AFS_DEMAND_ATTACH_FS
510 if (fs_state.mode != FS_MODE_NORMAL) {
513 fs_state.HostCheckLWP_tranquil = 0;
517 ViceLog(2, ("Checking for dead venii & clients\n"));
520 #ifdef AFS_DEMAND_ATTACH_FS
524 #ifdef AFS_DEMAND_ATTACH_FS
525 fs_state.HostCheckLWP_tranquil = 1;
527 CV_BROADCAST(&fs_state.worker_done_cv);
534 /* This LWP does fsync checks every 5 minutes: it should not be used for
535 * other 5 minute activities because it may be delayed by timeouts when
536 * it probes the workstations
539 FsyncCheckLWP(void *unused)
542 #ifdef AFS_PTHREAD_ENV
543 struct timespec fsync_next;
545 ViceLog(1, ("Starting fsync check process\n"));
547 setThreadId("FsyncCheckLWP");
549 #ifdef AFS_DEMAND_ATTACH_FS
551 while (fs_state.mode == FS_MODE_NORMAL) {
552 fs_state.FsyncCheckLWP_tranquil = 1;
558 #ifdef AFS_PTHREAD_ENV
559 /* rounding is fine */
560 fsync_next.tv_nsec = 0;
561 fsync_next.tv_sec = time(0) + fiveminutes;
563 code = CV_TIMEDWAIT(&fsync_cond, &fsync_glock_mutex,
565 if (code != 0 && code != ETIMEDOUT)
566 ViceLog(0, ("pthread_cond_timedwait returned %d\n", code));
567 #else /* AFS_PTHREAD_ENV */
568 if ((code = LWP_WaitProcess(fsync_wait)) != LWP_SUCCESS)
569 ViceLog(0, ("LWP_WaitProcess returned %d\n", code));
570 #endif /* AFS_PTHREAD_ENV */
573 #ifdef AFS_DEMAND_ATTACH_FS
575 if (fs_state.mode != FS_MODE_NORMAL) {
578 fs_state.FsyncCheckLWP_tranquil = 0;
580 #endif /* AFS_DEMAND_ATTACH_FS */
582 ViceLog(2, ("Checking for fsync events\n"));
584 code = BreakLaterCallBacks();
586 #ifdef AFS_DEMAND_ATTACH_FS
590 #ifdef AFS_DEMAND_ATTACH_FS
591 fs_state.FsyncCheckLWP_tranquil = 1;
593 CV_BROADCAST(&fs_state.worker_done_cv);
596 #endif /* AFS_DEMAND_ATTACH_FS */
600 /*------------------------------------------------------------------------
601 * PRIVATE ClearXStatValues
604 * Initialize all of the values collected via the xstat
614 * Must be called during File Server initialization.
618 *------------------------------------------------------------------------*/
621 ClearXStatValues(void)
622 { /*ClearXStatValues */
624 struct fs_stats_opTimingData *opTimeP; /*Ptr to timing struct */
625 struct fs_stats_xferData *opXferP; /*Ptr to xfer struct */
626 int i; /*Loop counter */
629 * Zero all xstat-related structures.
631 memset((&afs_perfstats), 0, sizeof(struct afs_PerfStats));
632 #if FS_STATS_DETAILED
633 memset((&afs_FullPerfStats), 0,
634 sizeof(struct fs_stats_FullPerfStats));
637 * That's not enough. We have to set reasonable minima for
638 * time and xfer values in the detailed stats.
640 opTimeP = &(afs_FullPerfStats.det.rpcOpTimes[0]);
641 for (i = 0; i < FS_STATS_NUM_RPC_OPS; i++, opTimeP++)
642 opTimeP->minTime.tv_sec = 999999;
644 opXferP = &(afs_FullPerfStats.det.xferOpTimes[0]);
645 for (i = 0; i < FS_STATS_NUM_XFER_OPS; i++, opXferP++) {
646 opXferP->minTime.tv_sec = 999999;
647 opXferP->minBytes = 999999999;
651 * There's more. We have to set our unique system identifier, as
652 * declared in param.h. If such a thing is not defined, we bitch
653 * and declare ourselves to be an unknown system type.
656 afs_perfstats.sysname_ID = SYS_NAME_ID;
658 # ifndef AFS_NT40_ENV
659 ViceLog(0, ("Sys name ID constant not defined in param.h!!\n"));
660 ViceLog(0, ("[Choosing ``undefined'' sys name ID.\n"));
662 afs_perfstats.sysname_ID = SYS_NAME_ID_UNDEFINED;
663 # endif /* SYS_NAME_ID */
666 } /*ClearXStatValues */
668 int CopyOnWrite_calls = 0, CopyOnWrite_off0 = 0, CopyOnWrite_size0 = 0;
669 afs_fsize_t CopyOnWrite_maxsize = 0;
674 int dirbuff, dircall, dirio;
676 int workstations, activeworkstations, delworkstations;
680 #ifdef AFS_DEMAND_ATTACH_FS
684 FT_GetTimeOfDay(&tpl, 0);
686 strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
687 localtime_r(&StartTime, &tm));
688 ViceLog(0, ("Vice was last started at %s\n", tbuffer));
690 #ifdef AFS_DEMAND_ATTACH_FS
691 if (LogLevel >= 125) {
692 stats_flags = VOL_STATS_PER_CHAIN2;
693 } else if (LogLevel >= 25) {
694 stats_flags = VOL_STATS_PER_CHAIN;
696 VPrintExtendedCacheStats(stats_flags);
700 DStat(&dirbuff, &dircall, &dirio);
702 ("With %d directory buffers; %d reads resulted in %d read I/Os\n",
703 dirbuff, dircall, dirio));
704 rx_PrintStats(stderr);
705 audit_PrintStats(stderr);
707 PrintCallBackStats();
709 processSize = -1; /* TODO: */
711 processSize = (int)((long)sbrk(0) >> 10);
714 ("There are %d connections, process size %d\n",
715 CurrentConnections, processSize));
716 h_GetWorkStats(&workstations, &activeworkstations, &delworkstations,
717 tpl.tv_sec - 15 * 60);
719 ("There are %d workstations, %d are active (req in < 15 mins), %d marked \"down\"\n",
720 workstations, activeworkstations, delworkstations));
721 ViceLog(0, ("CopyOnWrite: calls %d off0 %d size0 %d maxsize 0x%llx\n",
722 CopyOnWrite_calls, CopyOnWrite_off0, CopyOnWrite_size0, CopyOnWrite_maxsize));
731 CheckSignal(void *unused)
733 if (FS_registered > 0) {
735 * We have proper ip addresses; tell the vlserver what we got; the following
736 * routine will do the proper reporting for us
749 ShutdownWatchdogLWP(void *unused)
751 afs_pthread_setname_self("ShutdownWatchdog");
752 sleep(panic_timeout);
753 ViceLogThenPanic(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
754 "within %d seconds; forcing panic\n",
760 ShutDownAndCore(int dopanic)
762 time_t now = time(NULL);
767 #ifdef AFS_PTHREAD_ENV
768 pthread_t watchdogPid;
769 pthread_attr_t tattr;
770 osi_Assert(pthread_attr_init(&tattr) == 0);
771 osi_Assert(pthread_create(&watchdogPid, &tattr, ShutdownWatchdogLWP, NULL) == 0);
774 osi_Assert(LWP_CreateProcess
775 (ShutdownWatchdogLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
776 NULL, "ShutdownWatchdog", &watchdogPid) == LWP_SUCCESS);
780 /* do not allows new reqests to be served from now on, all new requests
781 * are returned with an error code of RX_RESTARTING ( transient failure ) */
782 rx_SetRxTranquil(); /* dhruba */
786 #ifdef AFS_DEMAND_ATTACH_FS
788 if (fs_state.mode == FS_MODE_SHUTDOWN) {
789 /* it is possible for at least fs_stateSave() (called below) to call
790 * ShutDownAndCore if there's host list corruption; prevent
791 * deinitializing some stuff twice */
792 ViceLog(0, ("ShutDownAndCore called during shutdown? Skipping volume "
793 "and host package shutdown\n"));
797 fs_state.mode = FS_MODE_SHUTDOWN;
801 strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
802 localtime_r(&now, &tm));
803 ViceLog(0, ("Shutting down file server at %s\n", tbuffer));
805 ViceLog(0, ("ABNORMAL SHUTDOWN, see core file.\n"));
810 /* shut down volume package */
813 #ifdef AFS_DEMAND_ATTACH_FS
814 if (fs_state.options.fs_state_save) {
817 * save fileserver state to disk */
820 ViceLog(0, ("Not saving fileserver state; abnormal shutdown\n"));
823 /* make sure background threads have finished all of their asynchronous
824 * work on host and callback structures */
826 while (!fs_state.FiveMinuteLWP_tranquil ||
827 !fs_state.HostCheckLWP_tranquil ||
828 !fs_state.FsyncCheckLWP_tranquil) {
831 ViceLog(0, ("waiting for background host/callback threads to quiesce before saving fileserver state...\n"));
832 CV_WAIT(&fs_state.worker_done_cv, &fileproc_glock_mutex);
838 /* ok. it should now be fairly safe. let's do the state dump */
844 #endif /* AFS_DEMAND_ATTACH_FS */
847 rx_PrintStats(debugFile);
851 strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
852 localtime_r(&now, &tm));
854 ViceLog(0, ("File server has terminated abnormally at %s\n", tbuffer));
856 ViceLog(0, ("File server has terminated normally at %s\n", tbuffer));
859 if (dopanic) /* XXX pass in file and line? */
860 osi_Panic("Panic requested\n");
866 ShutDown(void *unused)
867 { /* backward compatibility */
868 ShutDownAndCore(DONTPANIC);
873 ParseRights(char *arights)
879 if (!arights || !strcmp(arights, "")) {
880 printf("Missing list of mode bits on -implicit option\n");
883 if (!strcmp(arights, "none"))
885 else if (!strcmp(arights, "read"))
886 mode = PRSFS_READ | PRSFS_LOOKUP;
887 else if (!strcmp(arights, "write"))
889 PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |
890 PRSFS_WRITE | PRSFS_LOCK;
891 else if (!strcmp(arights, "all"))
893 PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |
894 PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER;
896 len = strlen(arights);
897 for (i = 0; i < len; i++) {
902 mode |= PRSFS_LOOKUP;
904 mode |= PRSFS_INSERT;
906 mode |= PRSFS_DELETE;
912 mode |= PRSFS_ADMINISTER;
930 printf("Illegal -implicit rights character '%c'.\n", tc);
939 * Limit MAX_FILESERVER_THREAD by the system limit on the number of
940 * pthreads (sysconf(_SC_THREAD_THREADS_MAX)), if applicable and
943 * AIX: sysconf() limit is real
944 * HP-UX: sysconf() limit is real
945 * IRIX: sysconf() limit is apparently NOT real -- too small
946 * DUX: sysconf() limit is apparently NOT real -- too big
947 * Linux: sysconf() limit is apparently NOT real -- too big
948 * Solaris: no sysconf() limit
951 max_fileserver_thread(void)
953 #if defined(AFS_PTHREAD_ENV) && (defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV))
956 ans = sysconf(_SC_THREAD_THREADS_MAX);
957 if (0 < ans && ans < MAX_FILESERVER_THREAD)
959 #endif /* defined(AFS_PTHREAD_ENV) */
960 return MAX_FILESERVER_THREAD;
964 extern ih_init_params vol_io_params;
989 OPT_offline_shutdown_timeout,
990 OPT_vhandle_setaside,
991 OPT_vhandle_max_cachesize,
992 OPT_vhandle_initial_cachesize,
993 OPT_fs_state_dont_save,
994 OPT_fs_state_dont_restore,
1001 OPT_unsafe_nosalvage,
1028 ParseArgs(int argc, char *argv[])
1033 struct cmd_item *optlist;
1034 struct cmd_syndesc *opts;
1037 char *auditFileName = NULL;
1039 #if defined(AFS_AIX32_ENV)
1040 extern int aixlow_water;
1043 opts = cmd_CreateSyntax(NULL, NULL, NULL, NULL);
1045 /* fileserver options */
1046 cmd_AddParmAtOffset(opts, OPT_large, "-L", CMD_FLAG,
1047 CMD_OPTIONAL, "defaults for a 'large' server");
1048 cmd_AddParmAtOffset(opts, OPT_small, "-S", CMD_FLAG,
1049 CMD_OPTIONAL, "defaults for a 'small' server");
1051 cmd_AddParmAtOffset(opts, OPT_banner, "-banner", CMD_FLAG,
1052 CMD_OPTIONAL, "print regular banners to log");
1053 cmd_AddParmAtOffset(opts, OPT_implicit, "-implicit", CMD_SINGLE,
1054 CMD_OPTIONAL, "implicit admin access bits");
1056 #if defined(AFS_SGI_ENV)
1057 cmd_AddParmAtOffset(opts, OPT_lock, "-lock", CMD_FLAG,
1058 CMD_OPTIONAL, "lock filserver binary in memory");
1060 cmd_AddParmAtOffset(opts, OPT_readonly, "-readonly", CMD_FLAG,
1061 CMD_OPTIONAL, "be a readonly fileserver");
1062 cmd_AddParmAtOffset(opts, OPT_saneacls, "-saneacls", CMD_FLAG,
1063 CMD_OPTIONAL, "set the saneacls capability bit");
1065 cmd_AddParmAtOffset(opts, OPT_buffers, "-b", CMD_SINGLE,
1066 CMD_OPTIONAL, "buffers");
1067 cmd_AddParmAtOffset(opts, OPT_callbacks, "-cb", CMD_SINGLE,
1068 CMD_OPTIONAL, "number of callbacks");
1069 cmd_AddParmAtOffset(opts, OPT_vcsize, "-vc", CMD_SINGLE,
1070 CMD_OPTIONAL, "volume cachesize");
1071 cmd_AddParmAtOffset(opts, OPT_lvnodes, "-l", CMD_SINGLE,
1072 CMD_OPTIONAL, "large vnodes");
1073 cmd_AddParmAtOffset(opts, OPT_svnodes, "-s", CMD_SINGLE,
1074 CMD_OPTIONAL, "small vnodes");
1075 cmd_AddParmAtOffset(opts, OPT_sendsize, "-sendsize", CMD_SINGLE,
1076 CMD_OPTIONAL, "size of send buffer in bytes");
1078 #if defined(AFS_AIX32_ENV)
1079 cmd_AddParmAtOffset(opts, OPT_minspare, "-m", CMD_SINGLE,
1080 CMD_OPTIONAL, "minimum percentage spare in partition");
1083 cmd_AddParmAtOffset(opts, OPT_spare, "-spare", CMD_SINGLE,
1084 CMD_OPTIONAL, "kB overage on volume quota");
1085 cmd_AddParmAtOffset(opts, OPT_pctspare, "pctspare", CMD_SINGLE,
1086 CMD_OPTIONAL, "percentage overage on volume quota");
1088 cmd_AddParmAtOffset(opts, OPT_hostcpsrefresh, "-hr", CMD_SINGLE,
1089 CMD_OPTIONAL, "hours between host CPS refreshes");
1091 #if defined(AFS_PTHREAD_ENV)
1092 cmd_AddParmAtOffset(opts, OPT_vattachthreads, "-vattachpar", CMD_SINGLE,
1093 CMD_OPTIONAL, "# of volume attachment threads");
1096 cmd_AddParmAtOffset(opts, OPT_abortthreshold, "-abortthreshold",
1097 CMD_SINGLE, CMD_OPTIONAL,
1099 cmd_AddParmAtOffset(opts, OPT_busyat, "-busyat", CMD_SINGLE, CMD_OPTIONAL,
1100 "# of queued entries after which server is busy");
1101 cmd_AddParmAtOffset(opts, OPT_nobusy, "-nobusy", CMD_FLAG, CMD_OPTIONAL,
1102 "send VRESTARTING while restarting the server");
1104 cmd_AddParmAtOffset(opts, OPT_offline_timeout, "-offline-timeout",
1105 CMD_SINGLE, CMD_OPTIONAL,
1106 "timeout for offlining volumes");
1107 cmd_AddParmAtOffset(opts, OPT_offline_shutdown_timeout,
1108 "-offline-shutdown-timeout", CMD_SINGLE, CMD_OPTIONAL,
1109 "timeout offlining volumes during shutdown");
1111 cmd_AddParmAtOffset(opts, OPT_vhandle_setaside, "-vhandle-setaside",
1112 CMD_SINGLE, CMD_OPTIONAL,
1113 "# fds reserved for non-cache IO");
1114 cmd_AddParmAtOffset(opts, OPT_vhandle_max_cachesize,
1115 "-vhandle-max-cachesize", CMD_SINGLE, CMD_OPTIONAL,
1117 cmd_AddParmAtOffset(opts, OPT_vhandle_initial_cachesize,
1118 "-vhandle-initial-cachesize", CMD_SINGLE,
1119 CMD_OPTIONAL, "# fds reserved for cache IO");
1121 #ifdef AFS_DEMAND_ATTACH_FS
1123 cmd_AddParmAtOffset(opts, OPT_fs_state_dont_save,
1124 "-fs-state-dont-save", CMD_FLAG, CMD_OPTIONAL,
1125 "disable state save during shutdown");
1126 cmd_AddParmAtOffset(opts, OPT_fs_state_dont_restore,
1127 "-fs-state-dont-restore", CMD_FLAG, CMD_OPTIONAL,
1128 "disable state restore during startup");
1129 cmd_AddParmAtOffset(opts, OPT_fs_state_verify, "-fs-state-verify",
1130 CMD_SINGLE, CMD_OPTIONAL, "none|save|restore|both");
1131 cmd_AddParmAtOffset(opts, OPT_vhashsize, "-vhashsize",
1132 CMD_SINGLE, CMD_OPTIONAL,
1133 "log(2) of # of volume hash buckets");
1134 cmd_AddParmAtOffset(opts, OPT_vlrudisable, "-vlrudisable",
1135 CMD_FLAG, CMD_OPTIONAL, "disable VLRU functionality");
1136 cmd_AddParmAtOffset(opts, OPT_vlruthresh, "-vlruthresh",
1137 CMD_FLAG, CMD_OPTIONAL,
1138 "mins before unused vols become eligible for detach");
1139 cmd_AddParmAtOffset(opts, OPT_vlruinterval, "-vlruinterval",
1140 CMD_FLAG, CMD_OPTIONAL, "secs between VLRU scans");
1141 cmd_AddParmAtOffset(opts, OPT_vlrumax, "-vlrumax", CMD_FLAG, CMD_OPTIONAL,
1142 "max volumes to detach in one scan");
1143 cmd_AddParmAtOffset(opts, OPT_unsafe_nosalvage, "-unsafe-nosalvage",
1144 CMD_FLAG, CMD_OPTIONAL,
1145 "bybass safety checks on volume attach");
1148 /* unrecommend options - should perhaps be CMD_HIDE */
1149 cmd_AddParmAtOffset(opts, OPT_stack, "-k", CMD_SINGLE, CMD_OPTIONAL,
1151 cmd_AddParmAtOffset(opts, OPT_cbwait, "-w", CMD_SINGLE, CMD_OPTIONAL,
1152 "callback wait interval");
1153 cmd_AddParmAtOffset(opts, OPT_novbc, "-novbc", CMD_SINGLE, CMD_FLAG,
1154 "disable callback breaks on reattach");
1156 /* general options */
1157 cmd_AddParmAtOffset(opts, OPT_auditlog, "-auditlog", CMD_SINGLE,
1158 CMD_OPTIONAL, "location of audit log");
1159 cmd_AddParmAtOffset(opts, OPT_auditiface, "-audit-interface", CMD_SINGLE,
1160 CMD_OPTIONAL, "interface to use for audit logging");
1161 cmd_AddParmAtOffset(opts, OPT_config, "-config", CMD_SINGLE, CMD_OPTIONAL,
1162 "configuration location");
1163 cmd_AddParmAtOffset(opts, OPT_debug, "-d", CMD_SINGLE, CMD_OPTIONAL,
1165 cmd_AddParmAtOffset(opts, OPT_logfile, "-logfile", CMD_SINGLE,
1166 CMD_OPTIONAL, "location of logfile");
1167 cmd_AddParmAtOffset(opts, OPT_mrafslogs, "-mrafslogs", CMD_FLAG,
1168 CMD_OPTIONAL, "enable MRAFS style logging");
1169 cmd_AddParmAtOffset(opts, OPT_threads, "-p", CMD_SINGLE, CMD_OPTIONAL,
1170 "number of threads");
1171 #if !defined(AFS_NT40_ENV)
1172 cmd_AddParmAtOffset(opts, OPT_syslog, "-syslog", CMD_SINGLE_OR_FLAG,
1173 CMD_OPTIONAL, "log to syslog");
1177 cmd_AddParmAtOffset(opts, OPT_peer, "-enable_peer_stats", CMD_FLAG,
1178 CMD_OPTIONAL, "enable RX transport statistics");
1179 cmd_AddParmAtOffset(opts, OPT_process, "-enable_process_stats", CMD_FLAG,
1180 CMD_OPTIONAL, "enable RX RPC statistics");
1181 cmd_AddParmAtOffset(opts, OPT_nojumbo, "-nojumbo", CMD_FLAG,
1182 CMD_OPTIONAL, "disable jumbograms");
1183 cmd_AddParmAtOffset(opts, OPT_jumbo, "-jumbo", CMD_FLAG, CMD_OPTIONAL,
1184 "enable jumbograms");
1185 cmd_AddParmAtOffset(opts, OPT_rxbind, "-rxbind", CMD_FLAG, CMD_OPTIONAL,
1186 "bind only to the primary interface");
1187 cmd_AddParmAtOffset(opts, OPT_rxdbg, "-rxdbg", CMD_FLAG, CMD_OPTIONAL,
1188 "enable rx debugging");
1189 cmd_AddParmAtOffset(opts, OPT_rxdbge, "-rxdbge", CMD_FLAG, CMD_OPTIONAL,
1190 "enable rx event debugging");
1191 cmd_AddParmAtOffset(opts, OPT_rxpck, "-rxpck", CMD_SINGLE, CMD_OPTIONAL,
1192 "# of extra rx packets");
1193 cmd_AddParmAtOffset(opts, OPT_rxmaxmtu, "-rxmaxmtu", CMD_SINGLE,
1194 CMD_OPTIONAL, "maximum MTU for RX");
1195 cmd_AddParmAtOffset(opts, OPT_udpsize, "-udpsize", CMD_SINGLE,
1196 CMD_OPTIONAL, "size of socket buffer in bytes");
1199 cmd_AddParmAtOffset(opts, OPT_dotted, "-allow-dotted-principals",
1200 CMD_FLAG, CMD_OPTIONAL,
1201 "permit Kerberos 5 principals with dots");
1202 cmd_AddParmAtOffset(opts, OPT_realm, "-realm",
1203 CMD_LIST, CMD_OPTIONAL, "local realm");
1205 code = cmd_Parse(argc, argv, &opts);
1209 if (cmd_OptionPresent(opts, OPT_large)
1210 && cmd_OptionPresent(opts, OPT_small)) {
1211 printf("Only one of -L or -S must be specified\n");
1215 if (cmd_OptionPresent(opts, OPT_spare)
1216 && cmd_OptionPresent(opts, OPT_pctspare)) {
1217 printf("Both -spare and -pctspare specified, exiting.\n");
1221 if (cmd_OptionPresent(opts, OPT_large)) {
1225 numberofcbs = 64000;
1231 if (cmd_OptionPresent(opts, OPT_small)) {
1235 numberofcbs = 20000;
1241 cmd_OptionAsFlag(opts, OPT_banner, &printBanner);
1243 if (cmd_OptionAsString(opts, OPT_implicit, &optstring) == 0) {
1244 implicitAdminRights = ParseRights(optstring);
1247 if (implicitAdminRights < 0)
1248 return implicitAdminRights;
1251 #if defined(AFS_SGI_ENV)
1252 cmd_OptionAsFlag(opts, OPT_lock, &SawLock);
1254 cmd_OptionAsFlag(opts, OPT_readonly, &readonlyServer);
1255 cmd_OptionAsFlag(opts, OPT_saneacls, &saneacls);
1256 cmd_OptionAsInt(opts, OPT_buffers, &buffs);
1258 if (cmd_OptionAsInt(opts, OPT_callbacks, &numberofcbs) == 0) {
1259 printf("number of cbs %d invalid; "
1260 "must be between 10000 and 2147483647\n", numberofcbs);
1264 cmd_OptionAsInt(opts, OPT_vcsize, &volcache);
1265 cmd_OptionAsInt(opts, OPT_lvnodes, &large);
1266 cmd_OptionAsInt(opts, OPT_svnodes, &nSmallVns);
1267 if (cmd_OptionAsInt(opts, OPT_sendsize, &optval) == 0) {
1268 if (optval < 16384) {
1269 printf("Warning:sendsize %d is less than minimum %d; ignoring\n",
1272 sendBufSize = optval;
1275 #if defined(AFS_AIX32_ENV)
1276 if (cmd_OptionAsInt(opts, OPT_minspare, &aixlow_water) == 0) {
1277 if ((aixlow_water < 0) || (aixlow_water > 30)) {
1278 printf("space reserved %d%% invalid; must be between 0-30%\n",
1285 cmd_OptionAsInt(opts, OPT_spare, &BlocksSpare);
1286 if (cmd_OptionAsInt(opts, OPT_pctspare, &PctSpare) == 0) {
1290 if (cmd_OptionAsInt(opts, OPT_hostcpsrefresh, &optval) == 0) {
1291 if ((optval < 1) || (optval > 36)) {
1292 printf("host acl refresh interval of %d hours is invalid; "
1293 "hours must be between 1 and 36\n\n", optval);
1296 hostaclRefresh = optval * 60 * 60;
1299 #ifdef AFS_PTHREAD_ENV
1300 cmd_OptionAsInt(opts, OPT_vattachthreads, &vol_attach_threads);
1301 #endif /* AFS_PTHREAD_ENV */
1303 cmd_OptionAsInt(opts, OPT_abortthreshold, &abort_threshold);
1305 /* busyat is at the end, as rxpackets has to be set before we can use it */
1306 if (cmd_OptionPresent(opts, OPT_nobusy))
1309 if (cmd_OptionAsInt(opts, OPT_offline_timeout, &offline_timeout) == 0) {
1310 #ifndef AFS_PTHREAD_ENV
1311 if (offline_timeout != -1) {
1312 printf("The only valid -offline-timeout value for the LWP "
1313 "fileserver is -1\n");
1316 #endif /* AFS_PTHREAD_ENV */
1317 if (offline_timeout < -1) {
1318 printf("Invalid -offline-timeout value %d; the only valid "
1319 "negative value is -1\n", offline_timeout);
1324 if (cmd_OptionAsInt(opts, OPT_offline_shutdown_timeout,
1325 &offline_shutdown_timeout) == 0) {
1326 #ifndef AFS_PTHREAD_ENV
1327 if (offline_shutdown_timeout != -1) {
1328 printf("The only valid -offline-shutdown-timeout value for the "
1329 "LWP fileserver is -1\n");
1332 #endif /* AFS_PTHREAD_ENV */
1333 if (offline_shutdown_timeout < -1) {
1334 printf("Invalid -offline-timeout value %d; the only valid "
1335 "negative value is -1\n", offline_shutdown_timeout);
1340 cmd_OptionAsUint(opts, OPT_vhandle_setaside,
1341 &vol_io_params.fd_handle_setaside);
1342 cmd_OptionAsUint(opts, OPT_vhandle_max_cachesize,
1343 &vol_io_params.fd_max_cachesize);
1344 cmd_OptionAsUint(opts, OPT_vhandle_initial_cachesize,
1345 &vol_io_params.fd_initial_cachesize);
1347 #ifdef AFS_DEMAND_ATTACH_FS
1348 if (cmd_OptionPresent(opts, OPT_fs_state_dont_save))
1349 fs_state.options.fs_state_save = 0;
1350 if (cmd_OptionPresent(opts, OPT_fs_state_dont_restore))
1351 fs_state.options.fs_state_restore = 0;
1352 if (cmd_OptionAsString(opts, OPT_fs_state_verify, &optstring) == 0) {
1353 if (strcmp(optstring, "none") == 0) {
1354 fs_state.options.fs_state_verify_before_save = 0;
1355 fs_state.options.fs_state_verify_after_restore = 0;
1356 } else if (strcmp(optstring, "save") == 0) {
1357 fs_state.options.fs_state_verify_after_restore = 0;
1358 } else if (strcmp(optstring, "restore") == 0) {
1359 fs_state.options.fs_state_verify_before_save = 0;
1360 } else if (strcmp(optstring, "both") == 0) {
1363 fprintf(stderr, "invalid argument for -fs-state-verify\n");
1367 if (cmd_OptionAsInt(opts, OPT_vhashsize, &optval) == 0) {
1368 if (VSetVolHashSize(optval)) {
1369 fprintf(stderr, "specified -vhashsize (%d) is invalid or out "
1370 "of range\n", optval);
1374 if (cmd_OptionPresent(opts, OPT_vlrudisable))
1375 VLRU_SetOptions(VLRU_SET_ENABLED, 0);
1376 if (cmd_OptionAsInt(opts, OPT_vlruthresh, &optval) == 0)
1377 VLRU_SetOptions(VLRU_SET_THRESH, 60*optval);
1378 if (cmd_OptionAsInt(opts, OPT_vlruinterval, &optval) == 0)
1379 VLRU_SetOptions(VLRU_SET_INTERVAL, optval);
1380 if (cmd_OptionAsInt(opts, OPT_vlrumax, &optval) == 0)
1381 VLRU_SetOptions(VLRU_SET_MAX, optval);
1382 cmd_OptionAsFlag(opts, OPT_unsafe_nosalvage, &unsafe_attach);
1383 #endif /* AFS_DEMAND_ATTACH_FS */
1385 cmd_OptionAsInt(opts, OPT_stack, &stack);
1386 cmd_OptionAsInt(opts, OPT_cbwait, &fiveminutes);
1387 cmd_OptionAsFlag(opts, OPT_novbc, &novbc);
1389 /* general server options */
1390 cmd_OptionAsString(opts, OPT_auditlog, &auditFileName);
1392 if (cmd_OptionAsString(opts, OPT_auditiface, &optstring) == 0) {
1393 if (osi_audit_interface(optstring)) {
1394 printf("Invalid audit interface '%s'\n", optstring);
1401 /* XXX - cmd_OptionAsString(opts, OPT_config, &configDir); */
1402 cmd_OptionAsInt(opts, OPT_debug, &LogLevel);
1403 /* XXX - cmd_OptionAsString(opts, OPT_logfile, &logFile); */
1404 cmd_OptionAsFlag(opts, OPT_mrafslogs, &mrafsStyleLogs);
1406 if (cmd_OptionAsInt(opts, OPT_threads, &lwps) == 0) {
1407 lwps_max = max_fileserver_thread() - FILESERVER_HELPER_THREADS;
1408 if (lwps > lwps_max)
1414 #ifndef AFS_NT40_ENV
1415 if (cmd_OptionPresent(opts, OPT_syslog)) {
1416 serverLogSyslog = 1;
1417 cmd_OptionAsInt(opts, OPT_syslog, &serverLogSyslogFacility);
1421 if (cmd_OptionPresent(opts, OPT_peer))
1422 rx_enablePeerRPCStats();
1423 if (cmd_OptionPresent(opts, OPT_process))
1424 rx_enableProcessRPCStats();
1425 if (cmd_OptionPresent(opts, OPT_nojumbo))
1427 if (cmd_OptionPresent(opts, OPT_jumbo))
1429 cmd_OptionAsFlag(opts, OPT_rxbind, &rxBind);
1430 cmd_OptionAsFlag(opts, OPT_rxdbg, &rxlog);
1431 cmd_OptionAsFlag(opts, OPT_rxdbge, &eventlog);
1432 cmd_OptionAsInt(opts, OPT_rxpck, &rxpackets);
1434 if (cmd_OptionAsInt(opts, OPT_rxmaxmtu, &rxMaxMTU) == 0) {
1435 if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
1436 (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
1437 printf("rxMaxMTU %d invalid; must be between %d-%" AFS_SIZET_FMT "\n",
1438 rxMaxMTU, RX_MIN_PACKET_SIZE,
1439 RX_MAX_PACKET_DATA_SIZE);
1444 if (cmd_OptionAsInt(opts, OPT_udpsize, &optval) == 0) {
1445 if (optval < rx_GetMinUdpBufSize()) {
1446 printf("Warning:udpsize %d is less than minimum %d; ignoring\n",
1447 optval, rx_GetMinUdpBufSize());
1449 udpBufSize = optval;
1453 cmd_OptionAsFlag(opts, OPT_dotted, &rxkadDisableDotCheck);
1454 if (cmd_OptionAsList(opts, OPT_realm, &optlist) == 0) {
1455 extern char local_realms[AFS_NUM_LREALMS][AFS_REALM_SZ];
1456 extern int num_lrealms;
1458 for (; optlist != NULL; optlist=optlist->next) {
1459 if (strlen(optlist->data) >= AFS_REALM_SZ) {
1460 printf("-realm argument must contain fewer than %d "
1461 "characters.\n", AFS_REALM_SZ);
1465 if (num_lrealms == -1)
1467 if (num_lrealms >= AFS_NUM_LREALMS) {
1468 printf("a maximum of %d -realm arguments can be "
1469 "specified.\n", AFS_NUM_LREALMS);
1473 strncpy(local_realms[num_lrealms++], optlist->data, AFS_REALM_SZ);
1474 optlist = optlist->next;
1478 /* anything setting rxpackets must come before this */
1479 if (cmd_OptionAsInt(opts, OPT_busyat, &optval) == 0) {
1481 printf("Busy threshold %d is too low, will use default.\n",
1483 busy_threshold = 3 * rxpackets / 2;
1485 busy_threshold = optval;
1488 busy_threshold = 3 * rxpackets / 2;
1492 osi_audit_file(auditFileName);
1497 /* Once upon a time, in a galaxy far far away, IBM AFS supported the use of
1498 * a file /vice/file/parms, the contents of which would override any command
1499 * line parameters. We no longer support the use of such a file, but we warn
1500 * if we encounter its presence from an older release
1505 struct afs_stat sbuf;
1507 if (afs_stat("/vice/file/parms", &sbuf) == 0) {
1508 ViceLog(0, ("Using /vice/file/parms to override command line "
1509 "options is no longer supported"));
1513 /* Miscellaneous routines */
1515 Die(const char *msg)
1518 ViceLogThenPanic(0, ("%s\n", msg));
1528 * If this fails, it's because something major is wrong, and is not
1529 * likely to be time dependent.
1531 code = pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH, 0);
1534 ("Couldn't initialize protection library; code=%d.\n", code));
1538 #ifdef AFS_PTHREAD_ENV
1539 osi_Assert(pthread_key_create(&viced_uclient_key, NULL) == 0);
1542 SystemId = SYSADMINID;
1543 SystemAnyUser = ANYUSERID;
1544 SystemAnyUserCPS.prlist_len = 0;
1545 SystemAnyUserCPS.prlist_val = NULL;
1546 AnonCPS.prlist_len = 0;
1547 AnonCPS.prlist_val = NULL;
1549 code = pr_GetCPS(SystemAnyUser, &SystemAnyUserCPS);
1552 ("Couldn't get CPS for AnyUser, will try again in 30 seconds; code=%d.\n",
1556 code = pr_GetCPS(ANONYMOUSID, &AnonCPS);
1559 ("Couldn't get Anonymous CPS, exiting; code=%d.\n",
1563 AnonymousID = ANONYMOUSID;
1566 #ifdef AFS_PTHREAD_ENV
1568 #else /* AFS_PTHREAD_ENV */
1570 #endif /* AFS_PTHREAD_ENV */
1574 struct rx_connection *serverconns[MAXSERVERS];
1575 struct ubik_client *cstruct;
1578 vl_Initialize(const char *confDir)
1581 afs_int32 scIndex = RX_SECIDX_NULL;
1582 struct afsconf_dir *tdir;
1583 struct rx_securityClass *sc;
1584 struct afsconf_cell info;
1586 tdir = afsconf_Open(confDir);
1589 ("Could not open configuration directory (%s).\n", confDir));
1592 code = afsconf_ClientAuth(tdir, &sc, &scIndex);
1594 ViceLog(0, ("Could not get security object for localAuth\n"));
1597 code = afsconf_GetCellInfo(tdir, NULL, AFSCONF_VLDBSERVICE, &info);
1598 if (info.numServers > MAXSERVERS) {
1600 ("vl_Initialize: info.numServers=%d (> MAXSERVERS=%d)\n",
1601 info.numServers, MAXSERVERS));
1604 for (i = 0; i < info.numServers; i++)
1606 rx_NewConnection(info.hostAddr[i].sin_addr.s_addr,
1607 info.hostAddr[i].sin_port, USER_SERVICE_ID, sc,
1609 code = ubik_ClientInit(serverconns, &cstruct);
1610 afsconf_Close(tdir);
1612 ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
1618 #define SYSIDMAGIC 0x88aabbcc
1619 #define SYSIDVERSION 1
1624 afs_int32 fd, nentries, i;
1625 struct versionStamp vsn;
1626 struct afs_stat status;
1629 if ((afs_stat(AFSDIR_SERVER_SYSID_FILEPATH, &status))
1630 || (status.st_size <= 0)) {
1631 ViceLog(0, ("%s: doesn't exist\n", AFSDIR_SERVER_SYSID_FILEPATH));
1634 if (!(fd = afs_open(AFSDIR_SERVER_SYSID_FILEPATH, O_RDONLY, 0))) {
1636 ("%s: can't open (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1640 if (read(fd, (char *)&vsn, sizeof(vsn)) != sizeof(vsn)) {
1642 ("%s: Read failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1646 if (vsn.magic != SYSIDMAGIC) {
1648 ("%s: wrong magic %x (we support %x)\n",
1649 AFSDIR_SERVER_SYSID_FILEPATH, vsn.magic, SYSIDMAGIC));
1652 if (vsn.version != SYSIDVERSION) {
1654 ("%s: wrong version %d (we support %d)\n",
1655 AFSDIR_SERVER_SYSID_FILEPATH, vsn.version, SYSIDVERSION));
1658 if (read(fd, (char *)&uuid, sizeof(struct afsUUID))
1659 != sizeof(struct afsUUID)) {
1661 ("%s: read of uuid failed (%d)\n",
1662 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1665 afs_ntohuuid(&uuid);
1667 if (read(fd, (char *)&nentries, sizeof(afs_int32)) != sizeof(afs_int32)) {
1669 ("%s: Read of entries failed (%d)\n",
1670 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1673 if (nentries <= 0 || nentries > ADDRSPERSITE) {
1675 ("%s: invalid num of interfaces: %d\n",
1676 AFSDIR_SERVER_SYSID_FILEPATH, nentries));
1679 if (FS_HostAddr_cnt == 0) {
1680 FS_HostAddr_cnt = nentries;
1681 for (i = 0; i < nentries; i++) {
1682 if (read(fd, (char *)&FS_HostAddrs[i], sizeof(afs_int32)) !=
1683 sizeof(afs_int32)) {
1685 ("%s: Read of addresses failed (%d)\n",
1686 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1687 FS_HostAddr_cnt = 0; /* reset it */
1693 ("%s: address list ignored (NetInfo/NetRestrict override)\n",
1694 AFSDIR_SERVER_SYSID_FILEPATH));
1701 WriteSysIdFile(void)
1704 struct versionStamp vsn;
1705 struct afs_stat status;
1708 if (!afs_stat(AFSDIR_SERVER_SYSID_FILEPATH, &status)) {
1710 * File exists; keep the old one around
1712 renamefile(AFSDIR_SERVER_SYSID_FILEPATH,
1713 AFSDIR_SERVER_OLDSYSID_FILEPATH);
1715 fd = afs_open(AFSDIR_SERVER_SYSID_FILEPATH, O_WRONLY | O_TRUNC | O_CREAT,
1719 ("%s: can't create (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1723 vsn.magic = SYSIDMAGIC;
1725 if ((i = write(fd, (char *)&vsn, sizeof(vsn))) != sizeof(vsn)) {
1727 ("%s: write failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1732 afs_htonuuid(&uuid);
1734 write(fd, (char *)&uuid,
1735 sizeof(struct afsUUID))) != sizeof(struct afsUUID)) {
1737 ("%s: write of uuid failed (%d)\n",
1738 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1742 write(fd, (char *)&FS_HostAddr_cnt,
1743 sizeof(afs_int32))) != sizeof(afs_int32)) {
1745 ("%s: write of # of entries failed (%d)\n",
1746 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1749 for (i = 0; i < FS_HostAddr_cnt; i++) {
1750 if (write(fd, (char *)&FS_HostAddrs[i], sizeof(afs_int32)) !=
1751 sizeof(afs_int32)) {
1753 ("%s: write of addresses failed (%d)\n",
1754 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1764 * This routine sets up the buffers for the VL_RegisterAddrs RPC. All addresses
1765 * in FS_HostAddrs[] are in NBO, while the RPC treats them as a "blob" of data
1766 * and so we need to convert each of them into HBO which is what the extra
1767 * array called FS_HostAddrs_HBO is used here.
1770 Do_VLRegisterRPC(void)
1774 afs_uint32 FS_HostAddrs_HBO[ADDRSPERSITE];
1777 for (i = 0; i < FS_HostAddr_cnt; i++)
1778 FS_HostAddrs_HBO[i] = ntohl(FS_HostAddrs[i]);
1779 addrs.bulkaddrs_len = FS_HostAddr_cnt;
1780 addrs.bulkaddrs_val = (afs_uint32 *) FS_HostAddrs_HBO;
1781 code = ubik_VL_RegisterAddrs(cstruct, 0, &FS_HostUUID, 0, &addrs);
1783 if (code == VL_MULTIPADDR) {
1785 ("VL_RegisterAddrs rpc failed; The IP address exists on a different server; repair it\n"));
1787 ("VL_RegisterAddrs rpc failed; See VLLog for details\n"));
1789 } else if (code == RXGEN_OPCODE) {
1791 ("vlserver doesn't support VL_RegisterAddrs rpc; ignored\n"));
1792 FS_registered = 2; /* So we don't have to retry in the gc daemon */
1795 ("VL_RegisterAddrs rpc failed; will retry periodically (code=%d, err=%d)\n",
1797 FS_registered = 1; /* Retry in the gc daemon */
1800 FS_registered = 2; /* So we don't have to retry in the gc daemon */
1812 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
1814 * Find addresses we are supposed to register as per the netrestrict
1815 * and netinfo files (/usr/afs/local/NetInfo and
1816 * /usr/afs/local/NetRestict)
1819 afs_int32 code = parseNetFiles(FS_HostAddrs, NULL, NULL,
1820 ADDRSPERSITE, reason,
1821 AFSDIR_SERVER_NETINFO_FILEPATH,
1822 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1824 ViceLog(0, ("Can't register any valid addresses: %s\n", reason));
1827 FS_HostAddr_cnt = (afs_uint32) code;
1830 FS_HostAddr_cnt = rx_getAllAddr(FS_HostAddrs, ADDRSPERSITE);
1833 if (FS_HostAddr_cnt == 1 && rxBind == 1)
1834 code = FS_HostAddrs[0];
1836 code = htonl(INADDR_ANY);
1846 * If this fails, it's because something major is wrong, and is not
1847 * likely to be time dependent.
1849 code = vl_Initialize(AFSDIR_SERVER_ETC_DIRPATH);
1852 ("Couldn't initialize protection library; code=%d.\n", code));
1856 /* Read or create the sysid file and register the fileserver's
1857 * IP addresses with the vlserver.
1859 code = ReadSysIdFile();
1861 /* Need to create the file */
1862 ViceLog(0, ("Creating new SysID file\n"));
1863 if ((code = afs_uuid_create(&FS_HostUUID))) {
1864 ViceLog(0, ("Failed to create new uuid: %d\n", code));
1868 /* A good sysid file exists; inform the vlserver. If any conflicts,
1869 * we always use the latest interface available as the real truth.
1872 code = Do_VLRegisterRPC();
1877 main(int argc, char *argv[])
1881 struct rx_securityClass **securityClasses;
1882 afs_int32 numClasses;
1883 struct rx_service *tservice;
1884 #ifdef AFS_PTHREAD_ENV
1885 pthread_t serverPid;
1886 pthread_attr_t tattr;
1887 #else /* AFS_PTHREAD_ENV */
1888 PROCESS parentPid, serverPid;
1889 #endif /* AFS_PTHREAD_ENV */
1891 int minVnodesRequired; /* min size of vnode cache */
1892 #ifndef AFS_NT40_ENV
1893 struct rlimit rlim; /* max number of open file descriptors */
1898 afs_uint32 rx_bindhost;
1899 VolumePackageOptions opts;
1901 #ifdef AFS_AIX32_ENV
1902 struct sigaction nsa;
1904 sigemptyset(&nsa.sa_mask);
1905 nsa.sa_handler = SIG_DFL;
1906 nsa.sa_flags = SA_FULLDUMP;
1907 sigaction(SIGABRT, &nsa, NULL);
1908 sigaction(SIGSEGV, &nsa, NULL);
1912 /* Initialize dirpaths */
1913 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
1915 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
1917 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
1921 /* set ihandle package defaults prior to parsing args */
1924 /* check for the parameter file */
1927 if (ParseArgs(argc, argv)) {
1930 #ifdef AFS_PTHREAD_ENV
1931 MUTEX_INIT(&fileproc_glock_mutex, "fileproc", MUTEX_DEFAULT, 0);
1932 #endif /* AFS_PTHREAD_ENV */
1934 #ifdef AFS_SGI_VNODE_GLUE
1935 if (afs_init_kernel_config(-1) < 0) {
1937 ("Can't determine NUMA configuration, not starting fileserver.\n");
1941 confDir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
1943 fprintf(stderr, "Unable to open config directory %s\n",
1944 AFSDIR_SERVER_ETC_DIRPATH);
1948 /* Open FileLog on stdout, stderr, fd 1 and fd2 (for perror), sigh. */
1949 #ifndef AFS_NT40_ENV
1950 serverLogSyslogTag = "fileserver";
1952 OpenLog(AFSDIR_SERVER_FILELOG_FILEPATH);
1955 LogCommandLine(argc, argv, "starting", "", "File server", FSLog);
1957 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
1958 /* initialize the pthread soft signal handler thread */
1962 /* install signal handlers for controlling the fileserver process */
1963 ResetCheckSignal(); /* set CheckSignal_Signal() sig handler */
1964 ResetCheckDescriptors(); /* set CheckDescriptors_Signal() sig handler */
1966 #if defined(AFS_SGI_ENV)
1967 /* give this guy a non-degrading priority so help busy servers */
1968 schedctl(NDPRI, 0, NDPNORMMAX);
1971 #elif !defined(AFS_NT40_ENV)
1972 nice(-5); /* TODO: */
1975 #ifdef AFS_DEMAND_ATTACH_FS
1980 if (afs_winsockInit() < 0) {
1981 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
1982 ViceLog(0, ("File server failed to intialize winsock.\n"));
1988 /* if we support more than 16 threads, then we better have the ability
1989 ** to keep open a large number of files simultaneously
1991 #if defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV)
1992 curLimit = OPEN_MAX; /* for pre AIX 4.2 systems */
1993 #elif defined(AFS_NT40_ENV)
1994 curLimit = NT_OPEN_MAX; /* open file descriptor limit on NT */
1997 curLimit = 0; /* the number of open file descriptors */
1998 code = getrlimit(RLIMIT_NOFILE, &rlim);
2000 curLimit = rlim.rlim_cur;
2001 rlim.rlim_cur = rlim.rlim_max;
2002 code = setrlimit(RLIMIT_NOFILE, &rlim);
2004 curLimit = rlim.rlim_max;
2007 ViceLog(0, ("Failed to increase open file limit, using default\n"));
2009 #endif /* defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV) */
2011 curLimit -= 32; /* leave a slack of 32 file descriptors */
2012 if (lwps > curLimit) {
2016 lwps = 16; /* default to a maximum of 16 threads */
2018 /* tune the ihandle fd cache accordingly */
2019 if (vol_io_params.fd_max_cachesize < curLimit)
2020 vol_io_params.fd_max_cachesize = curLimit + 1;
2023 ("The system supports a max of %d open files and we are starting %d threads (ihandle fd cache is %d)\n",
2024 curLimit, lwps, vol_io_params.fd_max_cachesize));
2026 #ifndef AFS_PTHREAD_ENV
2027 osi_Assert(LWP_InitializeProcessSupport(LWP_MAX_PRIORITY - 2, &parentPid) ==
2029 #endif /* !AFS_PTHREAD_ENV */
2031 /* Initialize volume support */
2033 V_BreakVolumeCallbacks = BreakVolumeCallBacksLater;
2036 #ifdef AFS_PTHREAD_ENV
2037 SetLogThreadNumProgram( rx_GetThreadNum );
2040 /* initialize libacl routines */
2041 acl_Initialize(ACL_VERSION);
2043 /* initialize RX support */
2044 #ifndef AFS_NT40_ENV
2045 rxi_syscallp = viced_syscall;
2047 rx_extraPackets = rxpackets;
2048 rx_extraQuota = 4; /* for outgoing prserver calls from R threads */
2049 rx_SetBusyThreshold(busy_threshold, VBUSY);
2050 rx_SetCallAbortThreshold(abort_threshold);
2051 rx_SetConnAbortThreshold(abort_threshold);
2053 stackSize = 128 * 1024;
2055 stackSize = lwps * 4000;
2056 if (stackSize < 32000)
2058 else if (stackSize > 44000)
2061 #if defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI51_ENV) || defined(AFS_XBSD_ENV)
2062 rx_SetStackSize(1, stackSize);
2065 rx_SetUdpBufSize(udpBufSize); /* set the UDP buffer size for receive */
2066 rx_bindhost = SetupVL();
2068 if (rx_InitHost(rx_bindhost, (int)htons(7000)) < 0) {
2069 ViceLog(0, ("Cannot initialize RX\n"));
2072 if (!rxJumbograms) {
2073 /* Don't send and don't allow 3.4 clients to send jumbograms. */
2076 if (rxMaxMTU != -1) {
2077 rx_SetMaxMTU(rxMaxMTU);
2080 rx_SetRxDeadTime(30);
2081 afsconf_SetSecurityFlags(confDir, AFSCONF_SECOPTS_ALWAYSENCRYPT);
2082 afsconf_BuildServerSecurityObjects(confDir, &securityClasses, &numClasses);
2084 tservice = rx_NewServiceHost(rx_bindhost, /* port */ 0, /* service id */
2085 1, /*service name */
2087 securityClasses, numClasses,
2088 RXAFS_ExecuteRequest);
2091 ("Failed to initialize RX, probably two servers running.\n"));
2094 if (rxkadDisableDotCheck) {
2095 rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
2096 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
2098 rx_SetMinProcs(tservice, 3);
2099 rx_SetMaxProcs(tservice, lwps);
2100 rx_SetCheckReach(tservice, 1);
2101 rx_SetServerIdleDeadErr(tservice, VNOSERVICE);
2104 rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", securityClasses,
2105 numClasses, RXSTATS_ExecuteRequest);
2107 ViceLog(0, ("Failed to initialize rpc stat service.\n"));
2110 rx_SetMinProcs(tservice, 2);
2111 rx_SetMaxProcs(tservice, 4);
2114 * Enable RX hot threads, which allows the listener thread to trade
2115 * places with an idle thread and moves the context switch from listener
2116 * to worker out of the critical path.
2118 rx_EnableHotThread();
2120 /* Some rx debugging */
2121 if (rxlog || eventlog) {
2122 debugFile = afs_fopen("rx_dbg", "w");
2124 rx_debugFile = debugFile;
2126 rxevent_debugFile = debugFile;
2129 init_sys_error_to_et(); /* Set up error table translation */
2130 h_InitHostPackage(); /* set up local cellname and realmname */
2131 InitCallBack(numberofcbs);
2135 if (code && code != VL_MULTIPADDR) {
2136 ViceLog(0, ("Fatal error in library initialization, exiting!!\n"));
2141 if (code && code != -1) {
2142 ViceLog(0, ("Fatal error in protection initialization, exiting!!\n"));
2146 /* allow super users to manage RX statistics */
2147 rx_SetRxStatUserOk(fs_rxstat_userok);
2149 CV_INIT(&fsync_cond, "fsync", CV_DEFAULT, 0);
2150 MUTEX_INIT(&fsync_glock_mutex, "fsync", MUTEX_DEFAULT, 0);
2152 #if !defined(AFS_DEMAND_ATTACH_FS)
2154 * For DAFS, we do not start the Rx server threads until after
2155 * the volume package is initialized, and fileserver state is
2156 * restored. This is necessary in order to keep host and callback
2157 * package state pristine until we have a chance to restore state.
2159 * Furthermore, startup latency is much lower with dafs, so this
2160 * shouldn't pose a serious problem.
2162 rx_StartServer(0); /* now start handling requests */
2165 /* we ensure that there is enough space in the vnode buffer to satisfy
2166 ** requests from all concurrent threads.
2167 ** the maximum number of vnodes used by a single thread at any one time
2168 ** is three ( "link" uses three vnodes simultaneously, one vLarge and
2169 ** two vSmall for linking files and two vLarge and one vSmall for linking
2172 minVnodesRequired = 2 * lwps + 1;
2173 if (minVnodesRequired > nSmallVns) {
2174 nSmallVns = minVnodesRequired;
2176 ("Overriding -s command line parameter with %d\n",
2179 if (minVnodesRequired > large) {
2180 large = minVnodesRequired;
2181 ViceLog(0, ("Overriding -l command line parameter with %d\n", large));
2184 /* We now do this after getting the listener up and running, so that client
2185 * connections don't timeout (maybe) if a file server is restarted, since it
2186 * will be available "real soon now". Worry about whether we can satisfy the
2187 * calls in the volume package itself.
2189 VOptDefaults(fileServer, &opts);
2190 opts.nLargeVnodes = large;
2191 opts.nSmallVnodes = nSmallVns;
2192 opts.volcache = volcache;
2193 opts.unsafe_attach = unsafe_attach;
2194 if (offline_timeout != -1) {
2195 opts.interrupt_rxcall = rx_InterruptCall;
2196 opts.offline_timeout = offline_timeout;
2198 if (offline_shutdown_timeout == -1) {
2199 /* default to -offline-timeout, if shutdown-specific timeout is not
2201 opts.offline_shutdown_timeout = offline_timeout;
2203 opts.interrupt_rxcall = rx_InterruptCall;
2204 opts.offline_shutdown_timeout = offline_shutdown_timeout;
2207 if (VInitVolumePackage2(fileServer, &opts)) {
2209 ("Shutting down: errors encountered initializing volume package\n"));
2214 /* Install handler to catch the shutdown signal;
2215 * bosserver assumes SIGQUIT shutdown
2217 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
2218 softsig_signal(SIGQUIT, ShutDown_Signal);
2220 (void)signal(SIGQUIT, ShutDown_Signal);
2223 if (VInitAttachVolumes(fileServer)) {
2225 ("Shutting down: errors encountered initializing volume package\n"));
2230 #ifdef AFS_DEMAND_ATTACH_FS
2231 if (fs_state.options.fs_state_restore) {
2234 * restore fileserver state */
2237 rx_StartServer(0); /* now start handling requests */
2238 #endif /* AFS_DEMAND_ATTACH_FS */
2241 * We are done calling fopen/fdopen. It is safe to use a large
2242 * of the file descriptor cache.
2246 #ifdef AFS_PTHREAD_ENV
2247 ViceLog(5, ("Starting pthreads\n"));
2248 osi_Assert(pthread_attr_init(&tattr) == 0);
2249 osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
2251 osi_Assert(pthread_create
2252 (&serverPid, &tattr, FiveMinuteCheckLWP,
2253 &fiveminutes) == 0);
2254 osi_Assert(pthread_create
2255 (&serverPid, &tattr, HostCheckLWP, &fiveminutes) == 0);
2256 osi_Assert(pthread_create
2257 (&serverPid, &tattr, FsyncCheckLWP, &fiveminutes) == 0);
2258 #else /* AFS_PTHREAD_ENV */
2259 ViceLog(5, ("Starting LWP\n"));
2260 osi_Assert(LWP_CreateProcess
2261 (FiveMinuteCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
2262 (void *)&fiveminutes, "FiveMinuteChecks",
2263 &serverPid) == LWP_SUCCESS);
2265 osi_Assert(LWP_CreateProcess
2266 (HostCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
2267 (void *)&fiveminutes, "HostCheck", &serverPid) == LWP_SUCCESS);
2268 osi_Assert(LWP_CreateProcess
2269 (FsyncCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
2270 (void *)&fiveminutes, "FsyncCheck", &serverPid) == LWP_SUCCESS);
2271 #endif /* AFS_PTHREAD_ENV */
2273 FT_GetTimeOfDay(&tp, 0);
2276 * Figure out the FileServer's name and primary address.
2278 ViceLog(0, ("Getting FileServer name...\n"));
2279 code = gethostname(FS_HostName, 64);
2281 ViceLog(0, ("gethostname() failed\n"));
2283 ViceLog(0, ("FileServer host name is '%s'\n", FS_HostName));
2285 ViceLog(0, ("Getting FileServer address...\n"));
2286 he = gethostbyname(FS_HostName);
2288 ViceLog(0, ("Can't find address for FileServer '%s'\n", FS_HostName));
2291 memcpy(&FS_HostAddr_NBO, he->h_addr, 4);
2292 (void)afs_inet_ntoa_r(FS_HostAddr_NBO, hoststr);
2293 FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO);
2295 ("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n",
2296 FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
2300 strftime(tbuffer, sizeof(tbuffer), "%a %b %d %H:%M:%S %Y",
2301 localtime_r(&t, &tm));
2302 ViceLog(0, ("File Server started %s\n", tbuffer));
2303 #if FS_STATS_DETAILED
2304 afs_FullPerfStats.det.epoch.tv_sec = StartTime = tp.tv_sec;
2306 #ifdef AFS_PTHREAD_ENV
2308 sleep(1000); /* long time */
2310 #else /* AFS_PTHREAD_ENV */
2311 osi_Assert(LWP_WaitProcess(&parentPid) == LWP_SUCCESS);
2312 #endif /* AFS_PTHREAD_ENV */