Warning fix: print burstWait fields
[openafs.git] / src / libadmin / samples / rxdebug_peers.c
index 84b6d86..fae6001 100644 (file)
@@ -5,6 +5,8 @@
  * 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
+ *
+ * Portions Copyright (c) 2003 Apple Computer, Inc.
  */
 
 /*
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header$");
+#ifdef IGNORE_SOME_GCC_WARNINGS
+ # pragma GCC diagnostic warning "-Wformat"
+#endif
+
 
 #ifdef AFS_NT40_ENV
 #include <winsock2.h>
 #include <pthread.h>
 #endif
+
+#include <rx/rx.h>
+#include <rx/rxstat.h>
+
 #include <afs/afs_Admin.h>
 #include <afs/afs_clientAdmin.h>
 #include <afs/afs_utilAdmin.h>
 
-void Usage()
+#ifdef AFS_DARWIN_ENV
+pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif /* AFS_DARWIN_ENV */
+
+void
+Usage(void)
 {
-    fprintf(stderr,
-           "Usage: rxdebug_peers <host> <port>\n");
+    fprintf(stderr, "Usage: rxdebug_peers <host> <port>\n");
     exit(1);
 }
 
-void ParseArgs(
-    int argc,
-    char *argv[],
-    char **srvrName,
-    long *srvrPort)
+void
+ParseArgs(int argc, char *argv[], char **srvrName, long *srvrPort)
 {
     char **argp = argv;
 
@@ -51,7 +63,8 @@ void ParseArgs(
        Usage();
 }
 
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
 {
     int rc;
     afs_status_t st = 0;
@@ -61,7 +74,6 @@ int main(int argc, char *argv[])
     void *iterator;
     struct rx_debugPeer peer;
     afs_uint32 supportedValues;
-    int i;
 
     ParseArgs(argc, argv, &srvrName, &srvrPort);
 
@@ -85,20 +97,21 @@ int main(int argc, char *argv[])
 
     while (util_RXDebugPeersNext(iterator, &peer, &supportedValues, &st)) {
        printf("\n");
-       printf("host:            %u.%u.%u.%u\n",
-              (peer.host >> 24) & 0xff, (peer.host >> 16) & 0xff,
-              (peer.host >> 8) & 0xff, peer.host & 0xff);
+       printf("host:            %u.%u.%u.%u\n", (peer.host >> 24) & 0xff,
+              (peer.host >> 16) & 0xff, (peer.host >> 8) & 0xff,
+              peer.host & 0xff);
        printf("port:            %u\n", peer.port);
        printf("ifMTU:           %u\n", peer.ifMTU);
        printf("idleWhen:        %u\n", peer.idleWhen);
        printf("refCount:        %u\n", peer.refCount);
        printf("burstSize:       %u\n", peer.burstSize);
        printf("burst:           %u\n", peer.burst);
-       printf("burstWait:       %u\n", peer.burstWait);
+       printf("burstWait:       %u.%06u\n", peer.burstWait.sec,
+              peer.burstWait.usec);
        printf("rtt:             %u\n", peer.rtt);
        printf("rtt_dev:         %u\n", peer.rtt_dev);
-       printf("timeout:         %u.%06u\n",
-              peer.timeout.sec, peer.timeout.usec);
+       printf("timeout:         %u.%06u\n", peer.timeout.sec,
+              peer.timeout.usec);
        printf("nSent:           %u\n", peer.nSent);
        printf("reSends:         %u\n", peer.reSends);
        printf("inPacketSkew:    %u\n", peer.inPacketSkew);
@@ -112,10 +125,10 @@ int main(int argc, char *argv[])
        printf("cwind:           %u\n", peer.cwind);
        printf("nDgramPackets:   %u\n", peer.nDgramPackets);
        printf("congestSeq:      %u\n", peer.congestSeq);
-       printf("bytesSent:       (%u.%u)\n",
-              hgethi(peer.bytesSent), hgetlo(peer.bytesSent));
-       printf("bytesReceived:   (%u.%u)\n",
-              hgethi(peer.bytesReceived), hgetlo(peer.bytesReceived));
+       printf("bytesSent:       (%u.%u)\n", hgethi(peer.bytesSent),
+              hgetlo(peer.bytesSent));
+       printf("bytesReceived:   (%u.%u)\n", hgethi(peer.bytesReceived),
+              hgetlo(peer.bytesReceived));
     }
     if (st != ADMITERATORDONE) {
        fprintf(stderr, "util_RXDebugPeersNext, status %d\n", st);