]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
make all the OBJH functions static, etc
authorwessels <>
Fri, 20 Feb 1998 06:28:38 +0000 (06:28 +0000)
committerwessels <>
Fri, 20 Feb 1998 06:28:38 +0000 (06:28 +0000)
src/cache_cf.cc
src/mem.cc
src/neighbors.cc
src/pconn.cc
src/protos.h
src/stat.cc

index ef3c3bfe3aa2eeaaa4084ed1f37f967cd4f79535..9e2c49d6a42efbdc123cf562c48291b4534b05a4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.248 1998/02/19 23:09:47 wessels Exp $
+ * $Id: cache_cf.cc,v 1.249 1998/02/19 23:28:38 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -72,6 +72,7 @@ static void parseBytesLine(size_t * bptr, const char *units);
 static size_t parseBytesUnits(const char *unit);
 static void free_all(void);
 static void requirePathnameExists(const char *name, const char *path);
+static OBJH dump_config;
 
 static void
 self_destruct(void)
index b156b620322a0d69029c88b8c36e54c6dcb0e626..b4cffd2d4101681ebe408ec932c19adad0959e09 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mem.cc,v 1.4 1998/02/19 23:09:54 wessels Exp $
+ * $Id: mem.cc,v 1.5 1998/02/19 23:28:39 wessels Exp $
  *
  * DEBUG: section 13    Memory Pool Management
  * AUTHOR: Harvest Derived
@@ -49,6 +49,13 @@ typedef struct {
 
 static memData MemData[MEM_MAX];
 
+static void * stackPop(Stack * s);
+static int stackFull(Stack * s);
+static int stackEmpty(Stack * s);
+static void stackPush(Stack * s, void *p);
+static void memDataInit(mem_type , const char *, size_t , int );
+static OBJH memStats;
+
 static int
 stackEmpty(Stack * s)
 {
@@ -248,7 +255,7 @@ memFreeMemory(void)
     }
 }
 
-void
+static void
 memStats(StoreEntry * sentry)
 {
     mem_type t;
index 54f0d81395c0d48657e1e302d1c8169d529f532b..148a78faf130b97b3e8243d445ad43e84f4493ad 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.175 1998/02/19 23:09:55 wessels Exp $
+ * $Id: neighbors.cc,v 1.176 1998/02/19 23:28:40 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -126,6 +126,9 @@ static void peerCountMcastPeersStart(void *data);
 static void peerCountMcastPeersSchedule(peer * p, time_t when);
 static IRCB peerCountHandleIcpReply;
 static void neighborIgnoreNonPeer(const struct sockaddr_in *, icp_opcode);
+static OBJH neighborDumpPeers;
+static OBJH neighborDumpNonPeers;
+static void dump_peers(StoreEntry * sentry, peer * peers);
 
 static icp_common_t echo_hdr;
 static u_short echo_port;
@@ -389,6 +392,9 @@ neighbors_open(int fd)
        echo_port = sep ? ntohs((u_short) sep->s_port) : 7;
     }
     first_ping = Config.peers;
+    cachemgrRegister("server_list",
+       "Peer Cache Statistics",
+       neighborDumpPeers, 0);
     cachemgrRegister("non_peers",
        "List of Unknown sites sending ICP messages",
        neighborDumpNonPeers, 0);
@@ -583,12 +589,6 @@ neighborIgnoreNonPeer(const struct sockaddr_in *from, icp_opcode opcode)
        np->stats.ignored_replies, np->host);
 }
 
-void
-neighborDumpNonPeers(StoreEntry * sentry)
-{
-    dump_peers(sentry, non_peers);
-}
-
 /* ignoreMulticastReply
  * 
  * We want to ignore replies from multicast peers if the
@@ -959,3 +959,73 @@ peerCountHandleIcpReply(peer * pnotused, peer_t type, icp_common_t * hdrnotused,
     ps_state *psstate = data;
     psstate->icp.n_recv++;
 }
+
+static void
+neighborDumpPeers(StoreEntry * sentry)
+{
+    dump_peers(sentry, Config.peers);
+}
+
+static void
+neighborDumpNonPeers(StoreEntry * sentry)
+{
+    dump_peers(sentry, non_peers);
+}
+
+static void
+dump_peers(StoreEntry * sentry, peer * peers)
+{
+    peer *e = NULL;
+    struct _domain_ping *d = NULL;
+    icp_opcode op;
+    if (peers == NULL)
+       storeAppendPrintf(sentry, "There are no neighbors installed.\n");
+    for (e = peers; e; e = e->next) {
+       assert(e->host != NULL);
+       storeAppendPrintf(sentry, "\n%-11.11s: %s/%d/%d\n",
+           neighborTypeStr(e),
+           e->host,
+           e->http_port,
+           e->icp_port);
+       storeAppendPrintf(sentry, "Status     : %s\n",
+           neighborUp(e) ? "Up" : "Down");
+       storeAppendPrintf(sentry, "AVG RTT    : %d msec\n", e->stats.rtt);
+       storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n",
+           (int) (squid_curtime - e->stats.last_query));
+       storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n",
+           (int) (squid_curtime - e->stats.last_reply));
+       storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent);
+       storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n",
+           e->stats.pings_acked,
+           percent(e->stats.pings_acked, e->stats.pings_sent));
+       storeAppendPrintf(sentry, "FETCHES    : %8d %3d%%\n",
+           e->stats.fetches,
+           percent(e->stats.fetches, e->stats.pings_acked));
+       storeAppendPrintf(sentry, "IGNORED    : %8d %3d%%\n",
+           e->stats.ignored_replies,
+           percent(e->stats.ignored_replies, e->stats.pings_acked));
+       storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
+       for (op = ICP_INVALID; op < ICP_END; op++) {
+           if (e->stats.counts[op] == 0)
+               continue;
+           storeAppendPrintf(sentry, "    %12.12s : %8d %3d%%\n",
+               icp_opcode_str[op],
+               e->stats.counts[op],
+               percent(e->stats.counts[op], e->stats.pings_acked));
+       }
+       if (e->last_fail_time) {
+           storeAppendPrintf(sentry, "Last failed connect() at: %s\n",
+               mkhttpdlogtime(&(e->last_fail_time)));
+       }
+       if (e->pinglist != NULL)
+           storeAppendPrintf(sentry, "DOMAIN LIST: ");
+       for (d = e->pinglist; d; d = d->next) {
+           if (d->do_ping)
+               storeAppendPrintf(sentry, "%s ", d->domain);
+           else
+               storeAppendPrintf(sentry, "!%s ", d->domain);
+       }
+       storeAppendPrintf(sentry, "Keep-Alive Ratio: %d%%\n",
+           percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
+    }
+}
index 3ddbf11ae781d06846334538f20c33144b26ae4e..d210fac169260b428356ddc7c170912cdc7439e4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: pconn.cc,v 1.11 1998/02/19 23:09:57 wessels Exp $
+ * $Id: pconn.cc,v 1.12 1998/02/19 23:28:40 wessels Exp $
  *
  * DEBUG: section 48    Persistent Connections
  * AUTHOR: Duane Wessels
@@ -40,6 +40,10 @@ struct _pconn {
     int nfds;
 };
 
+#define PCONN_HIST_SZ 256
+int client_pconn_hist[PCONN_HIST_SZ];
+int server_pconn_hist[PCONN_HIST_SZ];
+
 static PF pconnRead;
 static PF pconnTimeout;
 static const char *pconnKey(const char *host, u_short port);
@@ -47,7 +51,7 @@ static hash_table *table = NULL;
 static struct _pconn *pconnNew(const char *key);
 static void pconnDelete(struct _pconn *p);
 static void pconnRemoveFD(struct _pconn *p, int fd);
-
+static OBJH pconnHistDump;
 
 static const char *
 pconnKey(const char *host, u_short port)
@@ -122,8 +126,13 @@ pconnRead(int fd, void *data)
 void
 pconnInit(void)
 {
+    int i;
     assert(table == NULL);
     table = hash_create((HASHCMP *) strcmp, 229, hash_string);
+    for (i = 0; i < PCONN_HIST_SZ; i++) {
+        client_pconn_hist[i] = 0;
+        server_pconn_hist[i] = 0;
+    }
     cachemgrRegister("pconn",
        "Persistent Connection Utilization Histograms",
        pconnHistDump, 0);
@@ -175,3 +184,46 @@ pconnPop(const char *host, u_short port)
     }
     return fd;
 }
+
+void
+pconnHistCount(int what, int i)
+{
+    if (i >= PCONN_HIST_SZ)
+        i = PCONN_HIST_SZ - 1;
+    /* what == 0 for client, 1 for server */
+    if (what == 0)
+        client_pconn_hist[i]++;
+    else if (what == 1)
+        server_pconn_hist[i]++;
+    else
+        assert(0);
+}
+
+static void
+pconnHistDump(StoreEntry * e)
+{
+    int i;
+    storeAppendPrintf(e,
+        "Client-side persistent connection counts:\n"
+        "\n"
+        "\treq/\n"
+        "\tconn      count\n"
+        "\t----  ---------\n");
+    for (i = 0; i < PCONN_HIST_SZ; i++) {
+        if (client_pconn_hist[i] == 0)
+            continue;
+        storeAppendPrintf(e, "\t%4d  %9d\n", i, client_pconn_hist[i]);
+    }
+    storeAppendPrintf(e,
+        "\n"
+        "Server-side persistent connection counts:\n"
+        "\n"
+        "\treq/\n"
+        "\tconn      count\n"
+        "\t----  ---------\n");
+    for (i = 0; i < PCONN_HIST_SZ; i++) {
+        if (server_pconn_hist[i] == 0)
+            continue;
+        storeAppendPrintf(e, "\t%4d  %9d\n", i, server_pconn_hist[i]);
+    }
+}
index 2a9fed3767f8a56345b03e5afaec907a5fb426fb..5b54a101a53c087f563708d341b121843f0dd511 100644 (file)
@@ -317,6 +317,7 @@ extern int neighborUp(const peer * e);
 extern void peerDestroy(peer * e);
 extern char *neighborTypeStr(const peer * e);
 extern void peerCheckConnectStart(peer *);
+extern void dump_peers(StoreEntry *, peer *);
 
 extern void netdbInit(void);
 
@@ -383,7 +384,6 @@ extern void memFree4K(void *);
 extern void memFree8K(void *);
 extern void memFreeDISK(void *);
 extern int memInUse(mem_type);
-extern OBJH memStats;
 
 extern int stmemFreeDataUpto(mem_hdr *, int);
 extern void stmemAppend(mem_hdr *, const char *, int);
@@ -509,6 +509,7 @@ extern int storeVerifyCacheDirs(void);
 extern int storeDirWriteCleanLogs(int reopen);
 extern int storeDirValidFileno(int fn);
 extern int storeFilenoBelongsHere(int, int, int, int);
+extern OBJH storeDirStats;
 
 
 /*
@@ -620,23 +621,6 @@ extern void errorInitialize(void);
 extern void errorFree(void);
 extern ErrorState *errorCon(err_type, http_status);
 
-extern OBJH stat_io_get;
-extern OBJH stat_objects_get;
-extern OBJH stat_vmobjects_get;
-extern OBJH stat_utilization_get;
-extern OBJH statFiledescriptors;
-extern OBJH log_enable;
-extern OBJH info_get;
-extern OBJH server_list;
-extern OBJH neighborDumpNonPeers;
-extern OBJH dump_config;
-extern OBJH storeDirStats;
-extern OBJH pconnHistDump;
-extern void dump_peers(StoreEntry *, peer *);
-extern OBJH statCounters;
-extern OBJH statAvg5min;
-extern OBJH statAvg60min;
-
 extern void pconnPush(int, const char *host, u_short port);
 extern int pconnPop(const char *host, u_short port);
 extern void pconnInit(void);
index 49bdd47213f5aa0159b095fc9730274198f3c278..2bb7480cf740d14b1040b9dd165d2188cf2759e4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.201 1998/02/19 23:10:00 wessels Exp $
+ * $Id: stat.cc,v 1.202 1998/02/19 23:28:42 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -120,15 +120,19 @@ static int statLogHistBin(StatLogHist *, double);
 static double statLogHistVal(StatLogHist *, double);
 static double statLogHistDeltaMedian(StatLogHist * A, StatLogHist * B);
 static void statLogHistDump(StoreEntry * sentry, StatLogHist * H);
+static OBJH stat_io_get;
+static OBJH stat_objects_get;
+static OBJH stat_vmobjects_get;
+static OBJH info_get;
+static OBJH statFiledescriptors;
+static OBJH statCounters;
+static OBJH statAvg5min;
+static OBJH statAvg60min;
 
 #ifdef XMALLOC_STATISTICS
 static void info_get_mallstat(int, int, StoreEntry *);
 #endif
 
-#define PCONN_HIST_SZ 256
-int client_pconn_hist[PCONN_HIST_SZ];
-int server_pconn_hist[PCONN_HIST_SZ];
-
 /*
  * An hour's worth, plus the 'current' counter
  */
@@ -325,70 +329,6 @@ stat_vmobjects_get(StoreEntry * e)
     statObjects(e, 1);
 }
 
-void
-server_list(StoreEntry * sentry)
-{
-    dump_peers(sentry, Config.peers);
-}
-
-void
-dump_peers(StoreEntry * sentry, peer * peers)
-{
-    peer *e = NULL;
-    struct _domain_ping *d = NULL;
-    icp_opcode op;
-    if (peers == NULL)
-       storeAppendPrintf(sentry, "There are no neighbors installed.\n");
-    for (e = peers; e; e = e->next) {
-       assert(e->host != NULL);
-       storeAppendPrintf(sentry, "\n%-11.11s: %s/%d/%d\n",
-           neighborTypeStr(e),
-           e->host,
-           e->http_port,
-           e->icp_port);
-       storeAppendPrintf(sentry, "Status     : %s\n",
-           neighborUp(e) ? "Up" : "Down");
-       storeAppendPrintf(sentry, "AVG RTT    : %d msec\n", e->stats.rtt);
-       storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n",
-           (int) (squid_curtime - e->stats.last_query));
-       storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n",
-           (int) (squid_curtime - e->stats.last_reply));
-       storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent);
-       storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n",
-           e->stats.pings_acked,
-           percent(e->stats.pings_acked, e->stats.pings_sent));
-       storeAppendPrintf(sentry, "FETCHES    : %8d %3d%%\n",
-           e->stats.fetches,
-           percent(e->stats.fetches, e->stats.pings_acked));
-       storeAppendPrintf(sentry, "IGNORED    : %8d %3d%%\n",
-           e->stats.ignored_replies,
-           percent(e->stats.ignored_replies, e->stats.pings_acked));
-       storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
-       for (op = ICP_INVALID; op < ICP_END; op++) {
-           if (e->stats.counts[op] == 0)
-               continue;
-           storeAppendPrintf(sentry, "    %12.12s : %8d %3d%%\n",
-               icp_opcode_str[op],
-               e->stats.counts[op],
-               percent(e->stats.counts[op], e->stats.pings_acked));
-       }
-       if (e->last_fail_time) {
-           storeAppendPrintf(sentry, "Last failed connect() at: %s\n",
-               mkhttpdlogtime(&(e->last_fail_time)));
-       }
-       if (e->pinglist != NULL)
-           storeAppendPrintf(sentry, "DOMAIN LIST: ");
-       for (d = e->pinglist; d; d = d->next) {
-           if (d->do_ping)
-               storeAppendPrintf(sentry, "%s ", d->domain);
-           else
-               storeAppendPrintf(sentry, "!%s ", d->domain);
-       }
-       storeAppendPrintf(sentry, "Keep-Alive Ratio: %d%%\n",
-           percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent));
-    }
-}
-
 #ifdef XMALLOC_STATISTICS
 static void
 info_get_mallstat(int size, int number, StoreEntry * sentry)
@@ -750,10 +690,6 @@ statInit(void)
 {
     int i;
     debug(18, 5) ("statInit: Initializing...\n");
-    for (i = 0; i < PCONN_HIST_SZ; i++) {
-       client_pconn_hist[i] = 0;
-       server_pconn_hist[i] = 0;
-    }
     memset(CountHist, '\0', N_COUNT_HIST * sizeof(StatCounters));
     for (i = 0; i < N_COUNT_HIST; i++)
        statCounterInit(&CountHist[i]);
@@ -783,52 +719,6 @@ statInit(void)
     cachemgrRegister("60min",
        "60 Minute Average of Counters",
        statAvg60min, 0);
-    cachemgrRegister("server_list",
-       "Neighbor Cache Stats",
-       server_list, 0);
-}
-
-void
-pconnHistCount(int what, int i)
-{
-    if (i >= PCONN_HIST_SZ)
-       i = PCONN_HIST_SZ - 1;
-    /* what == 0 for client, 1 for server */
-    if (what == 0)
-       client_pconn_hist[i]++;
-    else if (what == 1)
-       server_pconn_hist[i]++;
-    else
-       assert(0);
-}
-
-void
-pconnHistDump(StoreEntry * e)
-{
-    int i;
-    storeAppendPrintf(e,
-       "Client-side persistent connection counts:\n"
-       "\n"
-       "\treq/\n"
-       "\tconn      count\n"
-       "\t----  ---------\n");
-    for (i = 0; i < PCONN_HIST_SZ; i++) {
-       if (client_pconn_hist[i] == 0)
-           continue;
-       storeAppendPrintf(e, "\t%4d  %9d\n", i, client_pconn_hist[i]);
-    }
-    storeAppendPrintf(e,
-       "\n"
-       "Server-side persistent connection counts:\n"
-       "\n"
-       "\treq/\n"
-       "\tconn      count\n"
-       "\t----  ---------\n");
-    for (i = 0; i < PCONN_HIST_SZ; i++) {
-       if (server_pconn_hist[i] == 0)
-           continue;
-       storeAppendPrintf(e, "\t%4d  %9d\n", i, server_pconn_hist[i]);
-    }
 }
 
 static void