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 <rx/rx_queue.h>
49 #include <opr/softsig.h>
50 #include <afs/procmgmt_softsig.h> /* must come after softsig.h */
52 #include <afs/ptclient.h>
53 #include <afs/afsint.h>
54 #include <afs/vldbint.h>
55 #include <afs/errors.h>
56 #include <afs/ihandle.h>
57 #include <afs/vnode.h>
58 #include <afs/volume.h>
60 #include <afs/cellconfig.h>
62 #include <afs/prs_fs.h>
64 #include <rx/rxstat.h>
66 #include <afs/afs_args.h>
67 #include <afs/vlserver.h>
68 #include <afs/afsutil.h>
69 #include <afs/fileutil.h>
70 #include <afs/ptuser.h>
71 #include <afs/audit.h>
72 #include <afs/partition.h>
74 #include <afs/afsutil.h>
75 #include "viced_prototypes.h"
78 #if defined(AFS_SGI_ENV)
79 # include "sys/schedctl.h"
80 # include "sys/lock.h"
82 #include <rx/rx_globals.h>
86 static void ClearXStatValues(void);
87 static void PrintCounters(void);
89 static afs_int32
Do_VLRegisterRPC(void);
91 int eventlog
= 0, rxlog
= 0;
93 static struct logOptions logopts
;
95 pthread_mutex_t fsync_glock_mutex
;
96 pthread_cond_t fsync_cond
;
99 # define NT_OPEN_MAX 1024 /* This is an arbitrary no. we came up with for
100 * now. We hope this will be replaced by a more
101 * intelligent estimate later. */
104 int SystemId
; /* ViceID of "Administrators" */
105 int SystemAnyUser
; /* Viceid of "System:AnyUser" */
106 prlist SystemAnyUserCPS
; /* CPS for "system:AnyUser */
107 int AnonymousID
= 0; /* ViceId of "Anonymous" */
108 prlist AnonCPS
; /* CPS for "Anonymous" */
110 struct afsconf_dir
*confDir
; /* Configuration dir object */
112 int restartMode
= RESTART_ORDINARY
;
115 * Home for the performance statistics.
117 struct afs_PerfStats afs_perfstats
;
119 extern int Statistics
;
124 int rxJumbograms
= 0; /* default is to not send and receive jumbograms. */
125 int rxBind
= 0; /* don't bind */
126 int rxkadDisableDotCheck
= 0; /* disable check for dot in principal name */
128 afs_int32 implicitAdminRights
= PRSFS_LOOKUP
; /* The ADMINISTER right is
130 afs_int32 readonlyServer
= 0;
132 int stackSize
= 24000;
133 int fiveminutes
= 300; /* 5 minutes. Change this for debugging only */
134 int CurrentConnections
= 0;
135 int hostaclRefresh
= 7200; /* refresh host clients' acls every 2 hrs */
136 #if defined(AFS_SGI_ENV)
142 * seconds to wait until forcing a panic during ShutDownAndCore(PANIC)
143 * in case we get stuck.
145 #ifdef AFS_DEMAND_ATTACH_FS
146 static int panic_timeout
= 2 * 60;
148 static int panic_timeout
= 30 * 60;
151 static int host_thread_quota
;
152 int rxpackets
= 150; /* 100 */
153 int nSmallVns
= 400; /* 200 */
154 int large
= 400; /* 200 */
155 int volcache
= 400; /* 400 */
156 int numberofcbs
= 60000; /* 60000 */
157 int lwps
= 9; /* 6 */
158 int buffs
= 90; /* 70 */
159 int novbc
= 0; /* Enable Volume Break calls */
160 int busy_threshold
= 600;
161 int abort_threshold
= 10;
162 int udpBufSize
= 0; /* UDP buffer size for receive */
163 int sendBufSize
= 16384; /* send buffer size */
164 int saneacls
= 0; /* Sane ACLs Flag */
165 static int unsafe_attach
= 0; /* avoid inUse check on vol attach? */
166 static int offline_timeout
= -1; /* -offline-timeout option */
167 static int offline_shutdown_timeout
= -1; /* -offline-shutdown-timeout option */
171 pthread_key_t viced_uclient_key
;
174 * FileServer's name and IP address, both network byte order and
177 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
179 char FS_HostName
[128] = "localhost";
180 char *FS_configPath
= NULL
;
181 afs_uint32 FS_HostAddr_NBO
;
182 afs_uint32 FS_HostAddr_HBO
;
183 afs_uint32 FS_HostAddrs
[ADDRSPERSITE
], FS_HostAddr_cnt
= 0, FS_registered
= 0;
184 /* All addresses in FS_HostAddrs are in NBO */
187 #ifdef AFS_DEMAND_ATTACH_FS
190 * fileserver mode support
192 * during fileserver shutdown, we have to track the graceful shutdown of
193 * certain background threads before we are allowed to dump state to
197 # if !defined(PTHREAD_RWLOCK_INITIALIZER) && defined(AFS_DARWIN80_ENV)
198 # define PTHREAD_RWLOCK_INITIALIZER {0x2DA8B3B4, {0}}
201 # ifndef AFS_NT40_ENV
202 struct fs_state fs_state
=
209 PTHREAD_COND_INITIALIZER
,
210 PTHREAD_RWLOCK_INITIALIZER
212 # else /* AFS_NT40_ENV */
213 struct fs_state fs_state
;
215 static int fs_stateInit(void)
217 fs_state
.mode
= FS_MODE_NORMAL
;
218 fs_state
.FiveMinuteLWP_tranquil
= 0;
219 fs_state
.HostCheckLWP_tranquil
= 0;
220 fs_state
.FsyncCheckLWP_tranquil
= 0;
221 fs_state
.salvsync_fatal_error
= 0;
223 fs_state
.options
.fs_state_save
= 1;
224 fs_state
.options
.fs_state_restore
= 1;
225 fs_state
.options
.fs_state_verify_before_save
= 1;
226 fs_state
.options
.fs_state_verify_after_restore
= 1;
228 opr_cv_init(&fs_state
.worker_done_cv
, "worker done");
229 opr_Verify(pthread_rwlock_init(&fs_state
.state_lock
, NULL
) == 0);
231 # endif /* AFS_NT40_ENV */
232 #endif /* AFS_DEMAND_ATTACH_FS */
235 * Home for the performance statistics.
241 CheckDescriptors_Signal(int signo
)
243 struct afs_stat status
;
244 int tsize
= getdtablesize();
246 for (i
= 0; i
< tsize
; i
++) {
247 if (afs_fstat(i
, &status
) != -1) {
248 printf("%d: dev %x, inode %u, length %u, type/mode %x\n", i
,
249 (unsigned int) status
.st_dev
,
250 (unsigned int) status
.st_ino
,
251 (unsigned int) status
.st_size
,
259 /* Signal number for dumping debug info is platform dependent. */
260 #if defined(AFS_HPUX_ENV)
261 # define AFS_SIG_CHECK SIGPOLL
262 #elif defined(AFS_NT40_ENV)
263 # define AFS_SIG_CHECK SIGUSR2
265 # define AFS_SIG_CHECK SIGXCPU
268 CheckSignal_Signal(int x
)
270 if (FS_registered
> 0) {
272 * We have proper ip addresses; tell the vlserver what we got; the following
273 * routine will do the proper reporting for us
284 ShutDown_Signal(int x
)
286 ShutDownAndCore(DONTPANIC
);
289 /* check whether caller is authorized to perform admin operations */
291 viced_SuperUser(struct rx_call
*call
)
293 return afsconf_SuperUser(confDir
, call
, NULL
);
297 * Return true if this name is a member of the local realm.
300 fs_IsLocalRealmMatch(void *rock
, char *name
, char *inst
, char *cell
)
302 struct afsconf_dir
*dir
= (struct afsconf_dir
*)rock
;
303 afs_int32 islocal
= 0; /* default to no */
306 code
= afsconf_IsLocalRealmMatch(dir
, &islocal
, name
, inst
, cell
);
309 ("Failed local realm check; code=%d, name=%s, inst=%s, cell=%s\n",
310 code
, name
, inst
, cell
));
315 #if defined(AFS_NT40_ENV)
316 /* no viced_syscall */
317 #elif defined(AFS_DARWIN160_ENV)
318 /* no viced_syscall */
319 #elif !defined(AFS_SYSCALL)
321 viced_syscall(afs_uint32 a3
, afs_uint32 a4
, void *a5
)
328 viced_syscall(afs_uint32 a3
, afs_uint32 a4
, void *a5
)
331 # ifndef AFS_LINUX20_ENV
334 old
= (void (*)(int))signal(SIGSYS
, SIG_IGN
);
336 rcode
= syscall(AFS_SYSCALL
, 28 /* AFSCALL_CALL */ , a3
, a4
, a5
);
337 # ifndef AFS_LINUX20_ENV
345 #if !defined(AFS_NT40_ENV)
346 # include "AFS_component_version_number.c"
347 #endif /* !AFS_NT40_ENV */
349 #define MAXADMINNAME 64
350 char adminName
[MAXADMINNAME
];
356 struct afs_stat status
;
358 if ((afs_stat("/AdminName", &status
)) || /* if file does not exist */
359 (status
.st_size
<= 0) || /* or it is too short */
360 (status
.st_size
>= (MAXADMINNAME
)) || /* or it is too long */
361 (fd
= afs_open("/AdminName", O_RDONLY
, 0)) < 0 || /* or open fails */
362 read(fd
, adminName
, status
.st_size
) != status
.st_size
) { /* or read */
364 strcpy(adminName
, "System:Administrators"); /* use the default name */
367 close(fd
); /* close fd if it was opened */
369 } /*CheckAdminName */
375 #if !defined(AFS_NT40_ENV)
378 /* set our 'thread-id' so that the host hold table works */
379 threadId
= rx_SetThreadNum();
380 afs_pthread_setname_self(s
);
381 ViceLog(0, ("Set thread id 0x%x for '%s'\n", threadId
, s
));
385 /* This LWP does things roughly every 5 minutes */
387 FiveMinuteCheckLWP(void *unused
)
392 ViceLog(1, ("Starting five minute check process\n"));
393 setThreadId("FiveMinuteCheckLWP");
395 #ifdef AFS_DEMAND_ATTACH_FS
397 while (fs_state
.mode
== FS_MODE_NORMAL
) {
398 fs_state
.FiveMinuteLWP_tranquil
= 1;
406 #ifdef AFS_DEMAND_ATTACH_FS
408 if (fs_state
.mode
!= FS_MODE_NORMAL
) {
411 fs_state
.FiveMinuteLWP_tranquil
= 0;
415 /* close the log so it can be removed */
416 ReOpenLog(); /* don't trunc, just append */
417 ViceLog(2, ("Cleaning up timed out callbacks\n"));
418 if (CleanupTimedOutCallBacks())
419 ViceLog(5, ("Timed out callbacks deleted\n"));
420 ViceLog(2, ("Set disk usage statistics\n"));
422 if (FS_registered
== 1)
424 /* Force wakeup in case we missed something; pthreads does timedwait */
425 if (printBanner
&& (++msg
& 1)) { /* Every 10 minutes */
426 time_t now
= time(NULL
);
428 strftime(tbuffer
, sizeof(tbuffer
), "%a %b %d %H:%M:%S %Y",
429 localtime_r(&now
, &tm
));
431 ("File server is running at %s\n", tbuffer
));
433 #ifdef AFS_DEMAND_ATTACH_FS
437 #ifdef AFS_DEMAND_ATTACH_FS
438 fs_state
.FiveMinuteLWP_tranquil
= 1;
440 opr_cv_broadcast(&fs_state
.worker_done_cv
);
445 AFS_UNREACHED(return(NULL
));
447 } /*FiveMinuteCheckLWP */
450 /* This LWP does host checks every 5 minutes: it should not be used for
451 * other 5 minute activities because it may be delayed by timeouts when
452 * it probes the workstations
456 HostCheckLWP(void *unused
)
458 ViceLog(1, ("Starting Host check process\n"));
459 setThreadId("HostCheckLWP");
460 #ifdef AFS_DEMAND_ATTACH_FS
462 while (fs_state
.mode
== FS_MODE_NORMAL
) {
463 fs_state
.HostCheckLWP_tranquil
= 1;
471 #ifdef AFS_DEMAND_ATTACH_FS
473 if (fs_state
.mode
!= FS_MODE_NORMAL
) {
476 fs_state
.HostCheckLWP_tranquil
= 0;
480 ViceLog(2, ("Checking for dead venii & clients\n"));
483 #ifdef AFS_DEMAND_ATTACH_FS
487 #ifdef AFS_DEMAND_ATTACH_FS
488 fs_state
.HostCheckLWP_tranquil
= 1;
490 opr_cv_broadcast(&fs_state
.worker_done_cv
);
495 AFS_UNREACHED(return(NULL
));
499 /* This LWP does fsync checks every 5 minutes: it should not be used for
500 * other 5 minute activities because it may be delayed by timeouts when
501 * it probes the workstations
504 FsyncCheckLWP(void *unused
)
507 struct timespec fsync_next
;
508 ViceLog(1, ("Starting fsync check process\n"));
510 setThreadId("FsyncCheckLWP");
512 #ifdef AFS_DEMAND_ATTACH_FS
514 while (fs_state
.mode
== FS_MODE_NORMAL
) {
515 fs_state
.FsyncCheckLWP_tranquil
= 1;
521 /* rounding is fine */
522 fsync_next
.tv_nsec
= 0;
523 fsync_next
.tv_sec
= time(0) + fiveminutes
;
525 code
= opr_cv_timedwait(&fsync_cond
, &fsync_glock_mutex
,
527 if (code
!= 0 && code
!= ETIMEDOUT
)
528 ViceLog(0, ("pthread_cond_timedwait returned %d\n", code
));
531 #ifdef AFS_DEMAND_ATTACH_FS
533 if (fs_state
.mode
!= FS_MODE_NORMAL
) {
536 fs_state
.FsyncCheckLWP_tranquil
= 0;
538 #endif /* AFS_DEMAND_ATTACH_FS */
540 ViceLog(2, ("Checking for fsync events\n"));
542 code
= BreakLaterCallBacks();
544 #ifdef AFS_DEMAND_ATTACH_FS
548 #ifdef AFS_DEMAND_ATTACH_FS
549 fs_state
.FsyncCheckLWP_tranquil
= 1;
551 opr_cv_broadcast(&fs_state
.worker_done_cv
);
556 AFS_UNREACHED(return(NULL
));
557 #endif /* !AFS_DEMAND_ATTACH_FS */
560 /*------------------------------------------------------------------------
561 * PRIVATE ClearXStatValues
564 * Initialize all of the values collected via the xstat
574 * Must be called during File Server initialization.
578 *------------------------------------------------------------------------*/
581 ClearXStatValues(void)
582 { /*ClearXStatValues */
584 struct fs_stats_opTimingData
*opTimeP
; /*Ptr to timing struct */
585 struct fs_stats_xferData
*opXferP
; /*Ptr to xfer struct */
586 int i
; /*Loop counter */
589 * Zero all xstat-related structures.
591 memset((&afs_perfstats
), 0, sizeof(struct afs_PerfStats
));
592 memset((&afs_FullPerfStats
), 0,
593 sizeof(struct fs_stats_FullPerfStats
));
596 * That's not enough. We have to set reasonable minima for
597 * time and xfer values in the detailed stats.
599 opTimeP
= &(afs_FullPerfStats
.det
.rpcOpTimes
[0]);
600 for (i
= 0; i
< FS_STATS_NUM_RPC_OPS
; i
++, opTimeP
++)
601 opTimeP
->minTime
.tv_sec
= 999999;
603 opXferP
= &(afs_FullPerfStats
.det
.xferOpTimes
[0]);
604 for (i
= 0; i
< FS_STATS_NUM_XFER_OPS
; i
++, opXferP
++) {
605 opXferP
->minTime
.tv_sec
= 999999;
606 opXferP
->minBytes
= 999999999;
610 * There's more. We have to set our unique system identifier, as
611 * declared in param.h. If such a thing is not defined, we bitch
612 * and declare ourselves to be an unknown system type.
615 afs_perfstats
.sysname_ID
= SYS_NAME_ID
;
617 # ifndef AFS_NT40_ENV
618 ViceLog(0, ("Sys name ID constant not defined in param.h!!\n"));
619 ViceLog(0, ("[Choosing ``undefined'' sys name ID.\n"));
621 afs_perfstats
.sysname_ID
= SYS_NAME_ID_UNDEFINED
;
622 # endif /* SYS_NAME_ID */
624 } /*ClearXStatValues */
626 int CopyOnWrite_calls
= 0, CopyOnWrite_off0
= 0, CopyOnWrite_size0
= 0;
627 afs_fsize_t CopyOnWrite_maxsize
= 0;
632 int dirbuff
, dircall
, dirio
;
634 int workstations
, activeworkstations
, delworkstations
;
638 #ifdef AFS_DEMAND_ATTACH_FS
642 gettimeofday(&tpl
, 0);
644 strftime(tbuffer
, sizeof(tbuffer
), "%a %b %d %H:%M:%S %Y",
645 localtime_r(&StartTime
, &tm
));
646 ViceLog(0, ("Vice was last started at %s\n", tbuffer
));
648 #ifdef AFS_DEMAND_ATTACH_FS
649 if (GetLogLevel() >= 125) {
650 stats_flags
= VOL_STATS_PER_CHAIN2
;
651 } else if (GetLogLevel() >= 25) {
652 stats_flags
= VOL_STATS_PER_CHAIN
;
654 VPrintExtendedCacheStats(stats_flags
);
658 DStat(&dirbuff
, &dircall
, &dirio
);
660 ("With %d directory buffers; %d reads resulted in %d read I/Os\n",
661 dirbuff
, dircall
, dirio
));
662 rx_PrintStats(stderr
);
663 audit_PrintStats(stderr
);
665 PrintCallBackStats();
666 processSize
= opr_procsize();
668 ("There are %d connections, process size %d\n",
669 CurrentConnections
, processSize
));
670 h_GetWorkStats(&workstations
, &activeworkstations
, &delworkstations
,
671 tpl
.tv_sec
- 15 * 60);
673 ("There are %d workstations, %d are active (req in < 15 mins), %d marked \"down\"\n",
674 workstations
, activeworkstations
, delworkstations
));
675 ViceLog(0, ("CopyOnWrite: calls %d off0 %d size0 %d maxsize 0x%llx\n",
676 CopyOnWrite_calls
, CopyOnWrite_off0
, CopyOnWrite_size0
, CopyOnWrite_maxsize
));
683 ShutdownWatchdogLWP(void *unused
)
685 afs_pthread_setname_self("ShutdownWatchdog");
686 sleep(panic_timeout
);
687 ViceLogThenPanic(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
688 "within %d seconds; forcing panic\n",
694 ShutDownAndCore(int dopanic
)
696 time_t now
= time(NULL
);
701 pthread_t watchdogPid
;
702 pthread_attr_t tattr
;
703 opr_Verify(pthread_attr_init(&tattr
) == 0);
704 opr_Verify(pthread_create(&watchdogPid
, &tattr
,
705 ShutdownWatchdogLWP
, NULL
) == 0);
708 /* do not allows new reqests to be served from now on, all new requests
709 * are returned with an error code of RX_RESTARTING ( transient failure ) */
710 rx_SetRxTranquil(); /* dhruba */
714 #ifdef AFS_DEMAND_ATTACH_FS
716 if (fs_state
.mode
== FS_MODE_SHUTDOWN
) {
717 /* it is possible for at least fs_stateSave() (called below) to call
718 * ShutDownAndCore if there's host list corruption; prevent
719 * deinitializing some stuff twice */
720 ViceLog(0, ("ShutDownAndCore called during shutdown? Skipping volume "
721 "and host package shutdown\n"));
725 fs_state
.mode
= FS_MODE_SHUTDOWN
;
729 strftime(tbuffer
, sizeof(tbuffer
), "%a %b %d %H:%M:%S %Y",
730 localtime_r(&now
, &tm
));
731 ViceLog(0, ("Shutting down file server at %s\n", tbuffer
));
733 ViceLog(0, ("ABNORMAL SHUTDOWN, see core file.\n"));
738 /* shut down volume package */
741 #ifdef AFS_DEMAND_ATTACH_FS
742 if (fs_state
.options
.fs_state_save
) {
745 * save fileserver state to disk */
748 ViceLog(0, ("Not saving fileserver state; abnormal shutdown\n"));
751 /* make sure background threads have finished all of their asynchronous
752 * work on host and callback structures */
754 while (!fs_state
.FiveMinuteLWP_tranquil
||
755 !fs_state
.HostCheckLWP_tranquil
||
756 !fs_state
.FsyncCheckLWP_tranquil
) {
759 ViceLog(0, ("waiting for background host/callback threads to quiesce before saving fileserver state...\n"));
760 opr_cv_wait(&fs_state
.worker_done_cv
, &fileproc_glock_mutex
);
766 /* ok. it should now be fairly safe. let's do the state dump */
772 #endif /* AFS_DEMAND_ATTACH_FS */
775 rx_PrintStats(debugFile
);
779 strftime(tbuffer
, sizeof(tbuffer
), "%a %b %d %H:%M:%S %Y",
780 localtime_r(&now
, &tm
));
782 ViceLog(0, ("File server has terminated abnormally at %s\n", tbuffer
));
784 ViceLog(0, ("File server has terminated normally at %s\n", tbuffer
));
787 if (dopanic
) /* XXX pass in file and line? */
788 osi_Panic("Panic requested\n");
794 ParseRights(char *arights
)
800 if (!arights
|| !strcmp(arights
, "")) {
801 printf("Missing list of mode bits on -implicit option\n");
804 if (!strcmp(arights
, "none"))
806 else if (!strcmp(arights
, "read"))
807 mode
= PRSFS_READ
| PRSFS_LOOKUP
;
808 else if (!strcmp(arights
, "write"))
810 PRSFS_READ
| PRSFS_LOOKUP
| PRSFS_INSERT
| PRSFS_DELETE
|
811 PRSFS_WRITE
| PRSFS_LOCK
;
812 else if (!strcmp(arights
, "all"))
814 PRSFS_READ
| PRSFS_LOOKUP
| PRSFS_INSERT
| PRSFS_DELETE
|
815 PRSFS_WRITE
| PRSFS_LOCK
| PRSFS_ADMINISTER
;
817 len
= strlen(arights
);
818 for (i
= 0; i
< len
; i
++) {
823 mode
|= PRSFS_LOOKUP
;
825 mode
|= PRSFS_INSERT
;
827 mode
|= PRSFS_DELETE
;
833 mode
|= PRSFS_ADMINISTER
;
851 printf("Illegal -implicit rights character '%c'.\n", tc
);
860 * Limit MAX_FILESERVER_THREAD by the system limit on the number of
861 * pthreads (sysconf(_SC_THREAD_THREADS_MAX)), if applicable and
864 * AIX: sysconf() limit is real
865 * HP-UX: sysconf() limit is real
866 * IRIX: sysconf() limit is apparently NOT real -- too small
867 * DUX: sysconf() limit is apparently NOT real -- too big
868 * Linux: sysconf() limit is apparently NOT real -- too big
869 * Solaris: no sysconf() limit
872 max_fileserver_thread(void)
874 #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
877 ans
= sysconf(_SC_THREAD_THREADS_MAX
);
878 if (0 < ans
&& ans
< MAX_FILESERVER_THREAD
)
881 return MAX_FILESERVER_THREAD
;
885 extern ih_init_params vol_io_params
;
910 OPT_offline_shutdown_timeout
,
911 OPT_vhandle_setaside
,
912 OPT_vhandle_max_cachesize
,
913 OPT_vhandle_initial_cachesize
,
914 OPT_fs_state_dont_save
,
915 OPT_fs_state_dont_restore
,
922 OPT_unsafe_nosalvage
,
952 ParseArgs(int argc
, char *argv
[])
956 char *optstring
= NULL
;
957 struct cmd_item
*optlist
;
958 struct cmd_syndesc
*opts
;
961 char *auditFileName
= NULL
;
962 char *sync_behavior
= NULL
;
964 #if defined(AFS_AIX32_ENV)
965 extern int aixlow_water
;
968 opts
= cmd_CreateSyntax(NULL
, NULL
, NULL
, 0, NULL
);
970 /* fileserver options */
971 cmd_AddParmAtOffset(opts
, OPT_large
, "-L", CMD_FLAG
,
972 CMD_OPTIONAL
, "defaults for a 'large' server");
973 cmd_AddParmAtOffset(opts
, OPT_small
, "-S", CMD_FLAG
,
974 CMD_OPTIONAL
, "defaults for a 'small' server");
976 cmd_AddParmAtOffset(opts
, OPT_banner
, "-banner", CMD_FLAG
,
977 CMD_OPTIONAL
, "print regular banners to log");
978 cmd_AddParmAtOffset(opts
, OPT_implicit
, "-implicit", CMD_SINGLE
,
979 CMD_OPTIONAL
, "implicit admin access bits");
981 #if defined(AFS_SGI_ENV)
982 cmd_AddParmAtOffset(opts
, OPT_lock
, "-lock", CMD_FLAG
,
983 CMD_OPTIONAL
, "lock filserver binary in memory");
985 cmd_AddParmAtOffset(opts
, OPT_readonly
, "-readonly", CMD_FLAG
,
986 CMD_OPTIONAL
, "be a readonly fileserver");
987 cmd_AddParmAtOffset(opts
, OPT_saneacls
, "-saneacls", CMD_FLAG
,
988 CMD_OPTIONAL
, "set the saneacls capability bit");
990 cmd_AddParmAtOffset(opts
, OPT_buffers
, "-b", CMD_SINGLE
,
991 CMD_OPTIONAL
, "buffers");
992 cmd_AddParmAtOffset(opts
, OPT_callbacks
, "-cb", CMD_SINGLE
,
993 CMD_OPTIONAL
, "number of callbacks");
994 cmd_AddParmAtOffset(opts
, OPT_vcsize
, "-vc", CMD_SINGLE
,
995 CMD_OPTIONAL
, "volume cachesize");
996 cmd_AddParmAtOffset(opts
, OPT_lvnodes
, "-l", CMD_SINGLE
,
997 CMD_OPTIONAL
, "large vnodes");
998 cmd_AddParmAtOffset(opts
, OPT_svnodes
, "-s", CMD_SINGLE
,
999 CMD_OPTIONAL
, "small vnodes");
1000 cmd_AddParmAtOffset(opts
, OPT_sendsize
, "-sendsize", CMD_SINGLE
,
1001 CMD_OPTIONAL
, "size of send buffer in bytes");
1003 #if defined(AFS_AIX32_ENV)
1004 cmd_AddParmAtOffset(opts
, OPT_minspare
, "-m", CMD_SINGLE
,
1005 CMD_OPTIONAL
, "minimum percentage spare in partition");
1008 cmd_AddParmAtOffset(opts
, OPT_spare
, "-spare", CMD_SINGLE
,
1009 CMD_OPTIONAL
, "kB overage on volume quota");
1010 cmd_AddParmAtOffset(opts
, OPT_pctspare
, "-pctspare", CMD_SINGLE
,
1011 CMD_OPTIONAL
, "percentage overage on volume quota");
1013 cmd_AddParmAtOffset(opts
, OPT_hostcpsrefresh
, "-hr", CMD_SINGLE
,
1014 CMD_OPTIONAL
, "hours between host CPS refreshes");
1016 cmd_AddParmAtOffset(opts
, OPT_vattachthreads
, "-vattachpar", CMD_SINGLE
,
1017 CMD_OPTIONAL
, "# of volume attachment threads");
1019 cmd_AddParmAtOffset(opts
, OPT_abortthreshold
, "-abortthreshold",
1020 CMD_SINGLE
, CMD_OPTIONAL
,
1022 cmd_AddParmAtOffset(opts
, OPT_busyat
, "-busyat", CMD_SINGLE
, CMD_OPTIONAL
,
1023 "# of queued entries after which server is busy");
1024 cmd_AddParmAtOffset(opts
, OPT_nobusy
, "-nobusy", CMD_FLAG
, CMD_OPTIONAL
,
1025 "send VRESTARTING while restarting the server");
1027 cmd_AddParmAtOffset(opts
, OPT_offline_timeout
, "-offline-timeout",
1028 CMD_SINGLE
, CMD_OPTIONAL
,
1029 "timeout for offlining volumes");
1030 cmd_AddParmAtOffset(opts
, OPT_offline_shutdown_timeout
,
1031 "-offline-shutdown-timeout", CMD_SINGLE
, CMD_OPTIONAL
,
1032 "timeout offlining volumes during shutdown");
1034 cmd_AddParmAtOffset(opts
, OPT_vhandle_setaside
, "-vhandle-setaside",
1035 CMD_SINGLE
, CMD_OPTIONAL
,
1036 "# fds reserved for non-cache IO");
1037 cmd_AddParmAtOffset(opts
, OPT_vhandle_max_cachesize
,
1038 "-vhandle-max-cachesize", CMD_SINGLE
, CMD_OPTIONAL
,
1040 cmd_AddParmAtOffset(opts
, OPT_vhandle_initial_cachesize
,
1041 "-vhandle-initial-cachesize", CMD_SINGLE
,
1042 CMD_OPTIONAL
, "# fds reserved for cache IO");
1043 cmd_AddParmAtOffset(opts
, OPT_vhashsize
, "-vhashsize",
1044 CMD_SINGLE
, CMD_OPTIONAL
,
1045 "log(2) of # of volume hash buckets");
1047 #ifdef AFS_DEMAND_ATTACH_FS
1049 cmd_AddParmAtOffset(opts
, OPT_fs_state_dont_save
,
1050 "-fs-state-dont-save", CMD_FLAG
, CMD_OPTIONAL
,
1051 "disable state save during shutdown");
1052 cmd_AddParmAtOffset(opts
, OPT_fs_state_dont_restore
,
1053 "-fs-state-dont-restore", CMD_FLAG
, CMD_OPTIONAL
,
1054 "disable state restore during startup");
1055 cmd_AddParmAtOffset(opts
, OPT_fs_state_verify
, "-fs-state-verify",
1056 CMD_SINGLE
, CMD_OPTIONAL
, "none|save|restore|both");
1057 cmd_AddParmAtOffset(opts
, OPT_vlrudisable
, "-vlrudisable",
1058 CMD_FLAG
, CMD_OPTIONAL
, "disable VLRU functionality");
1059 cmd_AddParmAtOffset(opts
, OPT_vlruthresh
, "-vlruthresh",
1060 CMD_SINGLE
, CMD_OPTIONAL
,
1061 "mins before unused vols become eligible for detach");
1062 cmd_AddParmAtOffset(opts
, OPT_vlruinterval
, "-vlruinterval",
1063 CMD_SINGLE
, CMD_OPTIONAL
, "secs between VLRU scans");
1064 cmd_AddParmAtOffset(opts
, OPT_vlrumax
, "-vlrumax", CMD_SINGLE
, CMD_OPTIONAL
,
1065 "max volumes to detach in one scan");
1066 cmd_AddParmAtOffset(opts
, OPT_unsafe_nosalvage
, "-unsafe-nosalvage",
1067 CMD_FLAG
, CMD_OPTIONAL
,
1068 "bypass safety checks on volume attach");
1071 /* unrecommend options - should perhaps be CMD_HIDE */
1072 cmd_AddParmAtOffset(opts
, OPT_cbwait
, "-w", CMD_SINGLE
, CMD_OPTIONAL
,
1073 "callback wait interval");
1074 cmd_AddParmAtOffset(opts
, OPT_novbc
, "-novbc", CMD_FLAG
, CMD_OPTIONAL
,
1075 "disable callback breaks on reattach");
1077 /* general options */
1078 cmd_AddParmAtOffset(opts
, OPT_auditlog
, "-auditlog", CMD_SINGLE
,
1079 CMD_OPTIONAL
, "location of audit log");
1080 cmd_AddParmAtOffset(opts
, OPT_auditiface
, "-audit-interface", CMD_SINGLE
,
1081 CMD_OPTIONAL
, "interface to use for audit logging");
1082 cmd_AddParmAtOffset(opts
, OPT_debug
, "-d", CMD_SINGLE
, CMD_OPTIONAL
,
1084 cmd_AddParmAtOffset(opts
, OPT_mrafslogs
, "-mrafslogs", CMD_FLAG
,
1085 CMD_OPTIONAL
, "enable MRAFS style logging");
1086 cmd_AddParmAtOffset(opts
, OPT_transarc_logs
, "-transarc-logs", CMD_FLAG
,
1087 CMD_OPTIONAL
, "enable Transarc style logging");
1088 cmd_AddParmAtOffset(opts
, OPT_threads
, "-p", CMD_SINGLE
, CMD_OPTIONAL
,
1089 "number of threads");
1091 cmd_AddParmAtOffset(opts
, OPT_syslog
, "-syslog", CMD_SINGLE_OR_FLAG
,
1092 CMD_OPTIONAL
, "log to syslog");
1096 cmd_AddParmAtOffset(opts
, OPT_peer
, "-enable_peer_stats", CMD_FLAG
,
1097 CMD_OPTIONAL
, "enable RX transport statistics");
1098 cmd_AddParmAtOffset(opts
, OPT_process
, "-enable_process_stats", CMD_FLAG
,
1099 CMD_OPTIONAL
, "enable RX RPC statistics");
1100 cmd_AddParmAtOffset(opts
, OPT_nojumbo
, "-nojumbo", CMD_FLAG
,
1101 CMD_OPTIONAL
, "disable jumbograms");
1102 cmd_AddParmAtOffset(opts
, OPT_jumbo
, "-jumbo", CMD_FLAG
, CMD_OPTIONAL
,
1103 "enable jumbograms");
1104 cmd_AddParmAtOffset(opts
, OPT_rxbind
, "-rxbind", CMD_FLAG
, CMD_OPTIONAL
,
1105 "bind only to the primary interface");
1106 cmd_AddParmAtOffset(opts
, OPT_rxdbg
, "-rxdbg", CMD_FLAG
, CMD_OPTIONAL
,
1107 "enable rx debugging");
1108 cmd_AddParmAtOffset(opts
, OPT_rxdbge
, "-rxdbge", CMD_FLAG
, CMD_OPTIONAL
,
1109 "enable rx event debugging");
1110 cmd_AddParmAtOffset(opts
, OPT_rxpck
, "-rxpck", CMD_SINGLE
, CMD_OPTIONAL
,
1111 "# of extra rx packets");
1112 cmd_AddParmAtOffset(opts
, OPT_rxmaxmtu
, "-rxmaxmtu", CMD_SINGLE
,
1113 CMD_OPTIONAL
, "maximum MTU for RX");
1114 cmd_AddParmAtOffset(opts
, OPT_udpsize
, "-udpsize", CMD_SINGLE
,
1115 CMD_OPTIONAL
, "size of socket buffer in bytes");
1118 cmd_AddParmAtOffset(opts
, OPT_dotted
, "-allow-dotted-principals",
1119 CMD_FLAG
, CMD_OPTIONAL
,
1120 "permit Kerberos 5 principals with dots");
1121 cmd_AddParmAtOffset(opts
, OPT_realm
, "-realm",
1122 CMD_LIST
, CMD_OPTIONAL
, "local realm");
1123 cmd_AddParmAtOffset(opts
, OPT_sync
, "-sync",
1124 CMD_SINGLE
, CMD_OPTIONAL
, "always | onclose | never");
1126 /* testing options */
1127 cmd_AddParmAtOffset(opts
, OPT_logfile
, "-logfile", CMD_SINGLE
,
1128 CMD_OPTIONAL
, "location of log file");
1129 cmd_AddParmAtOffset(opts
, OPT_config
, "-config", CMD_SINGLE
,
1130 CMD_OPTIONAL
, "configuration location");
1132 code
= cmd_Parse(argc
, argv
, &opts
);
1133 if (code
== CMD_HELP
) {
1139 cmd_OpenConfigFile(AFSDIR_SERVER_CONFIG_FILE_FILEPATH
);
1140 cmd_SetCommandName("fileserver");
1142 if (cmd_OptionPresent(opts
, OPT_large
)
1143 && cmd_OptionPresent(opts
, OPT_small
)) {
1144 printf("Only one of -L or -S must be specified\n");
1148 if (cmd_OptionPresent(opts
, OPT_spare
)
1149 && cmd_OptionPresent(opts
, OPT_pctspare
)) {
1150 printf("Both -spare and -pctspare specified, exiting.\n");
1154 if (cmd_OptionPresent(opts
, OPT_large
)) {
1158 numberofcbs
= 64000;
1164 if (cmd_OptionPresent(opts
, OPT_small
)) {
1168 numberofcbs
= 20000;
1174 cmd_OptionAsFlag(opts
, OPT_banner
, &printBanner
);
1176 if (cmd_OptionAsString(opts
, OPT_implicit
, &optstring
) == 0) {
1177 implicitAdminRights
= ParseRights(optstring
);
1180 if (implicitAdminRights
< 0)
1181 return implicitAdminRights
;
1184 #if defined(AFS_SGI_ENV)
1185 cmd_OptionAsFlag(opts
, OPT_lock
, &SawLock
);
1187 cmd_OptionAsFlag(opts
, OPT_readonly
, &readonlyServer
);
1188 cmd_OptionAsFlag(opts
, OPT_saneacls
, &saneacls
);
1189 cmd_OptionAsInt(opts
, OPT_buffers
, &buffs
);
1191 if (cmd_OptionAsInt(opts
, OPT_callbacks
, &numberofcbs
) == 0) {
1192 if ((numberofcbs
< 10000) || (numberofcbs
> 2147483647)) {
1193 printf("number of cbs %d invalid; "
1194 "must be between 10000 and 2147483647\n", numberofcbs
);
1199 cmd_OptionAsInt(opts
, OPT_vcsize
, &volcache
);
1200 cmd_OptionAsInt(opts
, OPT_lvnodes
, &large
);
1201 cmd_OptionAsInt(opts
, OPT_svnodes
, &nSmallVns
);
1202 if (cmd_OptionAsInt(opts
, OPT_sendsize
, &optval
) == 0) {
1203 if (optval
< 16384) {
1204 printf("Warning:sendsize %d is less than minimum %d; ignoring\n",
1207 sendBufSize
= optval
;
1210 #if defined(AFS_AIX32_ENV)
1211 if (cmd_OptionAsInt(opts
, OPT_minspare
, &aixlow_water
) == 0) {
1212 if ((aixlow_water
< 0) || (aixlow_water
> 30)) {
1213 printf("space reserved %d%% invalid; must be between 0-30%\n",
1220 cmd_OptionAsInt(opts
, OPT_spare
, &BlocksSpare
);
1221 if (cmd_OptionAsInt(opts
, OPT_pctspare
, &PctSpare
) == 0) {
1225 if (cmd_OptionAsInt(opts
, OPT_hostcpsrefresh
, &optval
) == 0) {
1226 if ((optval
< 1) || (optval
> 36)) {
1227 printf("host acl refresh interval of %d hours is invalid; "
1228 "hours must be between 1 and 36\n\n", optval
);
1231 hostaclRefresh
= optval
* 60 * 60;
1234 cmd_OptionAsInt(opts
, OPT_vattachthreads
, &vol_attach_threads
);
1236 cmd_OptionAsInt(opts
, OPT_abortthreshold
, &abort_threshold
);
1238 /* busyat is at the end, as rxpackets has to be set before we can use it */
1239 if (cmd_OptionPresent(opts
, OPT_nobusy
))
1242 if (cmd_OptionAsInt(opts
, OPT_offline_timeout
, &offline_timeout
) == 0) {
1243 if (offline_timeout
< -1) {
1244 printf("Invalid -offline-timeout value %d; the only valid "
1245 "negative value is -1\n", offline_timeout
);
1250 if (cmd_OptionAsInt(opts
, OPT_offline_shutdown_timeout
,
1251 &offline_shutdown_timeout
) == 0) {
1252 if (offline_shutdown_timeout
< -1) {
1253 printf("Invalid -offline-timeout value %d; the only valid "
1254 "negative value is -1\n", offline_shutdown_timeout
);
1259 cmd_OptionAsUint(opts
, OPT_vhandle_setaside
,
1260 &vol_io_params
.fd_handle_setaside
);
1261 cmd_OptionAsUint(opts
, OPT_vhandle_max_cachesize
,
1262 &vol_io_params
.fd_max_cachesize
);
1263 cmd_OptionAsUint(opts
, OPT_vhandle_initial_cachesize
,
1264 &vol_io_params
.fd_initial_cachesize
);
1265 if (cmd_OptionAsString(opts
, OPT_sync
, &sync_behavior
) == 0) {
1266 if (ih_SetSyncBehavior(sync_behavior
)) {
1267 printf("Invalid -sync value %s\n", sync_behavior
);
1271 if (cmd_OptionAsInt(opts
, OPT_vhashsize
, &optval
) == 0) {
1272 if (VSetVolHashSize(optval
)) {
1273 fprintf(stderr
, "specified -vhashsize (%d) is invalid or out "
1274 "of range\n", optval
);
1279 #ifdef AFS_DEMAND_ATTACH_FS
1280 if (cmd_OptionPresent(opts
, OPT_fs_state_dont_save
))
1281 fs_state
.options
.fs_state_save
= 0;
1282 if (cmd_OptionPresent(opts
, OPT_fs_state_dont_restore
))
1283 fs_state
.options
.fs_state_restore
= 0;
1284 if (cmd_OptionAsString(opts
, OPT_fs_state_verify
, &optstring
) == 0) {
1285 if (strcmp(optstring
, "none") == 0) {
1286 fs_state
.options
.fs_state_verify_before_save
= 0;
1287 fs_state
.options
.fs_state_verify_after_restore
= 0;
1288 } else if (strcmp(optstring
, "save") == 0) {
1289 fs_state
.options
.fs_state_verify_after_restore
= 0;
1290 } else if (strcmp(optstring
, "restore") == 0) {
1291 fs_state
.options
.fs_state_verify_before_save
= 0;
1292 } else if (strcmp(optstring
, "both") == 0) {
1295 fprintf(stderr
, "invalid argument for -fs-state-verify\n");
1299 if (cmd_OptionPresent(opts
, OPT_vlrudisable
))
1300 VLRU_SetOptions(VLRU_SET_ENABLED
, 0);
1301 if (cmd_OptionAsInt(opts
, OPT_vlruthresh
, &optval
) == 0)
1302 VLRU_SetOptions(VLRU_SET_THRESH
, 60*optval
);
1303 if (cmd_OptionAsInt(opts
, OPT_vlruinterval
, &optval
) == 0)
1304 VLRU_SetOptions(VLRU_SET_INTERVAL
, optval
);
1305 if (cmd_OptionAsInt(opts
, OPT_vlrumax
, &optval
) == 0)
1306 VLRU_SetOptions(VLRU_SET_MAX
, optval
);
1307 cmd_OptionAsFlag(opts
, OPT_unsafe_nosalvage
, &unsafe_attach
);
1308 #endif /* AFS_DEMAND_ATTACH_FS */
1310 cmd_OptionAsInt(opts
, OPT_cbwait
, &fiveminutes
);
1311 cmd_OptionAsFlag(opts
, OPT_novbc
, &novbc
);
1313 /* general server options */
1314 cmd_OptionAsString(opts
, OPT_auditlog
, &auditFileName
);
1316 if (cmd_OptionAsString(opts
, OPT_auditiface
, &optstring
) == 0) {
1317 if (osi_audit_interface(optstring
)) {
1318 printf("Invalid audit interface '%s'\n", optstring
);
1325 if (cmd_OptionAsInt(opts
, OPT_threads
, &lwps
) == 0) {
1326 lwps_max
= max_fileserver_thread() - FILESERVER_HELPER_THREADS
;
1327 if (lwps
> lwps_max
)
1333 /* Logging options. */
1335 if (cmd_OptionPresent(opts
, OPT_syslog
)) {
1336 if (cmd_OptionPresent(opts
, OPT_logfile
)) {
1337 fprintf(stderr
, "Invalid options: -syslog and -logfile are exclusive.\n");
1340 if (cmd_OptionPresent(opts
, OPT_transarc_logs
)) {
1341 fprintf(stderr
, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
1344 if (cmd_OptionPresent(opts
, OPT_mrafslogs
)) {
1345 fprintf(stderr
, "Invalid options: -syslog and -mrafslogs are exclusive.\n");
1349 logopts
.lopt_dest
= logDest_syslog
;
1350 logopts
.lopt_facility
= LOG_DAEMON
;
1351 logopts
.lopt_tag
= "fileserver";
1352 cmd_OptionAsInt(opts
, OPT_syslog
, &logopts
.lopt_facility
);
1356 logopts
.lopt_dest
= logDest_file
;
1358 if (cmd_OptionPresent(opts
, OPT_transarc_logs
)) {
1359 if (cmd_OptionPresent(opts
, OPT_mrafslogs
)) {
1361 "Invalid options: -transarc-logs and -mrafslogs are exclusive.\n");
1364 logopts
.lopt_rotateOnOpen
= 1;
1365 logopts
.lopt_rotateStyle
= logRotate_old
;
1366 } else if (cmd_OptionPresent(opts
, OPT_mrafslogs
)) {
1367 logopts
.lopt_rotateOnOpen
= 1;
1368 logopts
.lopt_rotateOnReset
= 1;
1369 logopts
.lopt_rotateStyle
= logRotate_timestamp
;
1372 if (cmd_OptionPresent(opts
, OPT_logfile
))
1373 cmd_OptionAsString(opts
, OPT_logfile
, (char**)&logopts
.lopt_filename
);
1375 logopts
.lopt_filename
= AFSDIR_SERVER_FILELOG_FILEPATH
;
1378 cmd_OptionAsInt(opts
, OPT_debug
, &logopts
.lopt_logLevel
);
1380 if (cmd_OptionPresent(opts
, OPT_peer
))
1381 rx_enablePeerRPCStats();
1382 if (cmd_OptionPresent(opts
, OPT_process
))
1383 rx_enableProcessRPCStats();
1384 if (cmd_OptionPresent(opts
, OPT_nojumbo
))
1386 if (cmd_OptionPresent(opts
, OPT_jumbo
))
1388 cmd_OptionAsFlag(opts
, OPT_rxbind
, &rxBind
);
1389 cmd_OptionAsFlag(opts
, OPT_rxdbg
, &rxlog
);
1390 cmd_OptionAsFlag(opts
, OPT_rxdbge
, &eventlog
);
1391 cmd_OptionAsInt(opts
, OPT_rxpck
, &rxpackets
);
1393 cmd_OptionAsInt(opts
, OPT_rxmaxmtu
, &rxMaxMTU
);
1395 if (cmd_OptionAsInt(opts
, OPT_udpsize
, &optval
) == 0) {
1396 if (optval
< rx_GetMinUdpBufSize()) {
1397 printf("Warning:udpsize %d is less than minimum %d; ignoring\n",
1398 optval
, rx_GetMinUdpBufSize());
1400 udpBufSize
= optval
;
1404 cmd_OptionAsFlag(opts
, OPT_dotted
, &rxkadDisableDotCheck
);
1405 if (cmd_OptionAsList(opts
, OPT_realm
, &optlist
) == 0) {
1407 for (; optlist
!= NULL
; optlist
=optlist
->next
) {
1408 if (strlen(optlist
->data
) >= AFS_REALM_SZ
) {
1409 printf("-realm argument must contain fewer than %d "
1410 "characters.\n", AFS_REALM_SZ
);
1413 afsconf_SetLocalRealm(optlist
->data
); /* overrides krb.conf file, if one */
1417 /* anything setting rxpackets must come before this */
1418 if (cmd_OptionAsInt(opts
, OPT_busyat
, &optval
) == 0) {
1420 printf("Busy threshold %d is too low, will use default.\n",
1422 busy_threshold
= 3 * rxpackets
/ 2;
1424 busy_threshold
= optval
;
1427 busy_threshold
= 3 * rxpackets
/ 2;
1430 cmd_OptionAsString(opts
, OPT_config
, &FS_configPath
);
1434 osi_audit_file(auditFileName
);
1437 host_thread_quota
= 5;
1438 } else if (lwps
> 32) {
1439 host_thread_quota
= 4;
1440 } else if (lwps
> 16) {
1441 host_thread_quota
= 3;
1443 host_thread_quota
= 2;
1449 /* Once upon a time, in a galaxy far far away, IBM AFS supported the use of
1450 * a file /vice/file/parms, the contents of which would override any command
1451 * line parameters. We no longer support the use of such a file, but we warn
1452 * if we encounter its presence from an older release
1457 struct afs_stat sbuf
;
1459 if (afs_stat("/vice/file/parms", &sbuf
) == 0) {
1460 ViceLog(0, ("Using /vice/file/parms to override command line "
1461 "options is no longer supported"));
1465 /* Miscellaneous routines */
1467 Die(const char *msg
)
1470 ViceLogThenPanic(0, ("%s\n", msg
));
1480 * If this fails, it's because something major is wrong, and is not
1481 * likely to be time dependent.
1483 code
= pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH
, 0);
1486 ("Couldn't initialize protection library; code=%d.\n", code
));
1490 opr_Verify(pthread_key_create(&viced_uclient_key
, NULL
) == 0);
1492 SystemId
= SYSADMINID
;
1493 SystemAnyUser
= ANYUSERID
;
1494 SystemAnyUserCPS
.prlist_len
= 0;
1495 SystemAnyUserCPS
.prlist_val
= NULL
;
1496 AnonCPS
.prlist_len
= 0;
1497 AnonCPS
.prlist_val
= NULL
;
1499 code
= pr_GetCPS(SystemAnyUser
, &SystemAnyUserCPS
);
1502 ("Couldn't get CPS for AnyUser, will try again in 30 seconds; code=%d.\n",
1506 code
= pr_GetCPS(ANONYMOUSID
, &AnonCPS
);
1509 ("Couldn't get Anonymous CPS, exiting; code=%d.\n",
1513 AnonymousID
= ANONYMOUSID
;
1520 static struct ubik_client
*cstruct
;
1523 vl_Initialize(struct afsconf_dir
*dir
)
1526 afs_int32 scIndex
= RX_SECIDX_NULL
;
1527 struct afsconf_cell info
;
1528 struct rx_securityClass
*sc
;
1529 struct rx_connection
*serverconns
[MAXSERVERS
];
1531 memset(serverconns
, 0, sizeof(serverconns
));
1532 code
= afsconf_ClientAuth(dir
, &sc
, &scIndex
);
1534 ViceLog(0, ("Could not get security object for localAuth\n"));
1537 code
= afsconf_GetCellInfo(dir
, NULL
, AFSCONF_VLDBSERVICE
, &info
);
1540 ("vl_Initialize: Failed to get cell information\n"));
1543 if (info
.numServers
> MAXSERVERS
) {
1545 ("vl_Initialize: info.numServers=%d (> MAXSERVERS=%d)\n",
1546 info
.numServers
, MAXSERVERS
));
1549 for (i
= 0; i
< info
.numServers
; i
++)
1551 rx_NewConnection(info
.hostAddr
[i
].sin_addr
.s_addr
,
1552 info
.hostAddr
[i
].sin_port
, USER_SERVICE_ID
, sc
,
1554 code
= ubik_ClientInit(serverconns
, &cstruct
);
1556 ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
1562 #define SYSIDMAGIC 0x88aabbcc
1563 #define SYSIDVERSION 1
1568 afs_int32 fd
, nentries
, i
;
1569 struct versionStamp vsn
;
1570 struct afs_stat status
;
1573 if ((afs_stat(AFSDIR_SERVER_SYSID_FILEPATH
, &status
))
1574 || (status
.st_size
<= 0)) {
1575 ViceLog(0, ("%s: doesn't exist\n", AFSDIR_SERVER_SYSID_FILEPATH
));
1578 if (!(fd
= afs_open(AFSDIR_SERVER_SYSID_FILEPATH
, O_RDONLY
, 0))) {
1580 ("%s: can't open (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH
,
1584 if (read(fd
, (char *)&vsn
, sizeof(vsn
)) != sizeof(vsn
)) {
1586 ("%s: Read failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH
,
1590 if (vsn
.magic
!= SYSIDMAGIC
) {
1592 ("%s: wrong magic %x (we support %x)\n",
1593 AFSDIR_SERVER_SYSID_FILEPATH
, vsn
.magic
, SYSIDMAGIC
));
1596 if (vsn
.version
!= SYSIDVERSION
) {
1598 ("%s: wrong version %d (we support %d)\n",
1599 AFSDIR_SERVER_SYSID_FILEPATH
, vsn
.version
, SYSIDVERSION
));
1602 if (read(fd
, (char *)&uuid
, sizeof(struct afsUUID
))
1603 != sizeof(struct afsUUID
)) {
1605 ("%s: read of uuid failed (%d)\n",
1606 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1609 afs_ntohuuid(&uuid
);
1611 if (read(fd
, (char *)&nentries
, sizeof(afs_int32
)) != sizeof(afs_int32
)) {
1613 ("%s: Read of entries failed (%d)\n",
1614 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1617 if (nentries
<= 0 || nentries
> ADDRSPERSITE
) {
1619 ("%s: invalid num of interfaces: %d\n",
1620 AFSDIR_SERVER_SYSID_FILEPATH
, nentries
));
1623 if (FS_HostAddr_cnt
== 0) {
1624 FS_HostAddr_cnt
= nentries
;
1625 for (i
= 0; i
< nentries
; i
++) {
1626 if (read(fd
, (char *)&FS_HostAddrs
[i
], sizeof(afs_int32
)) !=
1627 sizeof(afs_int32
)) {
1629 ("%s: Read of addresses failed (%d)\n",
1630 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1631 FS_HostAddr_cnt
= 0; /* reset it */
1637 ("%s: address list ignored (NetInfo/NetRestrict override)\n",
1638 AFSDIR_SERVER_SYSID_FILEPATH
));
1645 WriteSysIdFile(void)
1648 struct versionStamp vsn
;
1649 struct afs_stat status
;
1652 if (!afs_stat(AFSDIR_SERVER_SYSID_FILEPATH
, &status
)) {
1654 * File exists; keep the old one around
1656 rk_rename(AFSDIR_SERVER_SYSID_FILEPATH
,
1657 AFSDIR_SERVER_OLDSYSID_FILEPATH
);
1659 fd
= afs_open(AFSDIR_SERVER_SYSID_FILEPATH
, O_WRONLY
| O_TRUNC
| O_CREAT
,
1663 ("%s: can't create (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH
,
1667 vsn
.magic
= SYSIDMAGIC
;
1669 if ((i
= write(fd
, (char *)&vsn
, sizeof(vsn
))) != sizeof(vsn
)) {
1671 ("%s: write failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH
,
1676 afs_htonuuid(&uuid
);
1678 write(fd
, (char *)&uuid
,
1679 sizeof(struct afsUUID
))) != sizeof(struct afsUUID
)) {
1681 ("%s: write of uuid failed (%d)\n",
1682 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1686 write(fd
, (char *)&FS_HostAddr_cnt
,
1687 sizeof(afs_int32
))) != sizeof(afs_int32
)) {
1689 ("%s: write of # of entries failed (%d)\n",
1690 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1693 for (i
= 0; i
< FS_HostAddr_cnt
; i
++) {
1694 if (write(fd
, (char *)&FS_HostAddrs
[i
], sizeof(afs_int32
)) !=
1695 sizeof(afs_int32
)) {
1697 ("%s: write of addresses failed (%d)\n",
1698 AFSDIR_SERVER_SYSID_FILEPATH
, errno
));
1708 * This routine sets up the buffers for the VL_RegisterAddrs RPC. All addresses
1709 * in FS_HostAddrs[] are in NBO, while the RPC treats them as a "blob" of data
1710 * and so we need to convert each of them into HBO which is what the extra
1711 * array called FS_HostAddrs_HBO is used here.
1714 Do_VLRegisterRPC(void)
1718 afs_uint32 FS_HostAddrs_HBO
[ADDRSPERSITE
];
1721 for (i
= 0; i
< FS_HostAddr_cnt
; i
++)
1722 FS_HostAddrs_HBO
[i
] = ntohl(FS_HostAddrs
[i
]);
1723 addrs
.bulkaddrs_len
= FS_HostAddr_cnt
;
1724 addrs
.bulkaddrs_val
= (afs_uint32
*) FS_HostAddrs_HBO
;
1725 code
= ubik_VL_RegisterAddrs(cstruct
, 0, &FS_HostUUID
, 0, &addrs
);
1727 if (code
== VL_MULTIPADDR
) {
1729 ("VL_RegisterAddrs rpc failed; The IP address exists on a different server; repair it\n"));
1731 ("VL_RegisterAddrs rpc failed; See VLLog for details\n"));
1733 } else if (code
== RXGEN_OPCODE
) {
1735 ("vlserver doesn't support VL_RegisterAddrs rpc; ignored\n"));
1736 FS_registered
= 2; /* So we don't have to retry in the gc daemon */
1739 ("VL_RegisterAddrs rpc failed; will retry periodically (code=%d, err=%d)\n",
1741 FS_registered
= 1; /* Retry in the gc daemon */
1744 FS_registered
= 2; /* So we don't have to retry in the gc daemon */
1756 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH
|| AFSDIR_SERVER_NETINFO_FILEPATH
) {
1758 * Find addresses we are supposed to register as per the netrestrict
1759 * and netinfo files (/usr/afs/local/NetInfo and
1760 * /usr/afs/local/NetRestict)
1765 code
= afsconf_ParseNetFiles(FS_HostAddrs
, NULL
, NULL
,
1766 ADDRSPERSITE
, reason
,
1767 AFSDIR_SERVER_NETINFO_FILEPATH
,
1768 AFSDIR_SERVER_NETRESTRICT_FILEPATH
);
1770 ViceLog(0, ("Can't register any valid addresses: %s\n", reason
));
1773 FS_HostAddr_cnt
= (afs_uint32
) code
;
1776 FS_HostAddr_cnt
= rx_getAllAddr(FS_HostAddrs
, ADDRSPERSITE
);
1779 if (FS_HostAddr_cnt
== 1 && rxBind
== 1)
1780 code
= FS_HostAddrs
[0];
1782 code
= htonl(INADDR_ANY
);
1787 InitVL(struct afsconf_dir
*dir
)
1792 * If this fails, it's because something major is wrong, and is not
1793 * likely to be time dependent.
1795 code
= vl_Initialize(dir
);
1798 ("Couldn't initialize volume location library; code=%d.\n", code
));
1802 /* Read or create the sysid file and register the fileserver's
1803 * IP addresses with the vlserver.
1805 code
= ReadSysIdFile();
1807 /* Need to create the file */
1808 ViceLog(0, ("Creating new SysID file\n"));
1809 if ((code
= afs_uuid_create(&FS_HostUUID
))) {
1810 ViceLog(0, ("Failed to create new uuid: %d\n", code
));
1814 /* A good sysid file exists; inform the vlserver. If any conflicts,
1815 * we always use the latest interface available as the real truth.
1818 code
= Do_VLRegisterRPC();
1823 main(int argc
, char *argv
[])
1827 struct rx_securityClass
**securityClasses
;
1828 afs_int32 numClasses
;
1829 struct rx_service
*tservice
;
1830 pthread_t serverPid
;
1831 pthread_attr_t tattr
;
1833 int minVnodesRequired
; /* min size of vnode cache */
1834 #ifndef AFS_NT40_ENV
1835 struct rlimit rlim
; /* max number of open file descriptors */
1840 afs_uint32 rx_bindhost
;
1841 VolumePackageOptions opts
;
1843 #ifdef AFS_AIX32_ENV
1844 struct sigaction nsa
;
1846 sigemptyset(&nsa
.sa_mask
);
1847 nsa
.sa_handler
= SIG_DFL
;
1848 nsa
.sa_flags
= SA_FULLDUMP
;
1849 sigaction(SIGABRT
, &nsa
, NULL
);
1850 sigaction(SIGSEGV
, &nsa
, NULL
);
1854 /* Initialize dirpaths */
1855 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK
)) {
1857 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR
, 0, argv
[0], 0);
1859 fprintf(stderr
, "%s: Unable to obtain AFS server directory.\n",
1863 /* set ihandle package defaults prior to parsing args */
1866 /* check for the parameter file */
1869 FS_configPath
= strdup(AFSDIR_SERVER_ETC_DIRPATH
);
1870 memset(&logopts
, 0, sizeof(logopts
));
1872 if (ParseArgs(argc
, argv
)) {
1875 opr_mutex_init(&fileproc_glock_mutex
);
1877 #ifdef AFS_SGI_VNODE_GLUE
1878 if (afs_init_kernel_config(-1) < 0) {
1880 ("Can't determine NUMA configuration, not starting fileserver.\n");
1885 confDir
= afsconf_Open(FS_configPath
);
1887 fprintf(stderr
, "Unable to open config directory %s\n",
1892 /* initialize audit user check */
1893 osi_audit_set_user_check(confDir
, fs_IsLocalRealmMatch
);
1897 LogCommandLine(argc
, argv
, "starting", "", "File server", FSLog
);
1898 if (afsconf_GetLatestKey(confDir
, NULL
, NULL
) == 0) {
1902 /* initialize the pthread soft signal handler thread */
1904 SetupLogSoftSignals();
1905 opr_softsig_Register(AFS_SIG_CHECK
, CheckSignal_Signal
);
1906 #ifndef AFS_NT40_ENV
1907 opr_softsig_Register(SIGTERM
, CheckDescriptors_Signal
);
1910 #if defined(AFS_SGI_ENV)
1911 /* give this guy a non-degrading priority so help busy servers */
1912 schedctl(NDPRI
, 0, NDPNORMMAX
);
1915 #elif !defined(AFS_NT40_ENV)
1921 #ifdef AFS_DEMAND_ATTACH_FS
1926 if (afs_winsockInit() < 0) {
1927 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED
, 0, argv
[0], 0);
1928 ViceLog(0, ("File server failed to intialize winsock.\n"));
1934 /* if we support more than 16 threads, then we better have the ability
1935 ** to keep open a large number of files simultaneously
1937 #if defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV)
1938 curLimit
= OPEN_MAX
; /* for pre AIX 4.2 systems */
1939 #elif defined(AFS_NT40_ENV)
1940 curLimit
= NT_OPEN_MAX
; /* open file descriptor limit on NT */
1943 curLimit
= 0; /* the number of open file descriptors */
1944 code
= getrlimit(RLIMIT_NOFILE
, &rlim
);
1946 curLimit
= rlim
.rlim_cur
;
1947 rlim
.rlim_cur
= rlim
.rlim_max
;
1948 code
= setrlimit(RLIMIT_NOFILE
, &rlim
);
1950 curLimit
= rlim
.rlim_max
;
1953 ViceLog(0, ("Failed to increase open file limit, using default\n"));
1955 #endif /* defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV) */
1957 curLimit
-= 32; /* leave a slack of 32 file descriptors */
1958 if (lwps
> curLimit
) {
1962 lwps
= 16; /* default to a maximum of 16 threads */
1964 /* tune the ihandle fd cache accordingly */
1965 if (vol_io_params
.fd_max_cachesize
< curLimit
)
1966 vol_io_params
.fd_max_cachesize
= curLimit
+ 1;
1969 ("The system supports a max of %d open files and we are starting %d threads (ihandle fd cache is %d)\n",
1970 curLimit
, lwps
, vol_io_params
.fd_max_cachesize
));
1973 /* Initialize volume support */
1975 V_BreakVolumeCallbacks
= BreakVolumeCallBacksLater
;
1978 SetLogThreadNumProgram( rx_GetThreadNum
);
1980 /* initialize libacl routines */
1981 acl_Initialize(ACL_VERSION
);
1983 /* initialize RX support */
1984 #if !defined(AFS_NT40_ENV) && !defined(AFS_DARWIN160_ENV)
1985 rxi_syscallp
= viced_syscall
;
1987 rx_extraPackets
= rxpackets
;
1988 rx_extraQuota
= 4; /* for outgoing prserver calls from R threads */
1989 rx_SetBusyThreshold(busy_threshold
, VBUSY
);
1990 rx_SetCallAbortThreshold(abort_threshold
);
1991 rx_SetConnAbortThreshold(abort_threshold
);
1993 stackSize
= 128 * 1024;
1995 stackSize
= lwps
* 4000;
1996 if (stackSize
< 32000)
1998 else if (stackSize
> 44000)
2001 #if defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI51_ENV) || defined(AFS_XBSD_ENV)
2002 rx_SetStackSize(1, stackSize
);
2005 rx_SetUdpBufSize(udpBufSize
); /* set the UDP buffer size for receive */
2006 rx_bindhost
= SetupVL();
2008 if (rx_InitHost(rx_bindhost
, (int)htons(7000)) < 0) {
2009 ViceLog(0, ("Cannot initialize RX\n"));
2012 if (!rxJumbograms
) {
2013 /* Don't send and don't allow 3.4 clients to send jumbograms. */
2016 if (rxMaxMTU
!= -1) {
2017 if (rx_SetMaxMTU(rxMaxMTU
) != 0) {
2018 ViceLog(0, ("rxMaxMTU %d is invalid\n", rxMaxMTU
));
2023 rx_SetRxDeadTime(30);
2024 afsconf_SetSecurityFlags(confDir
, AFSCONF_SECOPTS_ALWAYSENCRYPT
);
2025 afsconf_BuildServerSecurityObjects(confDir
, &securityClasses
, &numClasses
);
2027 tservice
= rx_NewServiceHost(rx_bindhost
, /* port */ 0, /* service id */
2028 1, /*service name */
2030 securityClasses
, numClasses
,
2031 RXAFS_ExecuteRequest
);
2034 ("Failed to initialize RX, probably two servers running.\n"));
2037 if (rxkadDisableDotCheck
) {
2038 rx_SetSecurityConfiguration(tservice
, RXS_CONFIG_FLAGS
,
2039 (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK
);
2041 rx_SetMinProcs(tservice
, 3);
2042 rx_SetMaxProcs(tservice
, lwps
);
2043 rx_SetCheckReach(tservice
, 1);
2046 rx_NewService(0, RX_STATS_SERVICE_ID
, "rpcstats", securityClasses
,
2047 numClasses
, RXSTATS_ExecuteRequest
);
2049 ViceLog(0, ("Failed to initialize rpc stat service.\n"));
2052 rx_SetMinProcs(tservice
, 2);
2053 rx_SetMaxProcs(tservice
, 4);
2055 /* Some rx debugging */
2056 if (rxlog
|| eventlog
) {
2057 debugFile
= afs_fopen("rx_dbg", "w");
2059 rx_debugFile
= debugFile
;
2061 rxevent_debugFile
= debugFile
;
2064 init_sys_error_to_et(); /* Set up error table translation */
2065 h_InitHostPackage(host_thread_quota
); /* set up local cellname and realmname */
2066 InitCallBack(numberofcbs
);
2069 code
= InitVL(confDir
);
2070 if (code
&& code
!= VL_MULTIPADDR
) {
2071 ViceLog(0, ("Fatal error in library initialization, exiting!!\n"));
2076 if (code
&& code
!= -1) {
2077 ViceLog(0, ("Fatal error in protection initialization, exiting!!\n"));
2081 /* allow super users to manage RX statistics */
2082 rx_SetRxStatUserOk(viced_SuperUser
);
2084 opr_cv_init(&fsync_cond
);
2085 opr_mutex_init(&fsync_glock_mutex
);
2087 #if !defined(AFS_DEMAND_ATTACH_FS)
2089 * For DAFS, we do not start the Rx server threads until after
2090 * the volume package is initialized, and fileserver state is
2091 * restored. This is necessary in order to keep host and callback
2092 * package state pristine until we have a chance to restore state.
2094 * Furthermore, startup latency is much lower with dafs, so this
2095 * shouldn't pose a serious problem.
2097 rx_StartServer(0); /* now start handling requests */
2100 /* we ensure that there is enough space in the vnode buffer to satisfy
2101 ** requests from all concurrent threads.
2102 ** the maximum number of vnodes used by a single thread at any one time
2103 ** is three ( "link" uses three vnodes simultaneously, one vLarge and
2104 ** two vSmall for linking files and two vLarge and one vSmall for linking
2107 minVnodesRequired
= 2 * lwps
+ 1;
2108 if (minVnodesRequired
> nSmallVns
) {
2109 nSmallVns
= minVnodesRequired
;
2111 ("Overriding -s command line parameter with %d\n",
2114 if (minVnodesRequired
> large
) {
2115 large
= minVnodesRequired
;
2116 ViceLog(0, ("Overriding -l command line parameter with %d\n", large
));
2119 /* We now do this after getting the listener up and running, so that client
2120 * connections don't timeout (maybe) if a file server is restarted, since it
2121 * will be available "real soon now". Worry about whether we can satisfy the
2122 * calls in the volume package itself.
2124 VOptDefaults(fileServer
, &opts
);
2125 opts
.nLargeVnodes
= large
;
2126 opts
.nSmallVnodes
= nSmallVns
;
2127 opts
.volcache
= volcache
;
2128 opts
.unsafe_attach
= unsafe_attach
;
2129 if (offline_timeout
!= -1) {
2130 opts
.interrupt_rxcall
= rx_InterruptCall
;
2131 opts
.offline_timeout
= offline_timeout
;
2133 if (offline_shutdown_timeout
== -1) {
2134 /* default to -offline-timeout, if shutdown-specific timeout is not
2136 opts
.offline_shutdown_timeout
= offline_timeout
;
2138 opts
.interrupt_rxcall
= rx_InterruptCall
;
2139 opts
.offline_shutdown_timeout
= offline_shutdown_timeout
;
2142 if (VInitVolumePackage2(fileServer
, &opts
)) {
2144 ("Shutting down: errors encountered initializing volume package\n"));
2149 /* Install handler to catch the shutdown signal;
2150 * bosserver assumes SIGQUIT shutdown
2152 opr_softsig_Register(SIGQUIT
, ShutDown_Signal
);
2154 if (VInitAttachVolumes(fileServer
)) {
2156 ("Shutting down: errors encountered initializing volume package\n"));
2161 #ifdef AFS_DEMAND_ATTACH_FS
2162 if (fs_state
.options
.fs_state_restore
) {
2165 * restore fileserver state */
2168 rx_StartServer(0); /* now start handling requests */
2169 #endif /* AFS_DEMAND_ATTACH_FS */
2172 * We are done calling fopen/fdopen. It is safe to use a large
2173 * of the file descriptor cache.
2177 ViceLog(5, ("Starting pthreads\n"));
2178 opr_Verify(pthread_attr_init(&tattr
) == 0);
2179 opr_Verify(pthread_attr_setdetachstate(&tattr
,
2180 PTHREAD_CREATE_DETACHED
) == 0);
2182 opr_Verify(pthread_create(&serverPid
, &tattr
, FiveMinuteCheckLWP
,
2183 &fiveminutes
) == 0);
2184 opr_Verify(pthread_create(&serverPid
, &tattr
, HostCheckLWP
,
2185 &fiveminutes
) == 0);
2186 opr_Verify(pthread_create(&serverPid
, &tattr
, FsyncCheckLWP
,
2187 &fiveminutes
) == 0);
2189 gettimeofday(&tp
, 0);
2192 * Figure out the FileServer's name and primary address.
2194 ViceLog(0, ("Getting FileServer name...\n"));
2195 code
= gethostname(FS_HostName
, 64);
2197 ViceLog(0, ("gethostname() failed\n"));
2199 ViceLog(0, ("FileServer host name is '%s'\n", FS_HostName
));
2201 ViceLog(0, ("Getting FileServer address...\n"));
2202 he
= gethostbyname(FS_HostName
);
2204 ViceLog(0, ("Can't find address for FileServer '%s'\n", FS_HostName
));
2207 memcpy(&FS_HostAddr_NBO
, he
->h_addr
, 4);
2208 (void)afs_inet_ntoa_r(FS_HostAddr_NBO
, hoststr
);
2209 FS_HostAddr_HBO
= ntohl(FS_HostAddr_NBO
);
2211 ("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n",
2212 FS_HostName
, hoststr
, FS_HostAddr_NBO
, FS_HostAddr_HBO
));
2216 strftime(tbuffer
, sizeof(tbuffer
), "%a %b %d %H:%M:%S %Y",
2217 localtime_r(&t
, &tm
));
2218 ViceLog(0, ("File Server started %s\n", tbuffer
));
2219 afs_FullPerfStats
.det
.epoch
.tv_sec
= StartTime
= tp
.tv_sec
;
2221 sleep(1000); /* long time */
2223 AFS_UNREACHED(return(0));