afsconf: Rework security flags
[openafs.git] / src / volser / volmain.c
index 592a1f3..f90b020 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
@@ -10,6 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <sys/types.h>
 #include <string.h>
 #include <afs/afsint.h>
 #include <stdio.h>
 #include <signal.h>
-#ifdef AFS_PTHREAD_ENV
-#include <assert.h>
-#else /* AFS_PTHREAD_ENV */
-#include <afs/assert.h>
-#endif /* AFS_PTHREAD_ENV */
+#include <afs/afs_assert.h>
 #include <afs/prs_fs.h>
 #include <afs/nfs.h>
 #include <lwp.h>
@@ -84,7 +81,7 @@ struct volser_trans *QI_GlobalWriteTrans = 0;
 struct afsconf_dir *tdir;
 static afs_int32 runningCalls = 0;
 int DoLogging = 0;
-int debuglevel = 0; 
+int debuglevel = 0;
 #define MAXLWP 128
 int lwps = 9;
 int udpBufSize = 0;            /* UDP buffer size for receive */
@@ -127,7 +124,7 @@ MyAfterProc(struct rx_call *acall, afs_int32 code)
 }
 
 /* Called every GCWAKEUP seconds to try to unlock all our partitions,
- * if we're idle and there are no active transactions 
+ * if we're idle and there are no active transactions
  */
 static void
 TryUnlock(void)
@@ -153,7 +150,11 @@ BKGLoop(void *unused)
        tv.tv_sec = GCWAKEUP;
        tv.tv_usec = 0;
 #ifdef AFS_PTHREAD_ENV
+#ifdef AFS_NT40_ENV
+        Sleep(GCWAKEUP * 1000);
+#else
         select(0, 0, 0, 0, &tv);
+#endif
 #else
        (void)IOMGR_Select(0, 0, 0, 0, &tv);
 #endif
@@ -209,7 +210,21 @@ BKGSleep(void *unused)
 }
 #endif
 
-#ifndef AFS_NT40_ENV
+#ifdef AFS_NT40_ENV
+/* no volser_syscall */
+#elif defined(AFS_SUN511_ENV)
+int
+volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
+{
+    int err, code;
+    code = ioctl_sun_afs_syscall(28 /* AFSCALL_CALL */, a3, a4, a5, 0, 0, 0,
+                                 &err);
+    if (code) {
+       err = code;
+    }
+    return err;
+}
+#else
 int
 volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
 {
@@ -239,10 +254,10 @@ vol_rxstat_userok(struct rx_call *call)
 }
 
 #include "AFS_component_version_number.c"
-int 
+int
 main(int argc, char **argv)
 {
-    register afs_int32 code;
+    afs_int32 code;
     struct rx_securityClass **securityClasses;
     afs_int32 numClasses;
     struct rx_service *service;
@@ -257,8 +272,8 @@ main(int argc, char **argv)
 
 #ifdef AFS_AIX32_ENV
     /*
-     * The following signal action for AIX is necessary so that in case of a 
-     * crash (i.e. core is generated) we can include the user's data section 
+     * The following signal action for AIX is necessary so that in case of a
+     * crash (i.e. core is generated) we can include the user's data section
      * in the core dump. Unfortunately, by default, only a partial core is
      * generated which, in many cases, isn't too useful.
      */
@@ -298,8 +313,8 @@ main(int argc, char **argv)
            rxkadDisableDotCheck = 1;
        } else if (strcmp(argv[code], "-d") == 0) {
            if ((code + 1) >= argc) {
-               fprintf(stderr, "missing argument for -d\n"); 
-               return -1; 
+               fprintf(stderr, "missing argument for -d\n");
+               return -1;
            }
            debuglevel = atoi(argv[++code]);
            LogLevel = debuglevel;
@@ -326,14 +341,14 @@ main(int argc, char **argv)
            rxJumbograms = 1;
        } else if (!strcmp(argv[code], "-rxmaxmtu")) {
            if ((code + 1) >= argc) {
-               fprintf(stderr, "missing argument for -rxmaxmtu\n"); 
-               exit(1); 
+               fprintf(stderr, "missing argument for -rxmaxmtu\n");
+               exit(1);
            }
            rxMaxMTU = atoi(argv[++code]);
-           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) || 
+           if ((rxMaxMTU < RX_MIN_PACKET_SIZE) ||
                (rxMaxMTU > RX_MAX_PACKET_DATA_SIZE)) {
                printf("rxMaxMTU %d invalid; must be between %d-%" AFS_SIZET_FMT "\n",
-                      rxMaxMTU, RX_MIN_PACKET_SIZE, 
+                      rxMaxMTU, RX_MIN_PACKET_SIZE,
                       RX_MAX_PACKET_DATA_SIZE);
                exit(1);
            }
@@ -440,18 +455,18 @@ main(int argc, char **argv)
        rx_SetUdpBufSize(udpBufSize);   /* set the UDP buffer size for receive */
     if (rxBind) {
        afs_int32 ccode;
-        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH || 
+        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
             AFSDIR_SERVER_NETINFO_FILEPATH) {
             char reason[1024];
             ccode = parseNetFiles(SHostAddrs, NULL, NULL,
                                            ADDRSPERSITE, reason,
                                            AFSDIR_SERVER_NETINFO_FILEPATH,
                                            AFSDIR_SERVER_NETRESTRICT_FILEPATH);
-        } else 
+        } else
        {
             ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
         }
-        if (ccode == 1) 
+        if (ccode == 1)
             host = SHostAddrs[0];
     }
 
@@ -478,10 +493,10 @@ main(int argc, char **argv)
 #ifdef AFS_PTHREAD_ENV
        pthread_t tid;
        pthread_attr_t tattr;
-       assert(pthread_attr_init(&tattr) == 0);
-       assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
+       osi_Assert(pthread_attr_init(&tattr) == 0);
+       osi_Assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
 
-       assert(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0);
+       osi_Assert(pthread_create(&tid, &tattr, BKGLoop, NULL) == 0);
 #else
        PROCESS pid;
        LWP_CreateProcess(BKGLoop, 16*1024, 3, 0, "vol bkg daemon", &pid);
@@ -498,7 +513,7 @@ main(int argc, char **argv)
        VS_EXIT(1);
     }
     afsconf_GetKey(tdir, 999, &tkey);
-    afsconf_BuildServerSecurityObjects(tdir, 0, &securityClasses, &numClasses);
+    afsconf_BuildServerSecurityObjects(tdir, &securityClasses, &numClasses);
     if (securityClasses[0] == NULL)
        Abort("rxnull_NewServerSecurityObject");
     service =