viced-server-shutdown-diagnostics-20011005
[openafs.git] / src / viced / host.c
index d7fcaad..79d3fe3 100644 (file)
@@ -7,8 +7,8 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#include <afs/param.h>
 #include <afsconfig.h>
+#include <afs/param.h>
 
 RCSID("$Header$");
 
@@ -114,8 +114,10 @@ static void GetCEBlock()
     register int i;
 
     block = (struct CEBlock *)malloc(sizeof(struct CEBlock));
-    if (!block)
+    if (!block) {
+       ViceLog(0, ("Failed malloc in GetCEBlock\n"));
        ShutDownAndCore(PANIC);
+    }
 
     for(i = 0; i < (CESPERBLOCK -1); i++) {
        Lock_Init(&block->entry[i].lock);
@@ -137,13 +139,15 @@ static struct client *GetCE()
 
     if (CEFree == 0)
        GetCEBlock();
-    if (CEFree == 0)
+    if (CEFree == 0) {
+       ViceLog(0, ("CEFree NULL in GetCE\n"));
        ShutDownAndCore(PANIC);
+    }
 
     entry = CEFree;
     CEFree = entry->next;
     CEs++;
-    bzero((char *)entry, CLIENT_TO_ZERO(entry));
+    memset((char *)entry, 0, CLIENT_TO_ZERO(entry));
     return(entry);
 
 } /*GetCE*/
@@ -193,8 +197,10 @@ static void GetHTBlock()
     static int index = 0;
 
     block = (struct HTBlock *)malloc(sizeof(struct HTBlock));
-    if (!block)
+    if (!block) {
+       ViceLog(0, ("Failed malloc in GetHTBlock\n"));
        ShutDownAndCore(PANIC);
+    }
 
 #ifdef AFS_PTHREAD_ENV
     for(i=0; i < (h_HTSPERBLOCK); i++)
@@ -225,7 +231,7 @@ static struct host *GetHT()
     entry = HTFree;
     HTFree = entry->next;
     HTs++;
-    bzero((char *)entry, HOST_TO_ZERO(entry));
+    memset((char *)entry, 0, HOST_TO_ZERO(entry));
     return(entry);
 
 } /*GetHT*/
@@ -1590,8 +1596,8 @@ static int h_DumpHost(host, held, file)
     char tmpStr[256];
 
     H_LOCK
-    sprintf(tmpStr, "ip:%x holds:%d port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
-           host->host, host->holds, host->port, host->index, host->cblist,
+    sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
+           host->host, host->port, host->index, host->cblist,
            CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
            (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
            host->Console, host->hostFlags & CLIENTDELETED, 
@@ -1609,8 +1615,16 @@ static int h_DumpHost(host, held, file)
            sprintf(tmpStr, " %x", host->interface->addr[i]);
            STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
        }
-    sprintf(tmpStr, "]\n");
+    sprintf(tmpStr, "] holds: ");
     STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
+
+    for (i = 0 ; i < h_maxSlots ; i++) {
+      sprintf(tmpStr, "%04x", host->holds[i]);
+      STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
+    }
+    sprintf(tmpStr, " slot/bit: %d/%d\n", h_holdSlot(), h_holdbit());
+    STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
+
     H_UNLOCK
     return held;
 
@@ -1981,7 +1995,7 @@ h_CheckHosts() {
 
     afs_uint32 now = FT_ApproxTime();
 
-    bzero((char *)&zerofid, sizeof(zerofid));
+    memset((char *)&zerofid, 0, sizeof(zerofid));
     /*
      * Send a probe to the workstation if it hasn't been heard from in
      * 15 minutes