ubik-serverinit-clones-correction-20081222
[openafs.git] / src / vlserver / vlserver.c
index 609787d..02a30b0 100644 (file)
@@ -60,13 +60,14 @@ afs_uint32 HostAddress[MAXSERVERID + 1];
 extern int afsconf_CheckAuth();
 extern int afsconf_ServerAuth();
 
-static CheckSignal();
+static void *CheckSignal(void*);
 int LogLevel = 0;
 int smallMem = 0;
-int rxJumbograms = 1;          /* default is to send and receive jumbo grams */
+int rxJumbograms = 0;          /* default is to not send and receive jumbo grams */
 int rxMaxMTU = -1;
 afs_int32 rxBind = 0;
 int rxkadDisableDotCheck = 0;
+int debuglevel = 0;
 
 #define ADDRSPERSITE 16         /* Same global is in rx/rx_user.c */
 afs_uint32 SHostAddrs[ADDRSPERSITE];
@@ -74,18 +75,22 @@ afs_uint32 SHostAddrs[ADDRSPERSITE];
 static void
 CheckSignal_Signal()
 {
+#if defined(AFS_PTHREAD_ENV)
+    CheckSignal(0);
+#else
     IOMGR_SoftSig(CheckSignal, 0);
+#endif
 }
 
-static
-CheckSignal()
+static void *
+CheckSignal(void *unused)
 {
     register int i, errorcode;
     struct ubik_trans *trans;
 
     if (errorcode =
        Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
-       return errorcode;
+       return (void *)errorcode;
     VLog(0, ("Dump name hash table out\n"));
     for (i = 0; i < HASHSIZE; i++) {
        HashNDump(trans, i);
@@ -94,7 +99,7 @@ CheckSignal()
     for (i = 0; i < HASHSIZE; i++) {
        HashIdDump(trans, i);
     }
-    return (ubik_EndTrans(trans));
+    return ((void *)ubik_EndTrans(trans));
 }                              /*CheckSignal */
 
 
@@ -166,7 +171,6 @@ main(argc, argv)
     for (index = 1; index < argc; index++) {
        if (strcmp(argv[index], "-noauth") == 0) {
            noAuth = 1;
-
        } else if (strcmp(argv[index], "-p") == 0) {
            lwps = atoi(argv[++index]);
            if (lwps > MAXLWP) {
@@ -174,10 +178,17 @@ main(argc, argv)
                       lwps, MAXLWP);
                lwps = MAXLWP;
            }
-
+       } else if (strcmp(argv[index], "-d") == 0) {
+           if ((index + 1) >= argc) {
+               fprintf(stderr, "missing argument for -d\n"); 
+               return -1; 
+           }
+           debuglevel = atoi(argv[++index]);
+           LogLevel = debuglevel;
        } else if (strcmp(argv[index], "-nojumbo") == 0) {
            rxJumbograms = 0;
-
+       } else if (strcmp(argv[index], "-jumbo") == 0) {
+           rxJumbograms = 1;
        } else if (strcmp(argv[index], "-rxbind") == 0) {
            rxBind = 1;
        } else if (strcmp(argv[index], "-allow-dotted-principals") == 0) {
@@ -187,7 +198,7 @@ main(argc, argv)
                fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
                return -1; 
            }
-           rxMaxMTU = atoi(argv[++i]);
+           rxMaxMTU = atoi(argv[++index]);
            if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
                (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
                printf("rxMaxMTU %d invalid; must be between %d-%d\n",
@@ -204,34 +215,9 @@ main(argc, argv)
            strcpy(rxi_tracename, argv[++index]);
 
        } else if (strcmp(argv[index], "-auditlog") == 0) {
-          int tempfd, flags;
-           FILE *auditout;
-           char oldName[MAXPATHLEN];
            char *fileName = argv[++index];
 
-#ifndef AFS_NT40_ENV
-           struct stat statbuf;
-
-           if ((lstat(fileName, &statbuf) == 0) 
-               && (S_ISFIFO(statbuf.st_mode))) {
-               flags = O_WRONLY | O_NONBLOCK;
-           } else 
-#endif
-           {
-               strcpy(oldName, fileName);
-               strcat(oldName, ".old");
-               renamefile(fileName, oldName);
-               flags = O_WRONLY | O_TRUNC | O_CREAT;
-           }
-           tempfd = open(fileName, flags, 0666);
-           if (tempfd > -1) {
-               auditout = fdopen(tempfd, "a");
-               if (auditout) {
-                   osi_audit_file(auditout);
-               } else
-                   printf("Warning: auditlog %s not writable, ignored.\n", fileName);
-           } else
-               printf("Warning: auditlog %s not writable, ignored.\n", fileName);
+           osi_audit_file(fileName);
        } else if (strcmp(argv[index], "-enable_peer_stats") == 0) {
            rx_enablePeerRPCStats();
        } else if (strcmp(argv[index], "-enable_process_stats") == 0) {
@@ -249,14 +235,14 @@ main(argc, argv)
 #ifndef AFS_NT40_ENV
            printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
                   "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals] "
-                  "[-auditlog <log path>] "
+                  "[-auditlog <log path>] [-jumbo] [-d <debug level>] "
                   "[-syslog[=FACILITY]] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
 #else
            printf("Usage: vlserver [-p <number of processes>] [-nojumbo] "
                   "[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals] "
-                  "[-auditlog <log path>] "
+                  "[-auditlog <log path>] [-jumbo] [-d <debug level>] "
                   "[-enable_peer_stats] [-enable_process_stats] "
                   "[-help]\n");
 #endif
@@ -355,7 +341,7 @@ main(argc, argv)
     ubik_CheckRXSecurityProc = afsconf_CheckAuth;
     ubik_CheckRXSecurityRock = (char *)tdir;
     code =
-       ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, &clones,
+       ubik_ServerInitByInfo(myHost, htons(AFSCONF_VLDBPORT), &info, clones,
                              vl_dbaseName, &VL_dbase);
     if (code) {
        printf("vlserver: Ubik init failed with code %d\n", code);
@@ -390,8 +376,7 @@ main(argc, argv)
 
     if (rxkadDisableDotCheck) {
         rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
-                                    (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK,
-                                    NULL);
+                                    (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
     }
 
     tservice =