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
10 /* viced.c - File Server main loop */
14 /* Function - This routine has the initialization code for */
17 /* ********************************************************************** */
19 #include <afsconfig.h>
20 #include <afs/param.h>
28 #include <sys/types.h>
29 #include <afs/procmgmt.h> /* signal(), kill(), wait(), etc. */
35 #include <WINNT/afsevent.h>
38 #include <netinet/in.h>
40 #include <unistd.h> /* sysconf() */
52 #endif /* ITIMER_REAL */
53 #include <sys/resource.h>
54 #endif /* AFS_NT40_ENV */
59 #ifdef AFS_PTHREAD_ENV
61 #else /* AFS_PTHREAD_ENV */
62 #include <afs/assert.h>
63 #endif /* AFS_PTHREAD_ENV */
66 #include <afs/ptclient.h>
67 #include <afs/afsint.h>
68 #include <afs/vldbint.h>
69 #include <afs/errors.h>
70 #include <afs/ihandle.h>
71 #include <afs/vnode.h>
72 #include <afs/volume.h>
74 #include <afs/cellconfig.h>
76 #include <afs/prs_fs.h>
80 #include <afs/afs_args.h>
81 #include <afs/vlserver.h>
82 #include <afs/afsutil.h>
83 #include <afs/fileutil.h>
85 #include <afs/netutils.h>
89 #ifdef AFS_PTHREAD_ENV
92 #if defined(AFS_SGI_ENV)
93 #include "sys/schedctl.h"
96 #include <rx/rx_globals.h>
99 extern int BreakVolumeCallBacks(), InitCallBack();
100 extern int BreakVolumeCallBacks(), InitCallBack(), BreakLaterCallBacks();
101 extern int BreakVolumeCallBacksLater();
102 extern int LogLevel, etext;
103 extern afs_int32 BlocksSpare, PctSpare;
106 static void ClearXStatValues(), NewParms(), PrintCounters();
107 static void ResetCheckDescriptors(void), ResetCheckSignal(void);
108 static void CheckSignal(void);
109 extern int GetKeysFromToken();
110 extern int RXAFS_ExecuteRequest();
111 extern int RXSTATS_ExecuteRequest();
113 int eventlog = 0, rxlog = 0;
115 FILE *console = NULL;
117 #ifdef AFS_PTHREAD_ENV
118 pthread_mutex_t fsync_glock_mutex;
119 pthread_cond_t fsync_cond;
122 #endif /* AFS_PTHREAD_ENV */
125 #define AFS_QUIETFS_ENV 1
126 #define NT_OPEN_MAX 1024 /* This is an arbitrary no. we came up with for
127 * now. We hope this will be replaced by a more
128 * intelligent estimate later. */
131 int SystemId; /* ViceID of "Administrators" */
132 int SystemAnyUser; /* Viceid of "System:AnyUser" */
133 prlist SystemAnyUserCPS; /* CPS for "system:AnyUser */
134 int AnonymousID = 0; /* ViceId of "Anonymous" */
135 prlist AnonCPS; /* CPS for "Anonymous" */
137 struct afsconf_dir *confDir; /* Configuration dir object */
139 int restartMode = RESTART_ORDINARY;
141 int Testing = 0; /* for ListViceInodes */
144 * Home for the performance statistics.
146 struct afs_PerfStats afs_perfstats;
149 extern int Statistics;
157 int rxJumbograms = 1; /* default is to send and receive jumbograms. */
158 afs_int32 implicitAdminRights = PRSFS_LOOKUP; /* The ADMINISTER right is
160 afs_int32 readonlyServer = 0;
163 int stackSize = 24000;
164 int fiveminutes = 300; /* 5 minutes. Change this for debugging only */
165 int CurrentConnections = 0;
166 int hostaclRefresh = 7200; /* refresh host clients' acls every 2 hrs */
167 #if defined(AFS_SGI_ENV)
172 int rxpackets = 150; /* 100 */
173 int nSmallVns = 400; /* 200 */
174 int large = 400; /* 200 */
175 int volcache = 400; /* 400 */
176 int numberofcbs = 60000; /* 60000 */
177 int lwps = 9; /* 6 */
178 int buffs = 90; /* 70 */
179 int novbc = 0; /* Enable Volume Break calls */
180 int busy_threshold = 600;
181 int abort_threshold = 10;
182 int udpBufSize = 0; /* UDP buffer size for receive */
183 int sendBufSize = 16384; /* send buffer size */
188 * FileServer's name and IP address, both network byte order and
191 #define ADDRSPERSITE 16 /* Same global is in rx/rx_user.c */
193 char FS_HostName[128] = "localhost";
194 afs_uint32 FS_HostAddr_NBO;
195 afs_uint32 FS_HostAddr_HBO;
196 afs_uint32 FS_HostAddrs[ADDRSPERSITE], FS_HostAddr_cnt = 0, FS_registered = 0;
197 /* All addresses in FS_HostAddrs are in NBO */
200 static void FlagMsg();
203 * Home for the performance statistics.
212 register int tsize = getdtablesize();
214 for (i = 0; i < tsize; i++) {
215 if (fstat(i, &status) != -1) {
216 printf("%d: dev %x, inode %u, length %u, type/mode %x\n", i,
217 status.st_dev, status.st_ino, status.st_size,
222 ResetCheckDescriptors();
224 } /*CheckDescriptors */
227 #ifdef AFS_PTHREAD_ENV
229 CheckSignal_Signal(x)
241 CheckDescriptors_Signal(x)
245 #else /* AFS_PTHREAD_ENV */
247 CheckSignal_Signal(x)
249 IOMGR_SoftSig(CheckSignal, 0);
255 IOMGR_SoftSig(ShutDown, 0);
259 CheckDescriptors_Signal(x)
261 IOMGR_SoftSig(CheckDescriptors, 0);
263 #endif /* AFS_PTHREAD_ENV */
265 /* check whether caller is authorized to manage RX statistics */
267 fs_rxstat_userok(struct rx_call *call)
269 return afsconf_SuperUser(confDir, call, NULL);
273 ResetCheckSignal(void)
277 #if defined(AFS_HPUX_ENV)
280 #if defined(AFS_NT40_ENV)
287 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
288 softsig_signal(signo, CheckSignal_Signal);
290 signal(signo, CheckSignal_Signal);
295 ResetCheckDescriptors(void)
298 #if defined(AFS_PTHREAD_ENV)
299 softsig_signal(SIGTERM, CheckDescriptors_Signal);
301 signal(SIGTERM, CheckDescriptors_Signal);
307 /* proc called by rxkad module to get a key */
309 get_key(char *arock, register afs_int32 akvno, char *akey)
312 static struct afsconf_key tkey;
313 register afs_int32 code;
316 ViceLog(0, ("conf dir not open\n"));
319 code = afsconf_GetKey(confDir, akvno, tkey.key);
322 memcpy(akey, tkey.key, sizeof(tkey.key));
329 viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
334 #ifndef AFS_LINUX20_ENV
335 old = (void (*)())signal(SIGSYS, SIG_IGN);
337 rcode = syscall(AFS_SYSCALL, 28 /* AFSCALL_CALL */ , a3, a4, a5);
338 #ifndef AFS_LINUX20_ENV
346 #if !defined(AFS_NT40_ENV)
347 #include "AFS_component_version_number.c"
348 #endif /* !AFS_NT40_ENV */
350 #define MAXADMINNAME 64
351 char adminName[MAXADMINNAME];
359 if ((stat("/AdminName", &status)) || /* if file does not exist */
360 (status.st_size <= 0) || /* or it is too short */
361 (status.st_size >= (MAXADMINNAME)) || /* or it is too long */
362 !(fd = open("/AdminName", O_RDONLY, 0))) { /* or the open fails */
363 strcpy(adminName, "System:Administrators"); /* use the default name */
365 (void)read(fd, adminName, status.st_size); /* use name from the file */
368 close(fd); /* close fd if it was opened */
370 } /*CheckAdminName */
376 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
377 /* set our 'thread-id' so that the host hold table works */
378 MUTEX_ENTER(&rx_stats_mutex); /* protects rxi_pthread_hinum */
380 pthread_setspecific(rx_thread_id_key, (void *)rxi_pthread_hinum);
381 MUTEX_EXIT(&rx_stats_mutex);
383 ("Set thread id %d for '%s'\n",
384 pthread_getspecific(rx_thread_id_key), s));
388 /* This LWP does things roughly every 5 minutes */
395 ViceLog(1, ("Starting five minute check process\n"));
396 setThreadId("FiveMinuteCheckLWP");
398 #ifdef AFS_PTHREAD_ENV
400 #else /* AFS_PTHREAD_ENV */
401 IOMGR_Sleep(fiveminutes);
402 #endif /* AFS_PTHREAD_ENV */
404 /* close the log so it can be removed */
405 ReOpenLog(AFSDIR_SERVER_FILELOG_FILEPATH); /* don't trunc, just append */
406 ViceLog(2, ("Cleaning up timed out callbacks\n"));
407 if (CleanupTimedOutCallBacks())
408 ViceLog(5, ("Timed out callbacks deleted\n"));
409 ViceLog(2, ("Set disk usage statistics\n"));
411 if (FS_registered == 1)
413 /* Force wakeup in case we missed something; pthreads does timedwait */
414 #ifndef AFS_PTHREAD_ENV
415 LWP_NoYieldSignal(&fsync_wait);
417 if (printBanner && (++msg & 1)) { /* Every 10 minutes */
418 time_t now = FT_ApproxTime();
419 if (console != NULL) {
420 #ifndef AFS_QUIETFS_ENV
421 fprintf(console, "File server is running at %s\r",
422 afs_ctime(&now, tbuffer, sizeof(tbuffer)));
423 #endif /* AFS_QUIETFS_ENV */
425 ("File server is running at %s\n",
426 afs_ctime(&now, tbuffer, sizeof(tbuffer))));
430 } /*FiveMinuteCheckLWP */
433 /* This LWP does host checks every 5 minutes: it should not be used for
434 * other 5 minute activities because it may be delayed by timeouts when
435 * it probes the workstations
440 ViceLog(1, ("Starting Host check process\n"));
441 setThreadId("HostCheckLWP");
443 #ifdef AFS_PTHREAD_ENV
445 #else /* AFS_PTHREAD_ENV */
446 IOMGR_Sleep(fiveminutes);
447 #endif /* AFS_PTHREAD_ENV */
448 ViceLog(2, ("Checking for dead venii & clients\n"));
453 /* This LWP does fsync checks every 5 minutes: it should not be used for
454 * other 5 minute activities because it may be delayed by timeouts when
455 * it probes the workstations
461 #ifdef AFS_PTHREAD_ENV
462 struct timespec fsync_next;
464 ViceLog(1, ("Starting fsync check process\n"));
466 setThreadId("FsyncCheckLWP");
468 #ifdef AFS_PTHREAD_ENV
469 assert(pthread_cond_init(&fsync_cond, NULL) == 0);
470 assert(pthread_mutex_init(&fsync_glock_mutex, NULL) == 0);
473 FSYNC_LOCK while (1) {
474 #ifdef AFS_PTHREAD_ENV
475 /* rounding is fine */
476 fsync_next.tv_nsec = 0;
477 fsync_next.tv_sec = time(0) + fiveminutes;
480 pthread_cond_timedwait(&fsync_cond, &fsync_glock_mutex,
482 if (code != 0 && code != ETIMEDOUT)
483 ViceLog(0, ("pthread_cond_timedwait returned %d\n", code));
484 #else /* AFS_PTHREAD_ENV */
485 if ((code = LWP_WaitProcess(&fsync_wait)) != LWP_SUCCESS)
486 ViceLog(0, ("LWP_WaitProcess returned %d\n", code));
487 #endif /* AFS_PTHREAD_ENV */
488 ViceLog(2, ("Checking for fsync events\n"));
490 code = BreakLaterCallBacks();
495 /*------------------------------------------------------------------------
496 * PRIVATE ClearXStatValues
499 * Initialize all of the values collected via the xstat
509 * Must be called during File Server initialization.
513 *------------------------------------------------------------------------*/
517 { /*ClearXStatValues */
519 struct fs_stats_opTimingData *opTimeP; /*Ptr to timing struct */
520 struct fs_stats_xferData *opXferP; /*Ptr to xfer struct */
521 int i; /*Loop counter */
524 * Zero all xstat-related structures.
526 memset((char *)(&afs_perfstats), 0, sizeof(struct afs_PerfStats));
527 #if FS_STATS_DETAILED
528 memset((char *)(&afs_FullPerfStats), 0,
529 sizeof(struct fs_stats_FullPerfStats));
532 * That's not enough. We have to set reasonable minima for
533 * time and xfer values in the detailed stats.
535 opTimeP = &(afs_FullPerfStats.det.rpcOpTimes[0]);
536 for (i = 0; i < FS_STATS_NUM_RPC_OPS; i++, opTimeP++)
537 opTimeP->minTime.tv_sec = 999999;
539 opXferP = &(afs_FullPerfStats.det.xferOpTimes[0]);
540 for (i = 0; i < FS_STATS_NUM_XFER_OPS; i++, opXferP++) {
541 opXferP->minTime.tv_sec = 999999;
542 opXferP->minBytes = 999999999;
546 * There's more. We have to set our unique system identifier, as
547 * declared in param.h. If such a thing is not defined, we bitch
548 * and declare ourselves to be an unknown system type.
551 afs_perfstats.sysname_ID = SYS_NAME_ID;
554 ViceLog(0, ("Sys name ID constant not defined in param.h!!\n"));
555 ViceLog(0, ("[Choosing ``undefined'' sys name ID.\n"));
557 afs_perfstats.sysname_ID = SYS_NAME_ID_UNDEFINED;
558 #endif /* SYS_NAME_ID */
561 } /*ClearXStatValues */
567 int dirbuff, dircall, dirio;
569 int workstations, activeworkstations, delworkstations;
573 TM_GetTimeOfDay(&tpl, 0);
576 ("Vice was last started at %s\n",
577 afs_ctime(&StartTime, tbuffer, sizeof(tbuffer))));
581 DStat(&dirbuff, &dircall, &dirio);
583 ("With %d directory buffers; %d reads resulted in %d read I/Os\n",
584 dirbuff, dircall, dirio));
585 rx_PrintStats(stderr);
587 PrintCallBackStats();
589 processSize = -1; /* TODO: */
591 processSize = (int)((long)sbrk(0) >> 10);
594 ("There are %d connections, process size %d\n",
595 CurrentConnections, processSize));
596 h_GetWorkStats(&workstations, &activeworkstations, &delworkstations,
597 tpl.tv_sec - 15 * 60);
599 ("There are %d workstations, %d are active (req in < 15 mins), %d marked \"down\"\n",
600 workstations, activeworkstations, delworkstations));
610 if (FS_registered > 0) {
612 * We have proper ip addresses; tell the vlserver what we got; the following
613 * routine will do the proper reporting for us
626 ShutDownAndCore(int dopanic)
628 time_t now = time(0);
633 ("Shutting down file server at %s",
634 afs_ctime(&now, tbuffer, sizeof(tbuffer))));
636 ViceLog(0, ("ABNORMAL SHUTDOWN, see core file.\n"));
637 #ifndef AFS_QUIETFS_ENV
638 if (console != NULL) {
639 fprintf(console, "File server restart/shutdown received at %s\r",
640 afs_ctime(&now, tbuffer, sizeof(tbuffer)));
647 /* do not allows new reqests to be served from now on, all new requests
648 * are returned with an error code of RX_RESTARTING ( transient failure ) */
649 rx_SetRxTranquil(); /* dhruba */
653 rx_PrintStats(debugFile);
656 if (console != NULL) {
659 #ifndef AFS_QUIETFS_ENV
660 fprintf(console, "File server has terminated abnormally at %s\r",
661 afs_ctime(&now, tbuffer, sizeof(tbuffer)));
664 ("File server has terminated abnormally at %s\n",
665 afs_ctime(&now, tbuffer, sizeof(tbuffer))));
667 #ifndef AFS_QUIETFS_ENV
668 fprintf(console, "File server has terminated normally at %s\r",
669 afs_ctime(&now, tbuffer, sizeof(tbuffer)));
672 ("File server has terminated normally at %s\n",
673 afs_ctime(&now, tbuffer, sizeof(tbuffer))));
683 { /* backward compatibility */
684 ShutDownAndCore(DONTPANIC);
693 /* default supports help flag */
695 strcpy(buffer, "Usage: fileserver ");
696 strcat(buffer, "[-d <debug level>] ");
697 strcat(buffer, "[-p <number of processes>] ");
698 strcat(buffer, "[-spare <number of spare blocks>] ");
699 strcat(buffer, "[-pctspare <percentage spare>] ");
700 strcat(buffer, "[-b <buffers>] ");
701 strcat(buffer, "[-l <large vnodes>] ");
702 strcat(buffer, "[-s <small vnodes>] ");
703 strcat(buffer, "[-vc <volume cachesize>] ");
704 strcat(buffer, "[-w <call back wait interval>] ");
705 strcat(buffer, "[-cb <number of call backs>] ");
706 strcat(buffer, "[-banner (print banner every 10 minutes)] ");
707 strcat(buffer, "[-novbc (whole volume cbs disabled)] ");
708 strcat(buffer, "[-implicit <admin mode bits: rlidwka>] ");
709 strcat(buffer, "[-readonly (read-only file server)] ");
711 "[-hr <number of hours between refreshing the host cps>] ");
712 strcat(buffer, "[-busyat <redirect clients when queue > n>] ");
713 strcat(buffer, "[-nobusy <no VBUSY before a volume is attached>] ");
714 strcat(buffer, "[-rxpck <number of rx extra packets>] ");
715 strcat(buffer, "[-rxdbg (enable rx debugging)] ");
716 strcat(buffer, "[-rxdbge (enable rxevent debugging)] ");
718 strcat(buffer, "[-m <min percentage spare in partition>] ");
720 #if defined(AFS_SGI_ENV)
721 strcat(buffer, "[-lock (keep fileserver from swapping)] ");
723 strcat(buffer, "[-L (large server conf)] ");
724 strcat(buffer, "[-S (small server conf)] ");
725 strcat(buffer, "[-k <stack size>] ");
726 strcat(buffer, "[-realm <Kerberos realm name>] ");
727 strcat(buffer, "[-udpsize <size of socket buffer in bytes>] ");
728 strcat(buffer, "[-sendsize <size of send buffer in bytes>] ");
729 /* strcat(buffer, "[-enable_peer_stats] "); */
730 /* strcat(buffer, "[-enable_process_stats] "); */
731 strcat(buffer, "[-help]\n");
733 ViceLog(0, ("%s", buffer));
736 printf("%s", buffer);
743 ParseRights(char *arights)
749 if (!arights || !strcmp(arights, "")) {
750 printf("Missing list of mode bits on -implicit option\n");
753 if (!strcmp(arights, "none"))
755 else if (!strcmp(arights, "read"))
756 mode = PRSFS_READ | PRSFS_LOOKUP;
757 else if (!strcmp(arights, "write"))
759 PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |
760 PRSFS_WRITE | PRSFS_LOCK;
761 else if (!strcmp(arights, "all"))
763 PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |
764 PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER;
766 len = strlen(arights);
767 for (i = 0; i < len; i++) {
772 mode |= PRSFS_LOOKUP;
774 mode |= PRSFS_INSERT;
776 mode |= PRSFS_DELETE;
782 mode |= PRSFS_ADMINISTER;
800 printf("Illegal -implicit rights character '%c'.\n", tc);
809 * Limit MAX_FILESERVER_THREAD by the system limit on the number of
810 * pthreads (sysconf(_SC_THREAD_THREADS_MAX)), if applicable and
813 * AIX: sysconf() limit is real
814 * HP-UX: sysconf() limit is real
815 * IRIX: sysconf() limit is apparently NOT real -- too small
816 * DUX: sysconf() limit is apparently NOT real -- too big
817 * Linux: sysconf() limit is apparently NOT real -- too big
818 * Solaris: no sysconf() limit
821 max_fileserver_thread(void)
823 #if defined(AFS_PTHREAD_ENV)
824 #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV)
827 ans = sysconf(_SC_THREAD_THREADS_MAX);
828 if (0 < ans && ans < MAX_FILESERVER_THREAD)
831 #endif /* defined(AFS_PTHREAD_ENV) */
832 return MAX_FILESERVER_THREAD;
836 ParseArgs(int argc, char *argv[])
838 int SawL = 0, SawS = 0, SawVC = 0;
839 int Sawrxpck = 0, Sawsmall = 0, Sawlarge = 0, Sawcbs = 0, Sawlwps =
843 int bufSize = 0; /* temp variable to read in udp socket buf size */
845 for (i = 1; i < argc; i++) {
846 if (!strcmp(argv[i], "-d")) {
847 debuglevel = atoi(argv[++i]);
848 LogLevel = debuglevel;
849 } else if (!strcmp(argv[i], "-banner")) {
851 } else if (!strcmp(argv[i], "-implicit")) {
852 implicitAdminRights = ParseRights(argv[++i]);
853 if (implicitAdminRights < 0)
854 return implicitAdminRights;
855 } else if (!strcmp(argv[i], "-readonly")) {
857 } else if (!strcmp(argv[i], "-L")) {
859 } else if (!strcmp(argv[i], "-S")) {
861 } else if (!strcmp(argv[i], "-p")) {
863 max_fileserver_thread() - FILESERVER_HELPER_THREADS;
865 lwps = atoi(argv[++i]);
870 } else if (!strcmp(argv[i], "-b")) {
872 buffs = atoi(argv[++i]);
873 } else if (!strcmp(argv[i], "-l")) {
875 large = atoi(argv[++i]);
876 } else if (!strcmp(argv[i], "-vc")) {
878 volcache = atoi(argv[++i]);
879 } else if (!strcmp(argv[i], "-novbc")) {
881 } else if (!strcmp(argv[i], "-rxpck")) {
883 rxpackets = atoi(argv[++i]);
884 } else if (!strcmp(argv[i], "-s")) {
886 nSmallVns = atoi(argv[++i]);
887 } else if (!strcmp(argv[i], "-abortthreshold")) {
888 abort_threshold = atoi(argv[++i]);
889 } else if (!strcmp(argv[i], "-k"))
890 stack = atoi(argv[++i]);
891 #if defined(AFS_SGI_ENV)
892 else if (!strcmp(argv[i], "-lock")) {
896 else if (!strcmp(argv[i], "-spare")) {
897 BlocksSpare = atoi(argv[++i]);
899 } else if (!strcmp(argv[i], "-pctspare")) {
900 PctSpare = atoi(argv[++i]);
901 BlocksSpare = 0; /* has non-zero default */
903 } else if (!strcmp(argv[i], "-w"))
904 fiveminutes = atoi(argv[++i]);
905 else if (!strcmp(argv[i], "-hr")) {
906 int hr = atoi(argv[++i]);
907 if ((hr < 1) || (hr > 36)) {
909 ("host acl refresh interval of %d hours is invalid; hours must be between 1 and 36\n\n",
913 hostaclRefresh = hr * 60 * 60;
914 } else if (!strcmp(argv[i], "-rxdbg"))
916 else if (!strcmp(argv[i], "-rxdbge"))
918 else if (!strcmp(argv[i], "-cb")) {
920 numberofcbs = atoi(argv[++i]);
921 if ((numberofcbs < 10000) || (numberofcbs > 2147483647)) {
923 ("number of cbs %d invalid; must be between 10000 and 2147483647\n",
927 } else if (!strcmp(argv[i], "-busyat")) {
929 busy_threshold = atoi(argv[++i]);
930 if (busy_threshold < 10) {
932 ("Busy threshold %d is too low, will compute default.\n",
936 } else if (!strcmp(argv[i], "-nobusy"))
939 else if (!strcmp(argv[i], "-m")) {
940 extern int aixlow_water;
941 aixlow_water = atoi(argv[++i]);
942 if ((aixlow_water < 0) || (aixlow_water > 30)) {
943 printf("space reserved %d% invalid; must be between 0-30%\n",
949 else if (!strcmp(argv[i], "-nojumbo")) {
951 } else if (!strcmp(argv[i], "-realm")) {
952 extern char local_realm[AFS_REALM_SZ];
953 if (strlen(argv[++i]) >= AFS_REALM_SZ) {
955 ("-realm argument must contain fewer than %d characters.\n",
959 strncpy(local_realm, argv[i], AFS_REALM_SZ);
960 } else if (!strcmp(argv[i], "-udpsize")) {
961 if ((i + 1) >= argc) {
962 printf("You have to specify -udpsize <integer value>\n");
965 bufSize = atoi(argv[++i]);
966 if (bufSize < rx_GetMinUdpBufSize())
968 ("Warning:udpsize %d is less than minimum %d; ignoring\n",
969 bufSize, rx_GetMinUdpBufSize());
971 udpBufSize = bufSize;
972 } else if (!strcmp(argv[i], "-sendsize")) {
973 if ((i + 1) >= argc) {
974 printf("You have to specify -sendsize <integer value>\n");
977 bufSize = atoi(argv[++i]);
980 ("Warning:sendsize %d is less than minimum %d; ignoring\n",
983 sendBufSize = bufSize;
984 } else if (!strcmp(argv[i], "-enable_peer_stats")) {
985 rx_enablePeerRPCStats();
986 } else if (!strcmp(argv[i], "-enable_process_stats")) {
987 rx_enableProcessRPCStats();
990 else if (strcmp(argv[i], "-syslog") == 0) {
991 /* set syslog logging flag */
993 } else if (strncmp(argv[i], "-syslog=", 8) == 0) {
995 serverLogSyslogFacility = atoi(argv[i] + 8);
1003 printf("Only one of -L, or -S must be specified\n");
1014 numberofcbs = 20000;
1030 numberofcbs = 64000;
1039 busy_threshold = 3 * rxpackets / 2;
1049 NewParms(int initializing)
1051 static struct stat sbuf;
1054 char *argv[MAXPARMS];
1057 if (!(stat("/vice/file/parms", &sbuf))) {
1058 parms = (char *)malloc(sbuf.st_size);
1061 fd = open("parms", O_RDONLY, 0666);
1063 ViceLog(0, ("Open for parms failed with errno = %d\n", errno));
1067 i = read(fd, parms, sbuf.st_size);
1069 if (i != sbuf.st_size) {
1071 ViceLog(0, ("Read on parms failed with errno = %d\n", errno));
1074 ("Read on parms failed; expected %d bytes but read %d\n",
1081 for (i = 0; i < MAXPARMS; argv[i++] = 0);
1083 for (argc = i = 0; i < sbuf.st_size; i++) {
1084 if ((*(parms + i) != ' ') && (*(parms + i) != '\n')) {
1085 if (argv[argc] == 0)
1086 argv[argc] = (parms + i);
1088 *(parms + i) = '\0';
1089 if (argv[argc] != 0) {
1090 if (++argc == MAXPARMS)
1093 while ((*(parms + i + 1) == ' ')
1094 || (*(parms + i + 1) == '\n'))
1098 if (ParseArgs(argc, argv) == 0) {
1099 ViceLog(0, ("Change parameters to:"));
1101 ViceLog(0, ("Invalid parameter in:"));
1103 for (i = 0; i < argc; i++) {
1104 ViceLog(0, (" %s", argv[i]));
1108 } else if (!initializing)
1110 ("Received request to change parms but no parms file exists\n"));
1115 /* Miscellaneous routines */
1119 ViceLog(0, ("%s\n", msg));
1131 * If this fails, it's because something major is wrong, and is not
1132 * likely to be time dependent.
1134 code = pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH, 0);
1137 ("Couldn't initialize protection library; code=%d.\n", code));
1140 SystemId = SYSADMINID;
1141 SystemAnyUser = ANYUSERID;
1142 SystemAnyUserCPS.prlist_len = 0;
1143 SystemAnyUserCPS.prlist_val = NULL;
1144 AnonCPS.prlist_len = 0;
1145 AnonCPS.prlist_val = NULL;
1147 code = pr_GetCPS(SystemAnyUser, &SystemAnyUserCPS);
1150 ("Couldn't get CPS for AnyUser, will try again in 30 seconds; code=%d.\n",
1154 code = pr_GetCPS(ANONYMOUSID, &AnonCPS);
1157 ("Couldn't get Anonymous CPS, exiting; code=%d.\n",
1161 AnonymousID = ANONYMOUSID;
1164 #ifdef AFS_PTHREAD_ENV
1166 #else /* AFS_PTHREAD_ENV */
1168 #endif /* AFS_PTHREAD_ENV */
1172 struct rx_connection *serverconns[MAXSERVERS];
1173 struct ubik_client *cstruct;
1176 vl_Initialize(char *confDir)
1178 afs_int32 code, scIndex = 0, i;
1179 struct afsconf_dir *tdir;
1180 struct rx_securityClass *sc;
1181 struct afsconf_cell info;
1183 tdir = afsconf_Open(confDir);
1186 ("Could not open configuration directory (%s).\n", confDir));
1189 code = afsconf_ClientAuth(tdir, &sc, &scIndex);
1191 ViceLog(0, ("Could not get security object for localAuth\n"));
1194 code = afsconf_GetCellInfo(tdir, NULL, AFSCONF_VLDBSERVICE, &info);
1195 if (info.numServers > MAXSERVERS) {
1197 ("vl_Initialize: info.numServers=%d (> MAXSERVERS=%d)\n",
1198 info.numServers, MAXSERVERS));
1201 for (i = 0; i < info.numServers; i++)
1203 rx_NewConnection(info.hostAddr[i].sin_addr.s_addr,
1204 info.hostAddr[i].sin_port, USER_SERVICE_ID, sc,
1206 code = ubik_ClientInit(serverconns, &cstruct);
1208 ViceLog(0, ("vl_Initialize: ubik client init failed.\n"));
1214 #define SYSIDMAGIC 0x88aabbcc
1215 #define SYSIDVERSION 1
1220 afs_int32 fd, nentries, i;
1221 struct versionStamp vsn;
1225 if ((stat(AFSDIR_SERVER_SYSID_FILEPATH, &status))
1226 || (status.st_size <= 0)) {
1227 ViceLog(0, ("%s: doesn't exist\n", AFSDIR_SERVER_SYSID_FILEPATH));
1230 if (!(fd = open(AFSDIR_SERVER_SYSID_FILEPATH, O_RDONLY, 0))) {
1232 ("%s: can't open (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1236 if ((i = read(fd, (char *)&vsn, sizeof(vsn))) != sizeof(vsn)) {
1238 ("%s: Read failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1242 if (vsn.magic != SYSIDMAGIC) {
1244 ("%s: wrong magic %x (we support %x)\n",
1245 AFSDIR_SERVER_SYSID_FILEPATH, vsn.magic, SYSIDMAGIC));
1248 if (vsn.version != SYSIDVERSION) {
1250 ("%s: wrong version %d (we support %d)\n",
1251 AFSDIR_SERVER_SYSID_FILEPATH, vsn.version, SYSIDVERSION));
1255 read(fd, (char *)&uuid,
1256 sizeof(struct afsUUID))) != sizeof(struct afsUUID)) {
1258 ("%s: read of uuid failed (%d)\n",
1259 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1262 afs_ntohuuid(&uuid);
1265 read(fd, (char *)&nentries,
1266 sizeof(afs_int32))) != sizeof(afs_int32)) {
1268 ("%s: Read of entries failed (%d)\n",
1269 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1272 if (nentries <= 0 || nentries > ADDRSPERSITE) {
1274 ("%s: invalid num of interfaces: %d\n",
1275 AFSDIR_SERVER_SYSID_FILEPATH, nentries));
1278 FS_HostAddr_cnt = nentries;
1279 for (i = 0; i < nentries; i++) {
1280 if (read(fd, (char *)&FS_HostAddrs[i], sizeof(afs_int32)) !=
1281 sizeof(afs_int32)) {
1283 ("%s: Read of addresses failed (%d)\n",
1284 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1285 FS_HostAddr_cnt = 0; /* reset it */
1296 afs_int32 fd, nentries, i;
1297 struct versionStamp vsn;
1301 if (!stat(AFSDIR_SERVER_SYSID_FILEPATH, &status)) {
1303 * File exists; keep the old one around
1305 renamefile(AFSDIR_SERVER_SYSID_FILEPATH,
1306 AFSDIR_SERVER_OLDSYSID_FILEPATH);
1308 fd = open(AFSDIR_SERVER_SYSID_FILEPATH, O_WRONLY | O_TRUNC | O_CREAT,
1312 ("%s: can't create (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1316 vsn.magic = SYSIDMAGIC;
1318 if ((i = write(fd, (char *)&vsn, sizeof(vsn))) != sizeof(vsn)) {
1320 ("%s: write failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH,
1325 afs_htonuuid(&uuid);
1327 write(fd, (char *)&uuid,
1328 sizeof(struct afsUUID))) != sizeof(struct afsUUID)) {
1330 ("%s: write of uuid failed (%d)\n",
1331 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1335 write(fd, (char *)&FS_HostAddr_cnt,
1336 sizeof(afs_int32))) != sizeof(afs_int32)) {
1338 ("%s: write of # of entries failed (%d)\n",
1339 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1342 for (i = 0; i < FS_HostAddr_cnt; i++) {
1343 if (write(fd, (char *)&FS_HostAddrs[i], sizeof(afs_int32)) !=
1344 sizeof(afs_int32)) {
1346 ("%s: write of addresses failed (%d)\n",
1347 AFSDIR_SERVER_SYSID_FILEPATH, errno));
1357 * This routine sets up the buffers for the VL_RegisterAddrs RPC. All addresses
1358 * in FS_HostAddrs[] are in NBO, while the RPC treats them as a "blob" of data
1359 * and so we need to convert each of them into HBO which is what the extra
1360 * array called FS_HostAddrs_HBO is used here.
1367 extern int VL_RegisterAddrs();
1368 afs_uint32 FS_HostAddrs_HBO[ADDRSPERSITE];
1371 for (i = 0; i < FS_HostAddr_cnt; i++)
1372 FS_HostAddrs_HBO[i] = ntohl(FS_HostAddrs[i]);
1373 addrs.bulkaddrs_len = FS_HostAddr_cnt;
1374 addrs.bulkaddrs_val = (afs_uint32 *) FS_HostAddrs_HBO;
1375 code = ubik_Call(VL_RegisterAddrs, cstruct, 0, &FS_HostUUID, 0, &addrs);
1377 if (code == VL_MULTIPADDR) {
1379 ("VL_RegisterAddrs rpc failed; The ethernet address exist on a different server; repair it\n"));
1381 ("VL_RegisterAddrs rpc failed; See VLLog for details\n"));
1383 } else if (code == RXGEN_OPCODE) {
1385 ("vlserver doesn't support VL_RegisterAddrs rpc; ignored\n"));
1386 FS_registered = 2; /* So we don't have to retry in the gc daemon */
1389 ("VL_RegisterAddrs rpc failed; will retry periodically (code=%d, err=%d)\n",
1393 FS_registered = 2; /* So we don't have to retry in the gc daemon */
1406 extern int rxi_numNetAddrs;
1407 extern afs_uint32 rxi_NetAddrs[];
1410 * If this fails, it's because something major is wrong, and is not
1411 * likely to be time dependent.
1413 code = vl_Initialize(AFSDIR_SERVER_ETC_DIRPATH);
1416 ("Couldn't initialize protection library; code=%d.\n", code));
1420 /* Read or create the sysid file and register the fileserver's
1421 * IP addresses with the vlserver.
1423 code = ReadSysIdFile();
1425 /* Need to create the file */
1426 ViceLog(0, ("Creating new SysID file\n"));
1427 if ((code = afs_uuid_create(&FS_HostUUID))) {
1428 ViceLog(0, ("Failed to create new uuid: %d\n", code));
1432 /* A good sysid file exists; inform the vlserver. If any conflicts,
1433 * we always use the latest interface available as the real truth.
1435 #ifndef AFS_NT40_ENV
1436 if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || AFSDIR_SERVER_NETINFO_FILEPATH) {
1438 * Find addresses we are supposed to register as per the netrestrict
1439 * and netinfo files (/usr/afs/local/NetInfo and
1440 * /usr/afs/local/NetRestict)
1443 afs_int32 code = parseNetFiles(FS_HostAddrs, NULL, NULL,
1444 ADDRSPERSITE, reason,
1445 AFSDIR_SERVER_NETINFO_FILEPATH,
1446 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
1448 ViceLog(0, ("Can't register any valid addresses: %s\n", reason));
1451 FS_HostAddr_cnt = (afs_uint32) code;
1455 FS_HostAddr_cnt = rx_getAllAddr(FS_HostAddrs, ADDRSPERSITE);
1459 code = Do_VLRegisterRPC();
1464 main(int argc, char *argv[])
1470 struct rx_securityClass *sc[4];
1471 struct rx_service *tservice;
1472 #ifdef AFS_PTHREAD_ENV
1473 pthread_t parentPid, serverPid;
1474 pthread_attr_t tattr;
1475 #else /* AFS_PTHREAD_ENV */
1476 PROCESS parentPid, serverPid;
1477 #endif /* AFS_PTHREAD_ENV */
1479 int minVnodesRequired; /* min size of vnode cache */
1480 #ifndef AFS_NT40_ENV
1481 struct rlimit rlim; /* max number of open file descriptors */
1485 #ifdef AFS_AIX32_ENV
1486 struct sigaction nsa;
1488 sigemptyset(&nsa.sa_mask);
1489 nsa.sa_handler = SIG_DFL;
1490 nsa.sa_flags = SA_FULLDUMP;
1491 sigaction(SIGABRT, &nsa, NULL);
1492 sigaction(SIGSEGV, &nsa, NULL);
1495 /* Initialize dirpaths */
1496 if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
1498 ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
1500 fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
1504 #ifndef AFS_QUIETFS_ENV
1505 console = fopen("/dev/console", "w");
1508 if (ParseArgs(argc, argv)) {
1512 #ifdef AFS_PTHREAD_ENV
1513 assert(pthread_mutex_init(&fileproc_glock_mutex, NULL) == 0);
1514 #endif /* AFS_PTHREAD_ENV */
1516 #ifdef AFS_SGI_VNODE_GLUE
1517 if (afs_init_kernel_config(-1) < 0) {
1519 ("Can't determine NUMA configuration, not starting fileserver.\n");
1523 confDir = afsconf_Open(AFSDIR_SERVER_ETC_DIRPATH);
1525 fprintf(stderr, "Unable to open config directory %s\n",
1526 AFSDIR_SERVER_ETC_DIRPATH);
1532 /* Open FileLog on stdout, stderr, fd 1 and fd2 (for perror), sigh. */
1533 serverLogSyslogTag = "fileserver";
1534 OpenLog(AFSDIR_SERVER_FILELOG_FILEPATH);
1537 if (SawSpare && SawPctSpare) {
1538 ViceLog(0, ("Both -spare and -pctspare specified, exiting.\n"));
1541 #ifdef AFS_SGI_XFS_IOPS_ENV
1542 ViceLog(0, ("XFS/EFS File server starting\n"));
1544 ViceLog(0, ("File server starting\n"));
1547 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
1548 /* initialize the pthread soft signal handler thread */
1552 /* install signal handlers for controlling the fileserver process */
1553 ResetCheckSignal(); /* set CheckSignal_Signal() sig handler */
1554 ResetCheckDescriptors(); /* set CheckDescriptors_Signal() sig handler */
1556 #if defined(AFS_SGI_ENV)
1557 /* give this guy a non-degrading priority so help busy servers */
1558 schedctl(NDPRI, 0, NDPNORMMAX);
1562 #ifndef AFS_NT40_ENV
1563 nice(-5); /* TODO: */
1566 assert(DInit(buffs) == 0);
1569 if (afs_winsockInit() < 0) {
1570 ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
1571 ViceLog(0, ("File server failed to intialize winsock.\n"));
1577 /* if we support more than 16 threads, then we better have the ability
1578 ** to keep open a large number of files simultaneously
1580 #if defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV)
1581 curLimit = OPEN_MAX; /* for pre AIX 4.2 systems */
1582 #elif defined(AFS_NT40_ENV)
1583 curLimit = NT_OPEN_MAX; /* open file descriptor limit on NT */
1586 curLimit = 0; /* the number of open file descriptors */
1587 code = getrlimit(RLIMIT_NOFILE, &rlim);
1589 curLimit = rlim.rlim_cur;
1590 rlim.rlim_cur = rlim.rlim_max;
1591 code = setrlimit(RLIMIT_NOFILE, &rlim);
1593 curLimit = rlim.rlim_max;
1596 ViceLog(0, ("Failed to increase open file limit, using default\n"));
1598 #endif /* defined(AFS_AIX_ENV) && !defined(AFS_AIX42_ENV) */
1600 curLimit -= 32; /* leave a slack of 32 file descriptors */
1601 if (lwps > curLimit) {
1605 lwps = 16; /* default to a maximum of 16 threads */
1607 ("The system supports a max of %d open files and we are starting %d threads\n",
1610 #ifndef AFS_PTHREAD_ENV
1611 assert(LWP_InitializeProcessSupport(LWP_MAX_PRIORITY - 2, &parentPid) ==
1613 #endif /* !AFS_PTHREAD_ENV */
1615 /* Initialize volume support */
1617 V_BreakVolumeCallbacks = BreakVolumeCallBacksLater;
1620 /* initialize libacl routines */
1621 acl_Initialize(ACL_VERSION);
1623 /* initialize RX support */
1624 #ifndef AFS_NT40_ENV
1625 rxi_syscallp = viced_syscall;
1627 rx_extraPackets = rxpackets;
1628 rx_extraQuota = 4; /* for outgoing prserver calls from R threads */
1629 rx_SetBusyThreshold(busy_threshold, VBUSY);
1630 rx_SetCallAbortThreshold(abort_threshold);
1631 rx_SetConnAbortThreshold(abort_threshold);
1632 stackSize = lwps * 4000;
1633 if (stackSize < 32000)
1635 else if (stackSize > 44000)
1637 #if defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV) || defined(AFS_SGI51_ENV)
1638 rx_SetStackSize(1, stackSize);
1641 rx_SetUdpBufSize(udpBufSize); /* set the UDP buffer size for receive */
1642 if (rx_Init((int)htons(7000)) < 0) {
1643 ViceLog(0, ("Cannot initialize RX\n"));
1646 if (!rxJumbograms) {
1647 /* Don't send and don't allow 3.4 clients to send jumbograms. */
1651 rx_SetRxDeadTime(30);
1652 sc[0] = rxnull_NewServerSecurityObject();
1653 sc[1] = 0; /* rxvab_NewServerSecurityObject(key1, 0) */
1654 sc[2] = rxkad_NewServerSecurityObject(rxkad_clear, NULL, get_key, NULL);
1655 sc[3] = rxkad_NewServerSecurityObject(rxkad_crypt, NULL, get_key, NULL);
1657 rx_NewService( /* port */ 0, /* service id */ 1, /*service name */
1659 /* security classes */ sc, /* numb sec classes */ 4,
1660 RXAFS_ExecuteRequest);
1663 ("Failed to initialize RX, probably two servers running.\n"));
1666 rx_SetDestroyConnProc(tservice, (void (*)())h_FreeConnection);
1667 rx_SetMinProcs(tservice, 3);
1668 rx_SetMaxProcs(tservice, lwps);
1669 rx_SetCheckReach(tservice, 1);
1672 rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", sc, 4,
1673 RXSTATS_ExecuteRequest);
1675 ViceLog(0, ("Failed to initialize rpc stat service.\n"));
1678 rx_SetMinProcs(tservice, 2);
1679 rx_SetMaxProcs(tservice, 4);
1682 * Enable RX hot threads, which allows the listener thread to trade
1683 * places with an idle thread and moves the context switch from listener
1684 * to worker out of the critical path.
1686 rx_EnableHotThread();
1688 /* Some rx debugging */
1689 if (rxlog || eventlog) {
1690 debugFile = fopen("rx_dbg", "w");
1692 rx_debugFile = debugFile;
1694 rxevent_debugFile = debugFile;
1697 init_sys_error_to_et(); /* Set up error table translation */
1698 h_InitHostPackage(); /* set up local cellname and realmname */
1699 InitCallBack(numberofcbs);
1704 ViceLog(0, ("Fatal error in library initialization, exiting!!\n"));
1710 ViceLog(0, ("Fatal error in protection initialization, exiting!!\n"));
1714 /* allow super users to manage RX statistics */
1715 rx_SetRxStatUserOk(fs_rxstat_userok);
1717 rx_StartServer(0); /* now start handling requests */
1719 /* we ensure that there is enough space in the vnode buffer to satisfy
1720 ** requests from all concurrent threads.
1721 ** the maximum number of vnodes used by a single thread at any one time
1722 ** is three ( "link" uses three vnodes simultaneously, one vLarge and
1723 ** two vSmall for linking files and two vLarge and one vSmall for linking
1726 minVnodesRequired = 2 * lwps + 1;
1727 if (minVnodesRequired > nSmallVns) {
1728 nSmallVns = minVnodesRequired;
1730 ("Overriding -s command line parameter with %d\n",
1733 if (minVnodesRequired > large) {
1734 large = minVnodesRequired;
1735 ViceLog(0, ("Overriding -l command line parameter with %d\n", large));
1738 /* We now do this after getting the listener up and running, so that client
1739 * connections don't timeout (maybe) if a file server is restarted, since it
1740 * will be available "real soon now". Worry about whether we can satisfy the
1741 * calls in the volume package itself.
1743 if (VInitVolumePackage(fileServer, large, nSmallVns, 0, volcache)) {
1745 ("Shutting down: errors encountered initializing volume package\n"));
1751 * We are done calling fopen/fdopen. It is safe to use a large
1752 * of the file descriptor cache.
1756 #ifdef AFS_PTHREAD_ENV
1757 ViceLog(5, ("Starting pthreads\n"));
1758 assert(pthread_attr_init(&tattr) == 0);
1759 assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
1761 assert(pthread_create
1762 (&serverPid, &tattr, (void *)FiveMinuteCheckLWP,
1763 &fiveminutes) == 0);
1764 assert(pthread_create
1765 (&serverPid, &tattr, (void *)HostCheckLWP, &fiveminutes) == 0);
1766 assert(pthread_create
1767 (&serverPid, &tattr, (void *)FsyncCheckLWP, &fiveminutes) == 0);
1768 #else /* AFS_PTHREAD_ENV */
1769 ViceLog(5, ("Starting LWP\n"));
1770 assert(LWP_CreateProcess
1771 (FiveMinuteCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
1772 (void *)&fiveminutes, "FiveMinuteChecks",
1773 &serverPid) == LWP_SUCCESS);
1775 assert(LWP_CreateProcess
1776 (HostCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
1777 (void *)&fiveminutes, "HostCheck", &serverPid) == LWP_SUCCESS);
1778 assert(LWP_CreateProcess
1779 (FsyncCheckLWP, stack * 1024, LWP_MAX_PRIORITY - 2,
1780 (void *)&fiveminutes, "FsyncCheck", &serverPid) == LWP_SUCCESS);
1781 #endif /* AFS_PTHREAD_ENV */
1783 TM_GetTimeOfDay(&tp, 0);
1785 #ifndef AFS_QUIETFS_ENV
1786 if (console != NULL) {
1787 fprintf(console, "File server has started at %s\r",
1788 afs_ctime(&tp.tv_sec, tbuffer, sizeof(tbuffer)));
1793 * Figure out the FileServer's name and primary address.
1795 ViceLog(0, ("Getting FileServer name...\n"));
1796 code = gethostname(FS_HostName, 64);
1798 ViceLog(0, ("gethostname() failed\n"));
1800 ViceLog(0, ("FileServer host name is '%s'\n", FS_HostName));
1802 ViceLog(0, ("Getting FileServer address...\n"));
1803 he = gethostbyname(FS_HostName);
1805 ViceLog(0, ("Can't find address for FileServer '%s'\n", FS_HostName));
1808 memcpy(&FS_HostAddr_NBO, he->h_addr, 4);
1809 afs_inet_ntoa_r(FS_HostAddr_NBO, hoststr);
1810 FS_HostAddr_HBO = ntohl(FS_HostAddr_NBO);
1812 ("FileServer %s has address %s (0x%x or 0x%x in host byte order)\n",
1813 FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
1816 /* Install handler to catch the shutdown signal;
1817 * bosserver assumes SIGQUIT shutdown
1819 #if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
1820 softsig_signal(SIGQUIT, ShutDown_Signal);
1822 signal(SIGQUIT, ShutDown_Signal);
1826 ("File Server started %s",
1827 afs_ctime(&tp.tv_sec, tbuffer, sizeof(tbuffer))));
1828 #if FS_STATS_DETAILED
1829 afs_FullPerfStats.det.epoch.tv_sec = StartTime = tp.tv_sec;
1831 #ifdef AFS_PTHREAD_ENV
1833 sleep(1000); /* long time */
1835 #else /* AFS_PTHREAD_ENV */
1836 assert(LWP_WaitProcess(&parentPid) == LWP_SUCCESS);
1837 #endif /* AFS_PTHREAD_ENV */