volser: preserve volume stats by default
[openafs.git] / src / volser / volmain.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
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
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 #include <roken.h>
14 #include <afs/opr.h>
15 #ifdef AFS_PTHREAD_ENV
16 # include <opr/lock.h>
17 # include <opr/softsig.h>
18 # include <afs/procmgmt_softsig.h> /* must come after softsig */
19 #endif
20
21 #ifdef AFS_NT40_ENV
22 #include <windows.h>
23 #include <WINNT/afsevent.h>
24 #endif
25
26 #include <rx/rx_queue.h>
27 #include <afs/afsint.h>
28 #include <afs/prs_fs.h>
29 #include <afs/nfs.h>
30 #include <lwp.h>
31 #include <lock.h>
32 #include <afs/afssyscalls.h>
33 #include <afs/ihandle.h>
34 #ifdef AFS_NT40_ENV
35 #include <afs/ntops.h>
36 #endif
37 #include <afs/vnode.h>
38 #include <afs/volume.h>
39 #include <afs/partition.h>
40 #include <rx/rx.h>
41 #include <rx/rxstat.h>
42 #include <rx/rx_globals.h>
43 #include <afs/auth.h>
44 #include <afs/cellconfig.h>
45 #include <afs/keys.h>
46 #include <afs/dir.h>
47 #include <ubik.h>
48 #include <afs/audit.h>
49 #include <afs/afsutil.h>
50 #include <afs/cmd.h>
51 #include <lwp.h>
52
53 #include "volser.h"
54 #include "volint.h"
55 #include "volser_internal.h"
56
57 #define VolserVersion "2.0"
58 #define N_SECURITY_OBJECTS 3
59
60 extern struct Lock localLock;
61 char *GlobalNameHack = NULL;
62 int hackIsIn = 0;
63 afs_int32 GlobalVolCloneId, GlobalVolParentId;
64 int GlobalVolType;
65 int VolumeChanged;              /* XXXX */
66 static char busyFlags[MAXHELPERS];
67 struct volser_trans *QI_GlobalWriteTrans = 0;
68 struct afsconf_dir *tdir;
69 static afs_int32 runningCalls = 0;
70 int DoLogging = 0;
71 int debuglevel = 0;
72 #define MAXLWP 128
73 int lwps = 9;
74 int udpBufSize = 0;             /* UDP buffer size for receive */
75 int restrictedQueryLevel = RESTRICTED_QUERY_ANYUSER;
76
77 int rxBind = 0;
78 int rxkadDisableDotCheck = 0;
79 int DoPreserveVolumeStats = 1;
80 int rxJumbograms = 0;   /* default is to not send and receive jumbograms. */
81 int rxMaxMTU = -1;
82 char *auditFileName = NULL;
83 static struct logOptions logopts;
84 char *configDir = NULL;
85
86 enum vol_s2s_crypt doCrypt = VS2SC_NEVER;
87
88 #define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */
89 afs_uint32 SHostAddrs[ADDRSPERSITE];
90
91 #define VS_EXIT(code)  {                                          \
92                           osi_audit(VS_ExitEvent, code, AUD_END); \
93                           exit(code);                             \
94                        }
95
96 static void
97 MyBeforeProc(struct rx_call *acall)
98 {
99     VTRANS_LOCK;
100     runningCalls++;
101     VTRANS_UNLOCK;
102     return;
103 }
104
105 static void
106 MyAfterProc(struct rx_call *acall, afs_int32 code)
107 {
108     VTRANS_LOCK;
109     runningCalls--;
110     VTRANS_UNLOCK;
111     return;
112 }
113
114 /* Called every GCWAKEUP seconds to try to unlock all our partitions,
115  * if we're idle and there are no active transactions
116  */
117 static void
118 TryUnlock(void)
119 {
120     /* if there are no running calls, and there are no active transactions, then
121      * it should be safe to release any partition locks we've accumulated */
122     VTRANS_LOCK;
123     if (runningCalls == 0 && TransList() == (struct volser_trans *)0) {
124         VTRANS_UNLOCK;
125         VPFullUnlock();         /* in volprocs.c */
126     } else
127         VTRANS_UNLOCK;
128 }
129
130 /* background daemon for timing out transactions */
131 static void*
132 BKGLoop(void *unused)
133 {
134     struct timeval tv;
135     int loop = 0;
136
137     afs_pthread_setname_self("vol bkg");
138     while (1) {
139         tv.tv_sec = GCWAKEUP;
140         tv.tv_usec = 0;
141 #ifdef AFS_PTHREAD_ENV
142 #ifdef AFS_NT40_ENV
143         Sleep(GCWAKEUP * 1000);
144 #else
145         select(0, 0, 0, 0, &tv);
146 #endif
147 #else
148         (void)IOMGR_Select(0, 0, 0, 0, &tv);
149 #endif
150         GCTrans();
151         TryUnlock();
152         loop++;
153         if (loop == 10) {       /* reopen log every 5 minutes */
154             loop = 0;
155             ReOpenLog();
156         }
157     }
158
159     return NULL;
160 }
161
162 #if defined(AFS_NT40_ENV) || defined(AFS_DARWIN160_ENV)
163 /* no volser_syscall */
164 #elif defined(AFS_SUN511_ENV)
165 int
166 volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
167 {
168     int err, code;
169     code = ioctl_sun_afs_syscall(28 /* AFSCALL_CALL */, a3, a4, a5, 0, 0, 0,
170                                  &err);
171     if (code) {
172         err = code;
173     }
174     return err;
175 }
176 #else
177 int
178 volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
179 {
180     afs_uint32 rcode;
181 #ifndef AFS_LINUX20_ENV
182     void (*old) (int);
183
184     old = signal(SIGSYS, SIG_IGN);
185 #endif
186     rcode =
187         syscall(AFS_SYSCALL /* AFS_SYSCALL */ , 28 /* AFSCALL_CALL */ , a3,
188                 a4, a5);
189 #ifndef AFS_LINUX20_ENV
190     signal(SIGSYS, old);
191 #endif
192
193     return rcode;
194 }
195 #endif
196
197
198 /* check whether caller is authorized to manage RX statistics */
199 int
200 vol_rxstat_userok(struct rx_call *call)
201 {
202     return afsconf_SuperUser(tdir, call, NULL);
203 }
204
205 /**
206  * Return true if this name is a member of the local realm.
207  */
208 static int
209 vol_IsLocalRealmMatch(void *rock, char *name, char *inst, char *cell)
210 {
211     struct afsconf_dir *dir = (struct afsconf_dir *)rock;
212     afs_int32 islocal = 0;      /* default to no */
213     int code;
214
215     code = afsconf_IsLocalRealmMatch(dir, &islocal, name, inst, cell);
216     if (code) {
217         ViceLog(0,
218                 ("Failed local realm check; code=%d, name=%s, inst=%s, cell=%s\n",
219                  code, name, inst, cell));
220     }
221     return islocal;
222 }
223
224 enum optionsList {
225     OPT_log,
226     OPT_rxbind,
227     OPT_dotted,
228     OPT_debug,
229     OPT_threads,
230     OPT_auditlog,
231     OPT_audit_interface,
232     OPT_nojumbo,
233     OPT_jumbo,
234     OPT_rxmaxmtu,
235     OPT_sleep,
236     OPT_udpsize,
237     OPT_peer,
238     OPT_process,
239     OPT_preserve_vol_stats,
240     OPT_clear_vol_stats,
241     OPT_sync,
242 #ifdef HAVE_SYSLOG
243     OPT_syslog,
244 #endif
245     OPT_logfile,
246     OPT_config,
247     OPT_restricted_query,
248     OPT_transarc_logs,
249     OPT_s2s_crypt
250 };
251
252 static int
253 ParseArgs(int argc, char **argv) {
254     int code;
255     int optval;
256     char *optstring = NULL;
257     struct cmd_syndesc *opts;
258     char *sleepSpec = NULL;
259     char *sync_behavior = NULL;
260     char *restricted_query_parameter = NULL;
261     char *s2s_crypt_behavior = NULL;
262
263     opts = cmd_CreateSyntax(NULL, NULL, NULL, 0, NULL);
264     cmd_AddParmAtOffset(opts, OPT_log, "-log", CMD_FLAG, CMD_OPTIONAL,
265            "log vos users");
266     cmd_AddParmAtOffset(opts, OPT_rxbind, "-rxbind", CMD_FLAG, CMD_OPTIONAL,
267            "bind only to the primary interface");
268     cmd_AddParmAtOffset(opts, OPT_dotted, "-allow-dotted-principals", CMD_FLAG, CMD_OPTIONAL,
269            "permit Kerberos 5 principals with dots");
270     cmd_AddParmAtOffset(opts, OPT_debug, "-d", CMD_SINGLE, CMD_OPTIONAL,
271            "debug level");
272     cmd_AddParmAtOffset(opts, OPT_threads, "-p", CMD_SINGLE, CMD_OPTIONAL,
273            "number of threads");
274     cmd_AddParmAtOffset(opts, OPT_auditlog, "-auditlog", CMD_SINGLE,
275            CMD_OPTIONAL, "location of audit log");
276     cmd_AddParmAtOffset(opts, OPT_audit_interface, "-audit-interface",
277            CMD_SINGLE, CMD_OPTIONAL, "interface to use for audit logging");
278     cmd_AddParmAtOffset(opts, OPT_nojumbo, "-nojumbo", CMD_FLAG, CMD_OPTIONAL,
279             "disable jumbograms");
280     cmd_AddParmAtOffset(opts, OPT_jumbo, "-jumbo", CMD_FLAG, CMD_OPTIONAL,
281             "enable jumbograms");
282     cmd_AddParmAtOffset(opts, OPT_rxmaxmtu, "-rxmaxmtu", CMD_SINGLE,
283             CMD_OPTIONAL, "maximum MTU for RX");
284     cmd_AddParmAtOffset(opts, OPT_udpsize, "-udpsize", CMD_SINGLE,
285             CMD_OPTIONAL, "size of socket buffer in bytes");
286     cmd_AddParmAtOffset(opts, OPT_sleep, "-sleep", CMD_SINGLE,
287             CMD_OPTIONAL, "make background daemon sleep (LWP only)");
288     cmd_AddParmAtOffset(opts, OPT_peer, "-enable_peer_stats", CMD_FLAG,
289             CMD_OPTIONAL, "enable RX transport statistics");
290     cmd_AddParmAtOffset(opts, OPT_process, "-enable_process_stats", CMD_FLAG,
291             CMD_OPTIONAL, "enable RX RPC statistics");
292     /* -preserve-vol-stats on by default now. */
293     cmd_AddParmAtOffset(opts, OPT_preserve_vol_stats, "-preserve-vol-stats", CMD_FLAG,
294             CMD_OPTIONAL|CMD_HIDDEN,
295             "preserve volume statistics when restoring/recloning");
296     cmd_AddParmAtOffset(opts, OPT_clear_vol_stats, "-clear-vol-stats", CMD_FLAG,
297             CMD_OPTIONAL, "clear volume statistics when restoring/recloning");
298 #ifdef HAVE_SYSLOG
299     cmd_AddParmAtOffset(opts, OPT_syslog, "-syslog", CMD_SINGLE_OR_FLAG,
300             CMD_OPTIONAL, "log to syslog");
301 #endif
302     cmd_AddParmAtOffset(opts, OPT_transarc_logs, "-transarc-logs", CMD_FLAG,
303                         CMD_OPTIONAL, "enable Transarc style logging");
304     cmd_AddParmAtOffset(opts, OPT_sync, "-sync",
305             CMD_SINGLE, CMD_OPTIONAL, "always | onclose | never");
306     cmd_AddParmAtOffset(opts, OPT_logfile, "-logfile", CMD_SINGLE,
307            CMD_OPTIONAL, "location of log file");
308     cmd_AddParmAtOffset(opts, OPT_config, "-config", CMD_SINGLE,
309            CMD_OPTIONAL, "configuration location");
310     cmd_AddParmAtOffset(opts, OPT_restricted_query, "-restricted_query",
311             CMD_SINGLE, CMD_OPTIONAL, "anyuser | admin");
312     cmd_AddParmAtOffset(opts, OPT_s2s_crypt, "-s2scrypt",
313             CMD_SINGLE, CMD_OPTIONAL, "always | inherit | never");
314
315     code = cmd_Parse(argc, argv, &opts);
316     if (code == CMD_HELP) {
317         exit(0);
318     }
319     if (code)
320         return 1;
321
322     cmd_OptionAsFlag(opts, OPT_log, &DoLogging);
323     cmd_OptionAsFlag(opts, OPT_rxbind, &rxBind);
324     cmd_OptionAsFlag(opts, OPT_dotted, &rxkadDisableDotCheck);
325     if (cmd_OptionPresent(opts, OPT_clear_vol_stats))
326         DoPreserveVolumeStats = 0;
327     if (cmd_OptionPresent(opts, OPT_peer))
328         rx_enablePeerRPCStats();
329     if (cmd_OptionPresent(opts, OPT_process))
330         rx_enableProcessRPCStats();
331     if (cmd_OptionPresent(opts, OPT_nojumbo))
332         rxJumbograms = 0;
333     if (cmd_OptionPresent(opts, OPT_jumbo))
334         rxJumbograms = 1;
335
336 #ifdef HAVE_SYSLOG
337     if (cmd_OptionPresent(opts, OPT_syslog)) {
338         if (cmd_OptionPresent(opts, OPT_logfile)) {
339             fprintf(stderr, "Invalid options: -syslog and -logfile are exclusive.\n");
340             return -1;
341         }
342         if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
343             fprintf(stderr, "Invalid options: -syslog and -transarc-logs are exclusive.\n");
344             return -1;
345         }
346         logopts.lopt_dest = logDest_syslog;
347         logopts.lopt_facility = LOG_DAEMON;
348         logopts.lopt_tag = "volserver";
349         cmd_OptionAsInt(opts, OPT_syslog, &logopts.lopt_facility);
350     } else
351 #endif
352     {
353         logopts.lopt_dest = logDest_file;
354         if (cmd_OptionPresent(opts, OPT_transarc_logs)) {
355             logopts.lopt_rotateOnOpen = 1;
356             logopts.lopt_rotateStyle = logRotate_old;
357         }
358         if (cmd_OptionPresent(opts, OPT_logfile))
359             cmd_OptionAsString(opts, OPT_logfile, (char**)&logopts.lopt_filename);
360         else
361             logopts.lopt_filename = AFSDIR_SERVER_VOLSERLOG_FILEPATH;
362     }
363     cmd_OptionAsInt(opts, OPT_debug, &logopts.lopt_logLevel);
364
365     cmd_OptionAsInt(opts, OPT_rxmaxmtu, &rxMaxMTU);
366     if (cmd_OptionAsInt(opts, OPT_udpsize, &optval) == 0) {
367         if (optval < rx_GetMinUdpBufSize()) {
368             printf("Warning:udpsize %d is less than minimum %d; ignoring\n",
369                     optval, rx_GetMinUdpBufSize());
370         } else
371             udpBufSize = optval;
372     }
373     cmd_OptionAsString(opts, OPT_auditlog, &auditFileName);
374
375     if (cmd_OptionAsString(opts, OPT_audit_interface, &optstring) == 0) {
376         if (osi_audit_interface(optstring)) {
377             printf("Invalid audit interface '%s'\n", optstring);
378             return -1;
379         }
380         free(optstring);
381         optstring = NULL;
382     }
383     if (cmd_OptionAsInt(opts, OPT_threads, &lwps) == 0) {
384         if (lwps > MAXLWP) {
385             printf("Warning: '-p %d' is too big; using %d instead\n", lwps, MAXLWP);
386             lwps = MAXLWP;
387         }
388     }
389     if (cmd_OptionAsString(opts, OPT_sleep, &sleepSpec) == 0) {
390         printf("Warning: -sleep option ignored; this option is obsolete\n");
391     }
392     if (cmd_OptionAsString(opts, OPT_sync, &sync_behavior) == 0) {
393         if (ih_SetSyncBehavior(sync_behavior)) {
394             printf("Invalid -sync value %s\n", sync_behavior);
395             return -1;
396         }
397     }
398     cmd_OptionAsString(opts, OPT_config, &configDir);
399     if (cmd_OptionAsString(opts, OPT_restricted_query,
400                            &restricted_query_parameter) == 0) {
401         if (strcmp(restricted_query_parameter, "anyuser") == 0)
402             restrictedQueryLevel = RESTRICTED_QUERY_ANYUSER;
403         else if (strcmp(restricted_query_parameter, "admin") == 0)
404             restrictedQueryLevel = RESTRICTED_QUERY_ADMIN;
405         else {
406             printf("invalid argument for -restricted_query: %s\n",
407                    restricted_query_parameter);
408             return -1;
409         }
410         free(restricted_query_parameter);
411     }
412     if (cmd_OptionAsString(opts, OPT_s2s_crypt, &s2s_crypt_behavior) == 0) {
413         if (strcmp(s2s_crypt_behavior, "always") == 0)
414             doCrypt = VS2SC_ALWAYS;
415         else if (strcmp(s2s_crypt_behavior, "never") == 0)
416             doCrypt = VS2SC_NEVER;
417         else if (strcmp(s2s_crypt_behavior, "inherit") == 0)
418             doCrypt = VS2SC_INHERIT;
419         else {
420             printf("invalid argument for -s2scrypt: %s\n", s2s_crypt_behavior);
421             return -1;
422         }
423         free(s2s_crypt_behavior);
424     }
425
426     return 0;
427 }
428
429 #include "AFS_component_version_number.c"
430 int
431 main(int argc, char **argv)
432 {
433     afs_int32 code;
434     struct rx_securityClass **securityClasses;
435     afs_int32 numClasses;
436     struct rx_service *service;
437     int rxpackets = 100;
438     afs_uint32 host = ntohl(INADDR_ANY);
439     VolumePackageOptions opts;
440
441 #ifdef  AFS_AIX32_ENV
442     /*
443      * The following signal action for AIX is necessary so that in case of a
444      * crash (i.e. core is generated) we can include the user's data section
445      * in the core dump. Unfortunately, by default, only a partial core is
446      * generated which, in many cases, isn't too useful.
447      */
448     struct sigaction nsa;
449
450     sigemptyset(&nsa.sa_mask);
451     nsa.sa_handler = SIG_DFL;
452     nsa.sa_flags = SA_FULLDUMP;
453     sigaction(SIGABRT, &nsa, NULL);
454     sigaction(SIGSEGV, &nsa, NULL);
455 #endif
456     osi_audit_init();
457     osi_audit(VS_StartEvent, 0, AUD_END);
458
459     /* Initialize dirpaths */
460     if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
461 #ifdef AFS_NT40_ENV
462         ReportErrorEventAlt(AFSEVT_SVR_NO_INSTALL_DIR, 0, argv[0], 0);
463 #endif
464         fprintf(stderr, "%s: Unable to obtain AFS server directory.\n",
465                 argv[0]);
466         exit(2);
467     }
468
469     configDir = strdup(AFSDIR_SERVER_ETC_DIRPATH);
470
471     if (ParseArgs(argc, argv)) {
472         exit(1);
473     }
474
475     if (auditFileName) {
476         osi_audit_file(auditFileName);
477         osi_audit(VS_StartEvent, 0, AUD_END);
478     }
479 #ifdef AFS_SGI_VNODE_GLUE
480     if (afs_init_kernel_config(-1) < 0) {
481         printf
482             ("Can't determine NUMA configuration, not starting volserver.\n");
483         exit(1);
484     }
485 #endif
486     InitErrTabs();
487
488 #ifdef AFS_PTHREAD_ENV
489     SetLogThreadNumProgram( rx_GetThreadNum );
490 #endif
491
492 #ifdef AFS_NT40_ENV
493     if (afs_winsockInit() < 0) {
494         ReportErrorEventAlt(AFSEVT_SVR_WINSOCK_INIT_FAILED, 0, argv[0], 0);
495         printf("Volume server unable to start winsock, exiting.\n");
496         exit(1);
497     }
498 #endif
499
500     OpenLog(&logopts);
501
502     VOptDefaults(volumeServer, &opts);
503     if (VInitVolumePackage2(volumeServer, &opts)) {
504         Log("Shutting down: errors encountered initializing volume package\n");
505         exit(1);
506     }
507     /* For nuke() */
508     Lock_Init(&localLock);
509     DInit(40);
510 #ifndef AFS_PTHREAD_ENV
511     vol_PollProc = IOMGR_Poll;  /* tell vol pkg to poll io system periodically */
512 #endif
513 #if !defined( AFS_NT40_ENV ) && !defined(AFS_DARWIN160_ENV)
514     rxi_syscallp = volser_syscall;
515 #endif
516     rx_nPackets = rxpackets;    /* set the max number of packets */
517     if (udpBufSize)
518         rx_SetUdpBufSize(udpBufSize);   /* set the UDP buffer size for receive */
519     if (rxBind) {
520         afs_int32 ccode;
521         if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
522             AFSDIR_SERVER_NETINFO_FILEPATH) {
523             char reason[1024];
524             ccode = afsconf_ParseNetFiles(SHostAddrs, NULL, NULL,
525                                           ADDRSPERSITE, reason,
526                                           AFSDIR_SERVER_NETINFO_FILEPATH,
527                                           AFSDIR_SERVER_NETRESTRICT_FILEPATH);
528         } else
529         {
530             ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
531         }
532         if (ccode == 1)
533             host = SHostAddrs[0];
534     }
535
536     code = rx_InitHost(host, (int)htons(AFSCONF_VOLUMEPORT));
537     if (code) {
538         fprintf(stderr, "rx init failed on socket AFSCONF_VOLUMEPORT %u\n",
539                 AFSCONF_VOLUMEPORT);
540         VS_EXIT(1);
541     }
542     if (!rxJumbograms) {
543         /* Don't allow 3.4 vos clients to send jumbograms and we don't send. */
544         rx_SetNoJumbo();
545     }
546     if (rxMaxMTU != -1) {
547         if (rx_SetMaxMTU(rxMaxMTU) != 0) {
548             fprintf(stderr, "rxMaxMTU %d is invalid\n", rxMaxMTU);
549             VS_EXIT(1);
550         }
551     }
552     rx_GetIFInfo();
553     rx_SetRxDeadTime(420);
554     memset(busyFlags, 0, sizeof(busyFlags));
555
556 #ifdef AFS_PTHREAD_ENV
557     opr_softsig_Init();
558     SetupLogSoftSignals();
559 #else
560     SetupLogSignals();
561 #endif
562
563     {
564 #ifdef AFS_PTHREAD_ENV
565         pthread_t tid;
566         pthread_attr_t tattr;
567         opr_Verify(pthread_attr_init(&tattr) == 0);
568         opr_Verify(pthread_attr_setdetachstate(&tattr,
569                                                PTHREAD_CREATE_DETACHED) == 0);
570         opr_Verify(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0);
571 #else
572         PROCESS pid;
573         LWP_CreateProcess(BKGLoop, 16*1024, 3, 0, "vol bkg daemon", &pid);
574 #endif
575     }
576
577     /* Create a single security object, in this case the null security object, for unauthenticated connections, which will be used to control security on connections made to this server */
578
579     tdir = afsconf_Open(configDir);
580     if (!tdir) {
581         Abort("volser: could not open conf files in %s\n",
582               configDir);
583         VS_EXIT(1);
584     }
585
586     /* initialize audit user check */
587     osi_audit_set_user_check(tdir, vol_IsLocalRealmMatch);
588
589     afsconf_BuildServerSecurityObjects(tdir, &securityClasses, &numClasses);
590     if (securityClasses[0] == NULL)
591         Abort("rxnull_NewServerSecurityObject");
592     service =
593         rx_NewServiceHost(host, 0, VOLSERVICE_ID, "VOLSER", securityClasses,
594                           numClasses, AFSVolExecuteRequest);
595     if (service == (struct rx_service *)0)
596         Abort("rx_NewService");
597     rx_SetBeforeProc(service, MyBeforeProc);
598     rx_SetAfterProc(service, MyAfterProc);
599     rx_SetIdleDeadTime(service, 0);     /* never timeout */
600     if (lwps < 4)
601         lwps = 4;
602     rx_SetMaxProcs(service, lwps);
603 #if defined(AFS_XBSD_ENV)
604     rx_SetStackSize(service, (128 * 1024));
605 #elif defined(AFS_SGI_ENV)
606     rx_SetStackSize(service, (48 * 1024));
607 #else
608     rx_SetStackSize(service, (32 * 1024));
609 #endif
610
611     if (rxkadDisableDotCheck) {
612         rx_SetSecurityConfiguration(service, RXS_CONFIG_FLAGS,
613                                     (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
614     }
615
616     service =
617         rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", securityClasses,
618                       numClasses, RXSTATS_ExecuteRequest);
619     if (service == (struct rx_service *)0)
620         Abort("rx_NewService");
621     rx_SetMinProcs(service, 2);
622     rx_SetMaxProcs(service, 4);
623
624     LogCommandLine(argc, argv, "Volserver", VolserVersion, "Starting AFS",
625                    Log);
626     if (afsconf_GetLatestKey(tdir, NULL, NULL) == 0) {
627         LogDesWarning();
628     }
629
630     /* allow super users to manage RX statistics */
631     rx_SetRxStatUserOk(vol_rxstat_userok);
632
633     rx_StartServer(1);          /* Donate this process to the server process pool */
634
635     osi_audit(VS_FinishEvent, (-1), AUD_END);
636     Abort("StartServer returned?");
637     return 0; /* not reached */
638 }