ptuser/hpr: Don't check for a KeyFile
[openafs.git] / src / viced / host.c
index 4c7cacf..fae7a9c 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
@@ -12,6 +12,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <roken.h>
 
 #include <stdio.h>
 #include <errno.h>
@@ -27,7 +28,7 @@
 
 #include <afs/stds.h>
 #include <rx/xdr.h>
-#include <afs/assert.h>
+#include <afs/afs_assert.h>
 #include <lwp.h>
 #include <lock.h>
 #include <afs/afsint.h>
@@ -218,7 +219,7 @@ GetHTBlock(void)
     }
 #ifdef AFS_PTHREAD_ENV
     for (i = 0; i < (h_HTSPERBLOCK); i++)
-       assert(pthread_cond_init(&block->entry[i].cond, NULL) == 0);
+       CV_INIT(&block->entry[i].cond, "block entry", CV_DEFAULT, 0);
 #endif /* AFS_PTHREAD_ENV */
     for (i = 0; i < (h_HTSPERBLOCK); i++)
        Lock_Init(&block->entry[i].lock);
@@ -241,7 +242,7 @@ GetHT(void)
 
     if (HTFree == NULL)
        GetHTBlock();
-    assert(HTFree != NULL);
+    osi_Assert(HTFree != NULL);
     entry = HTFree;
     HTFree = entry->next;
     HTs++;
@@ -278,14 +279,14 @@ hpr_Initialize(struct ubik_client **uclient)
        ViceLog(0, ("hpr_Initialize: Could not open configuration directory: %s", AFSDIR_SERVER_ETC_DIRPATH));
        return -1;
     }
-    
+
     code = afsconf_GetLocalCell(tdir, cellstr, sizeof(cellstr));
     if (code) {
        ViceLog(0, ("hpr_Initialize: Could not get local cell. [%d]", code));
        afsconf_Close(tdir);
        return code;
     }
-    
+
     code = afsconf_GetCellInfo(tdir, cellstr, "afsprot", &info);
     if (code) {
        ViceLog(0, ("hpr_Initialize: Could not locate cell %s in %s/%s",
@@ -293,31 +294,29 @@ hpr_Initialize(struct ubik_client **uclient)
        afsconf_Close(tdir);
        return code;
     }
-    
+
     code = rx_Init(0);
     if (code) {
        ViceLog(0, ("hpr_Initialize: Could not initialize rx."));
        afsconf_Close(tdir);
         return code;
     }
-    
+
     /* Most callers use secLevel==1, however, the fileserver uses secLevel==2
      * to force use of the KeyFile.  secLevel == 0 implies -noauth was
      * specified. */
-    if ((afsconf_GetLatestKey(tdir, 0, 0) == 0)) {
-        code = afsconf_ClientAuthSecure(tdir, &sc, &scIndex);
-        if (code)
-           ViceLog(0, ("hpr_Initialize: clientauthsecure returns %d %s (so trying noauth)", code, afs_error_message(code)));
-        if (code)
-            scIndex = RX_SECIDX_NULL;
-    } else {
-       afsconf_ClientAuthToken(&info, 0, &sc, &scIndex, NULL);
+    code = afsconf_ClientAuthSecure(tdir, &sc, &scIndex);
+    if (code) {
+       ViceLog(0, ("hpr_Initialize: clientauthsecure returns %d %s "
+                   "(so trying noauth)", code, afs_error_message(code)));
+       scIndex = RX_SECIDX_NULL;
+       sc = rxnull_NewClientSecurityObject();
     }
-    if ((scIndex == RX_SECIDX_NULL) && (sc == NULL))
-        sc = rxnull_NewClientSecurityObject();
+
     if (scIndex == RX_SECIDX_NULL)
-       ViceLog(0, ("hpr_Initialize: Could not get afs tokens, running unauthenticated. [%d]", code));
-    
+       ViceLog(0, ("hpr_Initialize: Could not get afs tokens, "
+                   "running unauthenticated. [%d]", code));
+
     memset(serverconns, 0, sizeof(serverconns));        /* terminate list!!! */
     for (i = 0; i < info.numServers; i++) {
         serverconns[i] =
@@ -352,13 +351,13 @@ hpr_GetHostCPS(afs_int32 host, prlist *CPS)
 #ifdef AFS_PTHREAD_ENV
     afs_int32 code;
     afs_int32 over;
-    struct ubik_client *uclient = 
+    struct ubik_client *uclient =
        (struct ubik_client *)pthread_getspecific(viced_uclient_key);
 
     if (!uclient) {
         code = hpr_Initialize(&uclient);
-       if (!code) 
-           assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+       if (!code)
+           osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
        else
            return code;
     }
@@ -386,13 +385,13 @@ hpr_NameToId(namelist *names, idlist *ids)
 #ifdef AFS_PTHREAD_ENV
     afs_int32 code;
     afs_int32 i;
-    struct ubik_client *uclient = 
+    struct ubik_client *uclient =
        (struct ubik_client *)pthread_getspecific(viced_uclient_key);
 
     if (!uclient) {
         code = hpr_Initialize(&uclient);
        if (!code)
-           assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+           osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
        else
            return code;
     }
@@ -411,13 +410,13 @@ hpr_IdToName(idlist *ids, namelist *names)
 {
 #ifdef AFS_PTHREAD_ENV
     afs_int32 code;
-    struct ubik_client *uclient = 
+    struct ubik_client *uclient =
        (struct ubik_client *)pthread_getspecific(viced_uclient_key);
-    
+
     if (!uclient) {
         code = hpr_Initialize(&uclient);
        if (!code)
-           assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+           osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
        else
            return code;
     }
@@ -435,13 +434,13 @@ hpr_GetCPS(afs_int32 id, prlist *CPS)
 #ifdef AFS_PTHREAD_ENV
     afs_int32 code;
     afs_int32 over;
-    struct ubik_client *uclient = 
+    struct ubik_client *uclient =
        (struct ubik_client *)pthread_getspecific(viced_uclient_key);
 
     if (!uclient) {
         code = hpr_Initialize(&uclient);
        if (!code)
-           assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+           osi_Assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
        else
            return code;
     }
@@ -592,7 +591,7 @@ h_gethostcps_r(struct host *host, afs_int32 now)
        slept = 1;              /* I did sleep */
        host->hostFlags |= HCPS_WAITING;        /* I am sleeping now */
 #ifdef AFS_PTHREAD_ENV
-       pthread_cond_wait(&host->cond, &host_glock_mutex);
+       CV_WAIT(&host->cond, &host_glock_mutex);
 #else /* AFS_PTHREAD_ENV */
        if ((code = LWP_WaitProcess(&(host->hostFlags))) != LWP_SUCCESS)
            ViceLog(0, ("LWP_WaitProcess returned %d\n", code));
@@ -618,16 +617,16 @@ h_gethostcps_r(struct host *host, afs_int32 now)
         * with one of these errors. In such case we would like to reevaluate the rpc call to
         * find if there's cps for this guy. We treat other errors (except network failures
         * ones - i.e. code < 0) as an indication that there is no CPS for this host. Ideally
-        * we could like to deal this problem the other way around (i.e. if code == NOCPS 
+        * we could like to deal this problem the other way around (i.e. if code == NOCPS
         * ignore else retry next time) but the problem is that there're other errors (i.e.
         * EPERM) for which we don't want to retry and we don't know the whole code list!
         */
        if (code < 0 || code == UNOQUORUM || code == UNOTSYNC) {
-           /* 
+           /*
             * We would have preferred to use a while loop and try again since ops in protected
             * acls for this host will fail now but they'll be reevaluated on any subsequent
             * call. The attempt to wait for a quorum/sync site or network error won't work
-            * since this problems really should only occurs during a complete fileserver 
+            * since this problems really should only occurs during a complete fileserver
             * restart. Since the fileserver will start before the ptservers (and thus before
             * quorums are complete) clients will be utilizing all the fileserver's lwps!!
             */
@@ -653,7 +652,7 @@ h_gethostcps_r(struct host *host, afs_int32 now)
     if (host->hostFlags & HCPS_WAITING) {      /* somebody is waiting */
        host->hostFlags &= ~HCPS_WAITING;
 #ifdef AFS_PTHREAD_ENV
-       assert(pthread_cond_broadcast(&host->cond) == 0);
+       CV_BROADCAST(&host->cond);
 #else /* AFS_PTHREAD_ENV */
        if ((code = LWP_NoYieldSignal(&(host->hostFlags))) != LWP_SUCCESS)
            ViceLog(0, ("LWP_NoYieldSignal returns %d\n", code));
@@ -689,7 +688,6 @@ h_Alloc_r(struct rx_connection *r_con)
 {
     struct servent *serverentry;
     struct host *host;
-    afs_int32 now;
 #if FS_STATS_DETAILED
     afs_uint32 newHostAddr_HBO;        /*New host IP addr, in host byte order */
 #endif /* FS_STATS_DETAILED */
@@ -717,7 +715,7 @@ h_Alloc_r(struct rx_connection *r_con)
     /* Make a callback channel even for the console, on the off chance that it
      * makes a request that causes a break call back.  It shouldn't. */
     h_SetupCallbackConn_r(host);
-    now = host->LastCall = host->cpsCall = host->ActiveCall = FT_ApproxTime();
+    host->LastCall = host->cpsCall = host->ActiveCall = FT_ApproxTime();
     host->hostFlags = 0;
     host->hcps.prlist_val = NULL;
     host->hcps.prlist_len = 0;
@@ -776,10 +774,10 @@ h_Lookup_r(afs_uint32 haddr, afs_uint16 hport, struct host **hostp)
   restart:
     for (chain = hostAddrHashTable[index]; chain; chain = chain->next) {
        host = chain->hostPtr;
-       assert(host);
+       osi_Assert(host);
        if (!(host->hostFlags & HOSTDELETED) && chain->addr == haddr
            && chain->port == hport) {
-           if ((host->hostFlags & HWHO_INPROGRESS) && 
+           if ((host->hostFlags & HWHO_INPROGRESS) &&
                h_threadquota(host->lock.num_waiting)) {
                *hostp = 0;
                return VBUSY;
@@ -823,7 +821,7 @@ h_LookupUuid_r(afsUUID * uuidp)
 
     for (chain = hostUuidHashTable[index]; chain; chain = chain->next) {
        host = chain->hostPtr;
-       assert(host);
+       osi_Assert(host);
        if (!(host->hostFlags & HOSTDELETED) && host->interface
            && afs_uuid_equal(&host->interface->uuid, uuidp)) {
             return host;
@@ -888,7 +886,7 @@ h_TossStuff_r(struct host *host)
                         ntohs(host->port), client));
                return;
            }
-                
+
            if (client->refCount) {
                char hoststr[16];
                ViceLog(0,
@@ -942,7 +940,7 @@ h_TossStuff_r(struct host *host)
            /* delete the hash entry for each valid alternate addresses */
            for (i = 0; i < host->interface->numberOfInterfaces; i++) {
                hostAddrPort = host->interface->interface[i];
-                /* 
+                /*
                  * if the interface addr/port is the primary, we already
                  * removed it.  If the addr/port is not valid, its not
                  * in the hash table.
@@ -991,12 +989,12 @@ h_Enumerate(int (*proc) (struct host*, int, void *), void *param)
     list = (struct host **)malloc(hostCount * sizeof(struct host *));
     if (!list) {
        ViceLog(0, ("Failed malloc in h_Enumerate (list)\n"));
-       assert(0);
+       osi_Panic("Failed malloc in h_Enumerate (list)\n");
     }
     flags = (int *)malloc(hostCount * sizeof(int));
     if (!flags) {
        ViceLog(0, ("Failed malloc in h_Enumerate (flags)\n"));
-       assert(0);
+       osi_Panic("Failed malloc in h_Enumerate (flags)\n");
     }
     for (totalCount = count = 0, host = hostList;
          host && totalCount < hostCount;
@@ -1017,7 +1015,9 @@ h_Enumerate(int (*proc) (struct host*, int, void *), void *param)
     H_UNLOCK;
     for (i = 0; i < count; i++) {
        flags[i] = (*proc) (list[i], flags[i], param);
+       H_LOCK;
        h_Release_r(list[i]);
+       H_UNLOCK;
        /* bail out of the enumeration early */
        if (H_ENUMERATE_ISSET_BAIL(flags[i]))
            break;
@@ -1045,7 +1045,7 @@ h_Enumerate(int (*proc) (struct host*, int, void *), void *param)
  * be held after enumeration.
  */
 void
-h_Enumerate_r(int (*proc) (struct host *, int, void *), 
+h_Enumerate_r(int (*proc) (struct host *, int, void *),
              struct host *enumstart, void *param)
 {
     struct host *host, *next;
@@ -1137,15 +1137,15 @@ h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
        if (!chain->hostPtr)
            continue;
 
-       if (chain->hostPtr->interface && 
+       if (chain->hostPtr->interface &&
            afs_uuid_equal(&chain->hostPtr->interface->uuid, uuid)) {
            if (LogLevel >= 125) {
-               afsUUID_to_string(&chain->hostPtr->interface->uuid, uuid1, 
+               afsUUID_to_string(&chain->hostPtr->interface->uuid, uuid1,
                                  127);
                afsUUID_to_string(uuid, uuid2, 127);
-               ViceLog(125, ("h_AddHostToUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s) exists as %s:%d (uuid %s)\n", 
+               ViceLog(125, ("h_AddHostToUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s) exists as %s:%d (uuid %s)\n",
                              host, uuid1,
-                             afs_inet_ntoa_r(chain->hostPtr->host, hoststr), 
+                             afs_inet_ntoa_r(chain->hostPtr->host, hoststr),
                              ntohs(chain->hostPtr->port), uuid2));
            }
            return;
@@ -1156,7 +1156,7 @@ h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
     chain = (struct h_UuidHashChain *)malloc(sizeof(struct h_UuidHashChain));
     if (!chain) {
        ViceLog(0, ("Failed malloc in h_AddHostToUuidHashTable_r\n"));
-       assert(0);
+       osi_Panic("Failed malloc in h_AddHostToUuidHashTable_r\n");
     }
     chain->hostPtr = host;
     chain->next = hostUuidHashTable[index];
@@ -1164,9 +1164,9 @@ h_AddHostToUuidHashTable_r(struct afsUUID *uuid, struct host *host)
          if (LogLevel < 125)
               return;
      afsUUID_to_string(uuid, uuid2, 127);
-     ViceLog(125, 
+     ViceLog(125,
             ("h_AddHostToUuidHashTable_r: host %p (%s:%d) added as uuid %s\n",
-             host, afs_inet_ntoa_r(chain->hostPtr->host, hoststr), 
+             host, afs_inet_ntoa_r(chain->hostPtr->host, hoststr),
              ntohs(chain->hostPtr->port), uuid2));
 }
 
@@ -1178,30 +1178,30 @@ h_DeleteHostFromUuidHashTable_r(struct host *host)
      struct h_UuidHashChain **uhp, *uth;
      char uuid1[128];
      char hoststr[16];
+
      if (!host->interface)
        return 0;
+
      /* hash into proper bucket */
      index = h_UuidHashIndex(&host->interface->uuid);
-     
+
      if (LogLevel >= 125)
         afsUUID_to_string(&host->interface->uuid, uuid1, 127);
      for (uhp = &hostUuidHashTable[index]; (uth = *uhp); uhp = &uth->next) {
-         assert(uth->hostPtr);
+         osi_Assert(uth->hostPtr);
         if (uth->hostPtr == host) {
-            ViceLog(125, 
+            ViceLog(125,
                     ("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d)\n",
-                     host, uuid1, afs_inet_ntoa_r(host->host, hoststr), 
+                     host, uuid1, afs_inet_ntoa_r(host->host, hoststr),
                      ntohs(host->port)));
             *uhp = uth->next;
             free(uth);
             return 1;
         }
      }
-     ViceLog(125, 
+     ViceLog(125,
             ("h_DeleteHostFromUuidHashTable_r: host %" AFS_PTR_FMT " (uuid %s %s:%d) not found\n",
-             host, uuid1, afs_inet_ntoa_r(host->host, hoststr), 
+             host, uuid1, afs_inet_ntoa_r(host->host, hoststr),
              ntohs(host->port)));
      return 0;
 }
@@ -1219,8 +1219,8 @@ invalidateInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
     struct Interface *interface;
     char hoststr[16], hoststr2[16];
 
-    assert(host);
-    assert(host->interface);
+    osi_Assert(host);
+    osi_Assert(host->interface);
 
     ViceLog(125, ("invalidateInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n",
                  host, afs_inet_ntoa_r(host->host, hoststr),
@@ -1343,7 +1343,7 @@ createHostAddrHashChain_r(int index, afs_uint32 addr, afs_uint16 port, struct ho
     chain = (struct h_AddrHashChain *)malloc(sizeof(struct h_AddrHashChain));
     if (!chain) {
        ViceLog(0, ("Failed malloc in h_AddHostToAddrHashTable_r\n"));
-       assert(0);
+       osi_Panic("Failed malloc in h_AddHostToAddrHashTable_r\n");
     }
     chain->hostPtr = host;
     chain->next = hostAddrHashTable[index];
@@ -1379,7 +1379,7 @@ reconcileHosts_r(afs_uint32 addr, afs_uint16 port, struct host *newHost,
             AFS_PTR_FMT, afs_inet_ntoa_r(addr, hoststr), ntohs(port),
             newHost, oldHost));
 
-    assert(oldHost != newHost);
+    osi_Assert(oldHost != newHost);
     caps.Capabilities_val = NULL;
 
     if (!sc) {
@@ -1515,9 +1515,9 @@ h_AddHostToAddrHashTable_r(afs_uint32 addr, afs_uint16 port, struct host *host)
 }
 
 /*
- * This is called with host locked and held. 
+ * This is called with host locked and held.
  * It is called to either validate or add an additional interface
- * address/port on the specified host.  
+ * address/port on the specified host.
  *
  * All addresses are in network byte order.
  */
@@ -1528,9 +1528,9 @@ addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
     int number;
     struct Interface *interface;
     char hoststr[16], hoststr2[16];
-                                                   
-    assert(host);
-    assert(host->interface);
+
+    osi_Assert(host);
+    osi_Assert(host->interface);
 
     /*
      * Make sure this address is on the list of known addresses
@@ -1540,13 +1540,13 @@ addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
     for (i = 0; i < number; i++) {
        if (host->interface->interface[i].addr == addr &&
              host->interface->interface[i].port == port) {
-           ViceLog(125, 
+           ViceLog(125,
                    ("addInterfaceAddr : found host %" AFS_PTR_FMT " (%s:%d) adding %s:%d%s\n",
-                    host, afs_inet_ntoa_r(host->host, hoststr), 
-                    ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
-                    ntohs(port), host->interface->interface[i].valid ? "" : 
+                    host, afs_inet_ntoa_r(host->host, hoststr),
+                    ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2),
+                    ntohs(port), host->interface->interface[i].valid ? "" :
                     ", validating"));
-     
+
            if (host->interface->interface[i].valid == 0) {
                host->interface->interface[i].valid = 1;
                h_AddHostToAddrHashTable_r(addr, port, host);
@@ -1555,22 +1555,22 @@ addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
         }
     }
 
-    ViceLog(125, ("addInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) adding %s:%d\n", 
-                 host, afs_inet_ntoa_r(host->host, hoststr), 
-                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
+    ViceLog(125, ("addInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) adding %s:%d\n",
+                 host, afs_inet_ntoa_r(host->host, hoststr),
+                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2),
                  ntohs(port)));
-    
+
     interface = (struct Interface *)
        malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * number));
     if (!interface) {
        ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
-       assert(0);
+       osi_Panic("Failed malloc in addInterfaceAddr_r\n");
     }
     interface->numberOfInterfaces = number + 1;
     interface->uuid = host->interface->uuid;
     for (i = 0; i < number; i++)
        interface->interface[i] = host->interface->interface[i];
-    
+
     /* Add the new valid interface */
     interface->interface[number].addr = addr;
     interface->interface[number].port = port;
@@ -1578,7 +1578,7 @@ addInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
     h_AddHostToAddrHashTable_r(addr, port, host);
     free(host->interface);
     host->interface = interface;
-    
+
     return 0;
 }
 
@@ -1596,12 +1596,12 @@ removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
     struct Interface *interface;
     char hoststr[16], hoststr2[16];
 
-    assert(host);
-    assert(host->interface);
+    osi_Assert(host);
+    osi_Assert(host->interface);
 
-    ViceLog(125, ("removeInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n", 
-                 host, afs_inet_ntoa_r(host->host, hoststr), 
-                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2), 
+    ViceLog(125, ("removeInterfaceAddr : host %" AFS_PTR_FMT " (%s:%d) addr %s:%d\n",
+                 host, afs_inet_ntoa_r(host->host, hoststr),
+                 ntohs(host->port), afs_inet_ntoa_r(addr, hoststr2),
                  ntohs(port)));
 
     /*
@@ -1622,7 +1622,7 @@ removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
            interface->numberOfInterfaces = number;
            return 0;
        }
-    }  
+    }
     /* not found */
     return 0;
 }
@@ -1630,7 +1630,7 @@ removeInterfaceAddr_r(struct host *host, afs_uint32 addr, afs_uint16 port)
 
 
 static int
-h_threadquota(int waiting) 
+h_threadquota(int waiting)
 {
     if (lwps > 64) {
        if (waiting > 5)
@@ -1688,7 +1688,7 @@ h_GetHost_r(struct rx_connection *tcon)
         * structure for this address. Verify that the identity
         * of the caller matches the identity in the host structure.
         */
-       if ((host->hostFlags & HWHO_INPROGRESS) && 
+       if ((host->hostFlags & HWHO_INPROGRESS) &&
            h_threadquota(host->lock.num_waiting)) {
                h_Release_r(host);
            host = NULL;
@@ -1717,16 +1717,16 @@ h_GetHost_r(struct rx_connection *tcon)
          * If there is a match, we can use the existing callback
          * connection to verify the UUID.  If they do not match
          * we need to use a new callback connection to verify the
-         * UUID of the incoming caller and perhaps use the old 
+         * UUID of the incoming caller and perhaps use the old
          * callback connection to verify that the old address/port
          * is still valid.
          */
-       
+
        cb_conn = host->callback_rxcon;
        rx_GetConnection(cb_conn);
        H_UNLOCK;
         if (haddr == host->host && hport == host->port) {
-            /* The existing callback connection matches the 
+            /* The existing callback connection matches the
              * incoming connection so just use it.
              */
            code =
@@ -1743,7 +1743,7 @@ h_GetHost_r(struct rx_connection *tcon)
             cb_in = rx_NewConnection(haddr, hport, 1, sc, 0);
             rx_SetConnDeadTime(cb_in, 50);
             rx_SetConnHardDeadTime(cb_in, AFS_HARDDEADTIME);
-           
+
             code =
                 RXAFSCB_TellMeAboutYourself(cb_in, &interf, &caps);
            if (code == RXGEN_OPCODE)
@@ -1752,24 +1752,24 @@ h_GetHost_r(struct rx_connection *tcon)
        rx_PutConnection(cb_conn);
        cb_conn=NULL;
        H_LOCK;
-       if ((code == RXGEN_OPCODE) || 
+       if ((code == RXGEN_OPCODE) ||
            ((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
            identP = (struct Identity *)malloc(sizeof(struct Identity));
            if (!identP) {
                ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
-               assert(0);
+               osi_Panic("Failed malloc in h_GetHost_r\n");
            }
            identP->valid = 0;
            rx_SetSpecific(tcon, rxcon_ident_key, identP);
            if (cb_in == NULL) {
-               /* The host on this connection was unable to respond to 
+               /* The host on this connection was unable to respond to
                 * the WhoAreYou. We will treat this as a new connection
                 * from the existing host. The worst that can happen is
                 * that we maintain some extra callback state information */
                if (host->interface) {
                    ViceLog(0,
                            ("Host %" AFS_PTR_FMT " (%s:%d) used to support WhoAreYou, deleting.\n",
-                            host, 
+                            host,
                             afs_inet_ntoa_r(host->host, hoststr),
                             ntohs(host->port)));
                    host->hostFlags |= HOSTDELETED;
@@ -1783,7 +1783,7 @@ h_GetHost_r(struct rx_connection *tcon)
                /* The incoming connection does not support WhoAreYou but
                 * the original one might have.  Use removeAddress_r() to
                  * remove this addr/port from the host that was found.
-                 * If there are no more addresses left for the host it 
+                 * If there are no more addresses left for the host it
                  * will be deleted.  Then we retry.
                  */
                 removeAddress_r(host, haddr, hport);
@@ -1799,7 +1799,7 @@ h_GetHost_r(struct rx_connection *tcon)
            identP = (struct Identity *)malloc(sizeof(struct Identity));
            if (!identP) {
                ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
-               assert(0);
+               osi_Panic("Failed malloc in h_GetHost_r\n");
            }
            identP->valid = 1;
            identP->uuid = interf.uuid;
@@ -1818,7 +1818,7 @@ h_GetHost_r(struct rx_connection *tcon)
                    ViceLog(25,
                            ("Uuid doesn't match host %" AFS_PTR_FMT " (%s:%d).\n",
                             host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
-                   
+
                    removeAddress_r(host, host->host, host->port);
                }
                host->hostFlags &= ~HWHO_INPROGRESS;
@@ -1828,8 +1828,8 @@ h_GetHost_r(struct rx_connection *tcon)
                host = NULL;
                goto retry;
            } else if (cb_in) {
-               /* the UUID matched the client at the incoming addr/port 
-                 * but this is not the address of the active callback 
+               /* the UUID matched the client at the incoming addr/port
+                 * but this is not the address of the active callback
                  * connection.  Try that connection and see if the client
                  * is still there and if the reported UUID is the same.
                  */
@@ -1849,18 +1849,18 @@ h_GetHost_r(struct rx_connection *tcon)
                 if (code2) {
                     /* The primary address is either not responding or
                      * is not the client we are looking for.  Need to
-                     * remove the primary address and add swap in the new 
+                     * remove the primary address and add swap in the new
                      * callback connection, and destroy the old one.
                      */
                     struct rx_connection *rxconn;
                     ViceLog(0,("CB: ProbeUuid for host %" AFS_PTR_FMT " (%s:%d) failed %d\n",
-                              host, 
+                              host,
                               afs_inet_ntoa_r(host->host, hoststr),
                               ntohs(host->port),code2));
 
-                    /* 
+                    /*
                      * make sure we add and then remove.  otherwise, we
-                     * might end up with no valid interfaces after the 
+                     * might end up with no valid interfaces after the
                      * remove and the host will have been marked deleted.
                      */
                     addInterfaceAddr_r(host, haddr, hport);
@@ -1870,7 +1870,7 @@ h_GetHost_r(struct rx_connection *tcon)
                     rxconn = host->callback_rxcon;
                     host->callback_rxcon = cb_in;
                     cb_in = NULL;
-                   
+
                     if (rxconn) {
                         /*
                          * If rx_DestroyConnection calls h_FreeConnection we
@@ -1885,7 +1885,7 @@ h_GetHost_r(struct rx_connection *tcon)
            }
        } else {
             if (cb_in) {
-                /* A callback to the incoming connection address is failing.  
+                /* A callback to the incoming connection address is failing.
                  * Assume that the addr/port is no longer associated with the host
                  * returned by h_Lookup_r.
                  */
@@ -1978,7 +1978,7 @@ h_GetHost_r(struct rx_connection *tcon)
            rx_PutConnection(cb_conn);
            cb_conn=NULL;
            H_LOCK;
-           if ((code == RXGEN_OPCODE) || 
+           if ((code == RXGEN_OPCODE) ||
                ((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
                if (!identP)
                    identP =
@@ -1988,7 +1988,7 @@ h_GetHost_r(struct rx_connection *tcon)
 
                if (!identP) {
                    ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
-                   assert(0);
+                   osi_Panic("Failed malloc in h_GetHost_r\n");
                }
                identP->valid = 0;
                if (!pident)
@@ -2007,7 +2007,7 @@ h_GetHost_r(struct rx_connection *tcon)
 
                if (!identP) {
                    ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
-                   assert(0);
+                   osi_Panic("Failed malloc in h_GetHost_r\n");
                }
                identP->valid = 1;
                interfValid = 1;
@@ -2061,12 +2061,12 @@ h_GetHost_r(struct rx_connection *tcon)
                         cb_conn=NULL;
                        if (code2) {
                            /* The primary address is either not responding or
-                            * is not the client we are looking for.  
+                            * is not the client we are looking for.
                             * MultiProbeAlternateAddress_r() will remove the
                             * alternate interfaces that do not have the same
                             * Uuid. */
                            ViceLog(0,("CB: ProbeUuid for host %" AFS_PTR_FMT " (%s:%d) failed %d\n",
-                                        oldHost, 
+                                        oldHost,
                                          afs_inet_ntoa_r(oldHost->host, hoststr),
                                         ntohs(oldHost->port),code2));
                            MultiProbeAlternateAddress_r(oldHost);
@@ -2088,24 +2088,24 @@ h_GetHost_r(struct rx_connection *tcon)
 
                        ViceLog(25,
                                  ("CB: Host %" AFS_PTR_FMT " (%s:%d) has new addr %s:%d\n",
-                                   oldHost, 
+                                   oldHost,
                                    afs_inet_ntoa_r(oldHost->host, hoststr2),
                                    ntohs(oldHost->port),
                                    afs_inet_ntoa_r(haddr, hoststr),
                                    ntohs(hport)));
-                       /* 
+                       /*
                         * add then remove.  otherwise the host may get marked
                         * deleted if we removed the only valid address.
                         */
                        addInterfaceAddr_r(oldHost, haddr, hport);
                        if (probefail || oldHost->host == haddr) {
-                           /* 
-                            * The probe failed which means that the old 
-                            * address is either unreachable or is not the 
-                            * same host we were just contacted by.  We will 
-                            * also remove addresses if only the port has 
+                           /*
+                            * The probe failed which means that the old
+                            * address is either unreachable or is not the
+                            * same host we were just contacted by.  We will
+                            * also remove addresses if only the port has
                             * changed because that indicates the client
-                            * is behind a NAT. 
+                            * is behind a NAT.
                             */
                            removeInterfaceAddr_r(oldHost, oldHost->host, oldHost->port);
                        } else {
@@ -2115,12 +2115,12 @@ h_GetHost_r(struct rx_connection *tcon)
                            for (i = 0; i < number; i++) {
                                if (interface->interface[i].addr == haddr &&
                                    interface->interface[i].port != hport) {
-                                   /* 
+                                   /*
                                     * We have just been contacted by a client
-                                    * that has been seen from behind a NAT 
+                                    * that has been seen from behind a NAT
                                     * and at least one other address.
                                     */
-                                   removeInterfaceAddr_r(oldHost, haddr, 
+                                   removeInterfaceAddr_r(oldHost, haddr,
                                                          interface->interface[i].port);
                                    break;
                                }
@@ -2132,7 +2132,7 @@ h_GetHost_r(struct rx_connection *tcon)
                        rxconn = oldHost->callback_rxcon;
                        oldHost->callback_rxcon = host->callback_rxcon;
                        host->callback_rxcon = rxconn;
-                       
+
                         /* don't destroy rxconn here; let h_TossStuff_r
                          * take care of that via h_Release_r below */
                    }
@@ -2146,7 +2146,7 @@ h_GetHost_r(struct rx_connection *tcon)
                    /* This really is a new host */
                    h_AddHostToUuidHashTable_r(&identP->uuid, host);
                    cb_conn = host->callback_rxcon;
-                   rx_GetConnection(cb_conn);          
+                   rx_GetConnection(cb_conn);
                    H_UNLOCK;
                    code =
                        RXAFSCB_InitCallBackState3(cb_conn,
@@ -2159,7 +2159,7 @@ h_GetHost_r(struct rx_connection *tcon)
                                ("InitCallBackState3 success on host %" AFS_PTR_FMT " (%s:%d)\n",
                                 host, afs_inet_ntoa_r(host->host, hoststr),
                                 ntohs(host->port)));
-                       assert(interfValid == 1);
+                       osi_Assert(interfValid == 1);
                        initInterfaceAddr_r(host, &interf);
                    }
                }
@@ -2233,9 +2233,7 @@ h_InitHostPackage(void)
     }
     rxcon_ident_key = rx_KeyCreate((rx_destructor_t) free);
     rxcon_client_key = rx_KeyCreate((rx_destructor_t) 0);
-#ifdef AFS_PTHREAD_ENV
-    assert(pthread_mutex_init(&host_glock_mutex, NULL) == 0);
-#endif /* AFS_PTHREAD_ENV */
+    MUTEX_INIT(&host_glock_mutex, "host glock", MUTEX_DEFAULT, 0);
 }
 
 static int
@@ -2274,7 +2272,7 @@ MapName_r(char *aname, char *acell, afs_int32 * aval)
            tname = (char *)malloc(PR_MAXNAMELEN);
            if (!tname) {
                ViceLog(0, ("Failed malloc in MapName_r\n"));
-               assert(0);
+               osi_Panic("Failed malloc in MapName_r\n");
            }
            strcpy(tname, aname);
            tname[anamelen] = '@';
@@ -2375,13 +2373,13 @@ h_FindClient_r(struct rx_connection *tcon)
     int created = 0;
 
     client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
-    if (client && client->sid == rxr_CidOf(tcon) 
+    if (client && client->sid == rxr_CidOf(tcon)
        && client->VenusEpoch == rxr_GetEpoch(tcon)
        && !(client->host->hostFlags & HOSTDELETED)) {
 
        client->refCount++;
        h_Hold_r(client->host);
-       if (!client->deleted && client->prfail != 2) {  
+       if (!client->deleted && client->prfail != 2) {
            /* Could add shared lock on client here */
            /* note that we don't have to lock entry in this path to
             * ensure CPS is initialized, since we don't call rx_SetSpecific
@@ -2408,7 +2406,7 @@ h_FindClient_r(struct rx_connection *tcon)
        expTime = 0x7fffffff;
     } else if (authClass == 2) {
        afs_int32 kvno;
-    
+
        /* kerberos ticket */
        code = rxkad_GetServerInfo(tcon, /*level */ 0, (afs_uint32 *)&expTime,
                                   tname, tinst, tcell, &kvno);
@@ -2448,7 +2446,7 @@ h_FindClient_r(struct rx_connection *tcon)
     if (!client) { /* loop */
        host = h_GetHost_r(tcon);       /* Returns with incremented refCount  */
 
-       if (!host) 
+       if (!host)
            return NULL;
 
     retryfirstclient:
@@ -2519,7 +2517,7 @@ h_FindClient_r(struct rx_connection *tcon)
                char hoststr[16];
                ViceLog(0,
                        ("pr_GetCPS failed(%d) for user %d, host %" AFS_PTR_FMT " (%s:%d)\n",
-                        code, viceid, client->host, 
+                        code, viceid, client->host,
                          afs_inet_ntoa_r(client->host->host,hoststr),
                         ntohs(client->host->port)));
 
@@ -2542,9 +2540,9 @@ h_FindClient_r(struct rx_connection *tcon)
        }
        /* the disabling of system:administrators is so iffy and has so many
         * possible failure modes that we will disable it again */
-       /* Turn off System:Administrator for safety  
+       /* Turn off System:Administrator for safety
         * if (AL_IsAMember(SystemId, client->CPS) == 0)
-        * assert(AL_DisableGroup(SystemId, client->CPS) == 0); */
+        * osi_Assert(AL_DisableGroup(SystemId, client->CPS) == 0); */
     }
 
     /* Now, tcon may already be set to a rock, since we blocked with no host
@@ -2561,7 +2559,7 @@ h_FindClient_r(struct rx_connection *tcon)
            if (created) {
                ViceLog(0, ("FindClient: stillborn client %p(%x); "
                            "conn %p (host %s:%d) had client %p(%x)\n",
-                           client, client->sid, tcon, 
+                           client, client->sid, tcon,
                            afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr),
                            ntohs(rxr_PortOf(tcon)),
                            oldClient, oldClient->sid));
@@ -2576,7 +2574,7 @@ h_FindClient_r(struct rx_connection *tcon)
            if (created) {
                FreeCE(client);
                created = 0;
-           } 
+           }
            oldClient->refCount++;
            H_UNLOCK;
            ObtainWriteLock(&oldClient->lock);
@@ -2585,7 +2583,7 @@ h_FindClient_r(struct rx_connection *tcon)
        } else {
            ViceLog(0, ("FindClient: deleted client %p(%x) already had "
                        "conn %p (host %s:%d), stolen by client %p(%x)\n",
-                       oldClient, oldClient->sid, tcon, 
+                       oldClient, oldClient->sid, tcon,
                        afs_inet_ntoa_r(rxr_HostOf(tcon), hoststr),
                        ntohs(rxr_PortOf(tcon)),
                        client, client->sid));
@@ -2629,7 +2627,7 @@ h_FindClient_r(struct rx_connection *tcon)
 int
 h_ReleaseClient_r(struct client *client)
 {
-    assert(client->refCount > 0);
+    osi_Assert(client->refCount > 0);
     client->refCount--;
     return 0;
 }
@@ -2684,7 +2682,7 @@ GetClient(struct rx_connection *tcon, struct client **cp)
 int
 PutClient(struct client **cp)
 {
-    if (*cp == NULL) 
+    if (*cp == NULL)
        return -1;
 
     H_LOCK;
@@ -2707,7 +2705,7 @@ h_UserName(struct client *client)
     lids.idlist_val = (afs_int32 *) malloc(1 * sizeof(afs_int32));
     if (!lids.idlist_val) {
        ViceLog(0, ("Failed malloc in h_UserName\n"));
-       assert(0);
+       osi_Panic("Failed malloc in h_UserName\n");
     }
     lnames.namelist_len = 0;
     lnames.namelist_val = (prname *) 0;
@@ -2828,7 +2826,7 @@ static int
 h_DumpHost(struct host *host, int flags, void *rock)
 {
     StreamHandle_t *file = (StreamHandle_t *)rock;
-    
+
     int i;
     char tmpStr[256];
     char hoststr[16];
@@ -2854,7 +2852,7 @@ h_DumpHost(struct host *host, int flags, void *rock)
     if (host->interface)
        for (i = 0; i < host->interface->numberOfInterfaces; i++) {
            char hoststr[16];
-           sprintf(tmpStr, " %s:%d", 
+           sprintf(tmpStr, " %s:%d",
                     afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
                     ntohs(host->interface->interface[i].port));
            (void)STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
@@ -2949,7 +2947,7 @@ h_stateSave(struct fs_dump_state * state)
 /* demand attach fs
  * host state serialization
  *
- * this procedure restores all host state from a disk for fast startup 
+ * this procedure restores all host state from a disk for fast startup
  */
 int
 h_stateRestore(struct fs_dump_state * state)
@@ -3025,7 +3023,7 @@ h_stateVerifyHost(struct host * h, int flags, void* rock)
 
     if (h->interface) {
        for (i = h->interface->numberOfInterfaces-1; i >= 0; i--) {
-           if (h_stateVerifyAddrHash(state, h, h->interface->interface[i].addr, 
+           if (h_stateVerifyAddrHash(state, h, h->interface->interface[i].addr,
                                      h->interface->interface[i].port,
                                      h->interface->interface[i].valid)) {
                state->bail = 1;
@@ -3150,7 +3148,7 @@ h_stateVerifyUuidHash(struct fs_dump_state * state, struct host * h)
        if (host->interface &&
            afs_uuid_equal(&host->interface->uuid, uuidp)) {
            if (host != h) {
-               ViceLog(0, ("h_stateVerifyUuidHash: warning: uuid hash entry points to different host struct (%d, %d)\n", 
+               ViceLog(0, ("h_stateVerifyUuidHash: warning: uuid hash entry points to different host struct (%d, %d)\n",
                            h->index, host->index));
                state->flags.warnings_generated = 1;
            }
@@ -3239,10 +3237,10 @@ h_stateSaveHost(struct host * host, int flags, void* rock)
 
     h_hostToDiskEntry_r(host, &hdsk);
     if (host->interface) {
-       if_len = sizeof(struct Interface) + 
+       if_len = sizeof(struct Interface) +
            ((host->interface->numberOfInterfaces-1) * sizeof(struct AddrPort));
        ifp = (struct Interface *) malloc(if_len);
-       assert(ifp != NULL);
+       osi_Assert(ifp != NULL);
        memcpy(ifp, host->interface, if_len);
        hdr.interfaces = host->interface->numberOfInterfaces;
        iov[iovcnt].iov_base = (char *) ifp;
@@ -3253,7 +3251,7 @@ h_stateSaveHost(struct host * host, int flags, void* rock)
        hdr.hcps = host->hcps.prlist_len;
        hcps_len = hdr.hcps * sizeof(afs_int32);
        hcps = (afs_int32 *) malloc(hcps_len);
-       assert(hcps != NULL);
+       osi_Assert(hcps != NULL);
        memcpy(hcps, host->hcps.prlist_val, hcps_len);
        iov[iovcnt].iov_base = (char *) hcps;
        iov[iovcnt].iov_len = hcps_len;
@@ -3263,7 +3261,7 @@ h_stateSaveHost(struct host * host, int flags, void* rock)
     if (hdsk.index > state->h_hdr->index_max)
        state->h_hdr->index_max = hdsk.index;
 
-    hdr.len = sizeof(struct host_state_entry_header) + 
+    hdr.len = sizeof(struct host_state_entry_header) +
        sizeof(struct hostDiskEntry) + if_len + hcps_len;
     hdr.magic = HOST_STATE_ENTRY_MAGIC;
 
@@ -3271,7 +3269,7 @@ h_stateSaveHost(struct host * host, int flags, void* rock)
     iov[0].iov_len = sizeof(hdr);
     iov[1].iov_base = (char *) &hdsk;
     iov[1].iov_len = sizeof(struct hostDiskEntry);
-    
+
     if (fs_stateWriteV(state, iov, iovcnt)) {
        ViceLog(0, ("h_stateSaveHost: failed to save host %d", host->index));
        state->bail = 1;
@@ -3325,7 +3323,7 @@ h_stateRestoreHost(struct fs_dump_state * state)
        ifp_len = sizeof(struct Interface) +
            ((hdr.interfaces-1) * sizeof(struct AddrPort));
        ifp = (struct Interface *) malloc(ifp_len);
-       assert(ifp != NULL);
+       osi_Assert(ifp != NULL);
        iov[iovcnt].iov_base = (char *) ifp;
        iov[iovcnt].iov_len = ifp_len;
        iovcnt++;
@@ -3333,7 +3331,7 @@ h_stateRestoreHost(struct fs_dump_state * state)
     if (hdr.hcps) {
        hcps_len = hdr.hcps * sizeof(afs_int32);
        hcps = (afs_int32 *) malloc(hcps_len);
-       assert(hcps != NULL);
+       osi_Assert(hcps != NULL);
        iov[iovcnt].iov_base = (char *) hcps;
        iov[iovcnt].iov_len = hcps_len;
        iovcnt++;
@@ -3354,11 +3352,11 @@ h_stateRestoreHost(struct fs_dump_state * state)
     if (!hdr.hcps && hdsk.hcps_valid) {
        /* valid, zero-length host cps ; does this ever happen? */
        hcps = (afs_int32 *) malloc(sizeof(afs_int32));
-       assert(hcps != NULL);
+       osi_Assert(hcps != NULL);
     }
 
     host = GetHT();
-    assert(host != NULL);
+    osi_Assert(host != NULL);
 
     if (ifp) {
        host->interface = ifp;
@@ -3375,11 +3373,11 @@ h_stateRestoreHost(struct fs_dump_state * state)
     if (ifp) {
        int i;
        for (i = ifp->numberOfInterfaces-1; i >= 0; i--) {
-            if (ifp->interface[i].valid && 
+            if (ifp->interface[i].valid &&
                 !(ifp->interface[i].addr == host->host &&
                   ifp->interface[i].port == host->port)) {
-                h_AddHostToAddrHashTable_r(ifp->interface[i].addr, 
-                                           ifp->interface[i].port, 
+                h_AddHostToAddrHashTable_r(ifp->interface[i].addr,
+                                           ifp->interface[i].port,
                                            host);
             }
        }
@@ -3504,6 +3502,19 @@ h_GetWorkStats(int *nump, int *activep, int *delp, afs_int32 cutofftime)
 
 }                              /*h_GetWorkStats */
 
+void
+h_GetWorkStats64(afs_uint64 *nump, afs_uint64 *activep, afs_uint64 *delp, 
+                afs_int32 cutofftime)
+{
+    int num, active, del;
+    h_GetWorkStats(&num, &active, &del, cutofftime);
+    if (nump)
+        *nump = num;
+    if (activep)
+        *activep = active;
+    if (delp)
+        *delp = del;
+}
 
 /*------------------------------------------------------------------------
  * PRIVATE h_ClassifyAddress
@@ -3751,7 +3762,7 @@ CheckHost(struct host *host, int flags, void *rock)
                    }
                    /* Note:  it's safe to delete hosts even if they have call
                     * back state, because break delayed callbacks (called when a
-                    * message is received from the workstation) will always send a 
+                    * message is received from the workstation) will always send a
                     * break all call backs to the workstation if there is no
                     * callback.
                     */
@@ -3778,7 +3789,7 @@ CheckHost(struct host *host, int flags, void *rock)
                        H_LOCK;
                        if (code) {
                            ViceLog(0,
-                                   ("CheckHost: Probe failed for host %s:%d, code %d\n", 
+                                   ("CheckHost: Probe failed for host %s:%d, code %d\n",
                                     hoststr, ntohs(host->port), code));
                            host->hostFlags |= VENUSDOWN;
                        }
@@ -3855,7 +3866,7 @@ CheckHost_r(struct host *host, int flags, void *dummy)
                    }
                    /* Note:  it's safe to delete hosts even if they have call
                     * back state, because break delayed callbacks (called when a
-                    * message is received from the workstation) will always send a 
+                    * message is received from the workstation) will always send a
                     * break all call backs to the workstation if there is no
                     * callback.
                     */
@@ -3882,7 +3893,7 @@ CheckHost_r(struct host *host, int flags, void *dummy)
                        H_LOCK;
                        if (code) {
                            ViceLog(0,
-                                   ("CheckHost_r: Probe failed for host %s:%d, code %d\n", 
+                                   ("CheckHost_r: Probe failed for host %s:%d, code %d\n",
                                     hoststr, ntohs(host->port), code));
                            host->hostFlags |= VENUSDOWN;
                        }
@@ -3922,7 +3933,7 @@ h_CheckHosts(void)
      */
     checktime = now - 15 * 60;
     clientdeletetime = now - 120 * 60; /* 2 hours ago */
-    
+
     H_LOCK;
     h_Enumerate_r(CheckHost_r, hostList, NULL);
     H_UNLOCK;
@@ -3948,15 +3959,15 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
     char uuidstr[128];
     afs_uint16 port7001 = htons(7001);
 
-    assert(host);
-    assert(interf);
+    osi_Assert(host);
+    osi_Assert(interf);
 
     number = interf->numberOfInterfaces;
     myAddr = host->host;       /* current interface address */
     myPort = host->port;       /* current port */
 
     ViceLog(125,
-           ("initInterfaceAddr : host %s:%d numAddr %d\n", 
+           ("initInterfaceAddr : host %s:%d numAddr %d\n",
              afs_inet_ntoa_r(myAddr, hoststr), ntohs(myPort), number));
 
     /* validation checks */
@@ -3967,7 +3978,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
     }
 
     /*
-     * The client's notion of its own IP addresses is not reliable.  
+     * The client's notion of its own IP addresses is not reliable.
      *
      * 1. The client list might contain private address ranges which
      *    are likely to be re-used by many clients allocated addresses
@@ -3994,8 +4005,8 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
 
     /*
      * Convert IP addresses to network byte order, and remove
-     * duplicate IP addresses from the interface list, and 
-     * determine whether or not the incoming addr/port is 
+     * duplicate IP addresses from the interface list, and
+     * determine whether or not the incoming addr/port is
      * listed.  Note that if the address matches it is not
      * truly a match because the port number for the entries
      * in the interface list are port 7001 and the port number
@@ -4025,7 +4036,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
                   (sizeof(struct AddrPort) * (count - 1)));
        if (!interface) {
            ViceLog(0, ("Failed malloc in initInterfaceAddr_r 1\n"));
-           assert(0);
+           osi_Panic("Failed malloc in initInterfaceAddr_r 1\n");
        }
        interface->numberOfInterfaces = count;
     } else {
@@ -4033,7 +4044,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
            malloc(sizeof(struct Interface) + (sizeof(struct AddrPort) * count));
        if (!interface) {
            ViceLog(0, ("Failed malloc in initInterfaceAddr_r 2\n"));
-           assert(0);
+           osi_Panic("Failed malloc in initInterfaceAddr_r 2\n");
        }
        interface->numberOfInterfaces = count + 1;
        interface->interface[count].addr = myAddr;
@@ -4044,26 +4055,26 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
     for (i = 0; i < count; i++) {
 
         interface->interface[i].addr = interf->addr_in[i];
-       /* We store the port as 7001 because the addresses reported by 
+       /* We store the port as 7001 because the addresses reported by
         * TellMeAboutYourself and WhoAreYou RPCs are only valid if they
         * are coming from fully connected hosts (no NAT/PATs)
         */
        interface->interface[i].port = port7001;
-        interface->interface[i].valid = 
+        interface->interface[i].valid =
             (interf->addr_in[i] == myAddr && port7001 == myPort) ? 1 : 0;
     }
 
     interface->uuid = interf->uuid;
 
-    assert(!host->interface);
+    osi_Assert(!host->interface);
     host->interface = interface;
 
     if (LogLevel >= 125) {
        afsUUID_to_string(&interface->uuid, uuidstr, 127);
-       
+
        ViceLog(125, ("--- uuid %s\n", uuidstr));
        for (i = 0; i < host->interface->numberOfInterfaces; i++) {
-           ViceLog(125, ("--- alt address %s:%d\n", 
+           ViceLog(125, ("--- alt address %s:%d\n",
                          afs_inet_ntoa_r(host->interface->interface[i].addr, hoststr),
                          ntohs(host->interface->interface[i].port)));
        }
@@ -4075,7 +4086,7 @@ initInterfaceAddr_r(struct host *host, struct interfaceAddr *interf)
 /* deleted a HashChain structure for this address and host */
 /* returns 1 on success */
 int
-h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port, 
+h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port,
                                struct host *host)
 {
     char hoststr[16];
@@ -4084,9 +4095,9 @@ h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port,
     if (addr == 0 && port == 0)
        return 1;
 
-    for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp); 
+    for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp);
         hp = &th->next) {
-        assert(th->hostPtr);
+        osi_Assert(th->hostPtr);
         if (th->hostPtr == host && th->addr == addr && th->port == port) {
            ViceLog(125, ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d)\n",
                          host, afs_inet_ntoa_r(host->host, hoststr),
@@ -4096,9 +4107,9 @@ h_DeleteHostFromAddrHashTable_r(afs_uint32 addr, afs_uint16 port,
            return 1;
         }
     }
-    ViceLog(125, 
+    ViceLog(125,
            ("h_DeleteHostFromAddrHashTable_r: host %" AFS_PTR_FMT " (%s:%d) not found\n",
-            host, afs_inet_ntoa_r(host->host, hoststr), 
+            host, afs_inet_ntoa_r(host->host, hoststr),
             ntohs(host->port)));
     return 0;
 }