openafs-void-star-pointers-20071031
[openafs.git] / src / venus / kdump.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 RCSID
14     ("$Header$");
15
16 #include <stdio.h>
17 #include <errno.h>
18 #include <stdlib.h>             /* for malloc() */
19
20 /* Here be hacks. */
21 #ifdef AFS_LINUX24_ENV
22 #define __KERNEL__
23 #include <linux/string.h>
24 #define _STRING_H 1
25 #define _SYS_STATFS_H 1
26 #define _BITS_SIGCONTEXT_H 1
27 #undef USE_UCONTEXT
28 #endif
29
30 #ifdef AFS_LINUX26_ENV
31 /* For some reason, this doesn't get defined in linux/types.h
32    if __KERNEL_STRICT_NAMES is defined. But the definition of
33    struct inode uses it.
34 */
35 #ifndef pgoff_t
36 #define pgoff_t unsigned long
37 #endif
38 #endif
39
40 #include <string.h>
41
42 #ifdef __linux__
43 #define _CFS_HEADER_
44 #define _AFFS_FS_I
45 #define _NFS_FS_I
46 #define _SYSV_FS_SB
47 #define _AFFS_FS_SB
48 #define _NFS_FS_SB
49 #define __LINUX_UFS_FS_SB_H
50 #define _SYSV_FS_I
51 #define _LINUX_CODA_FS_I
52 #define _LINUX_NTFS_FS_SB_H
53 #define _LINUX_NTFS_FS_I_H
54 #define _NCP_FS_SB
55 struct sysv_sb_info {
56 };
57 struct affs_sb_info {
58 };
59 struct ufs_sb_info {
60 };
61 struct nfs_sb_info {
62 };
63 struct nfs_inode_info {
64 };
65 struct sysv_inode_info {
66 };
67 struct coda_inode_info {
68 };
69 struct affs_inode_info {
70 };
71 struct nfs_lock_info {
72 };
73 struct ntfs_sb_info {
74 };
75 struct ntfs_inode_info {
76 };
77 struct ncp_sb_info {
78 };
79 #include <linux/types.h>
80 #define u32 unsigned int
81 #define s32 int
82 #define u16 unsigned short
83 #include <features.h>
84 #if __GLIBC_MINOR__ >= 2
85 #define _SYS_TYPES_H 1
86 #endif
87 #define __KERNEL__
88 #endif
89
90 /* This tells afs.h to pick up afs_args from the dest tree. */
91 #define KDUMP_KERNEL
92
93 /*
94  * Need to include <netdb.h> before _KERNEL is defined since on IRIX 6.5
95  * <netdb.h> includes <netinet/in.h>, which in turn declares inet_addr()
96  * if _KERNEL is defined.  This declaration conflicts with that in
97  * <arpa/inet.h>.
98  */
99 #if     ! defined(AFS_AIX_ENV)
100 #include <netdb.h>
101 #endif
102
103 /* For AFS_SGI61_ENV and a 64 bit OS, _KMEMUSER should be defined on the
104  * compile line for kdump.o in the Makefile. This lets us pick up
105  * app32_ptr_t from types.h when included from afs/param.h.
106  */
107 #ifdef AFS_SGI62_ENV
108 #define _KERNEL 1
109 #endif
110
111 #ifndef AFS_OSF_ENV
112 #include <sys/param.h>
113 #endif
114
115 #ifndef AFS_LINUX20_ENV
116 #include <nlist.h>
117 #endif
118
119 #ifdef AFS_HPUX_ENV
120 #include <a.out.h>
121 #endif
122
123 #include <afs/stds.h>
124 #include <sys/types.h>
125
126 #if defined(AFS_OSF_ENV)
127 #define KERNEL
128 #define UNIX_LOCKS
129 #define _KERNEL 1
130 #ifdef  _KERN_LOCK_H_
131 #include FFFFF
132 #endif
133 #include <sys/time.h>
134 #include <kern/lock.h>
135 #include <sys/vnode.h>
136 #include <arch/alpha/pmap.h>
137
138 /*
139  * beginning with DUX 4.0A, the system header files define the macros
140  *
141  * KSEG_TO_PHYS()
142  * IS_KSEG_VA()
143  * IS_SEG1_VA()
144  *
145  * to be calls to the kernel functions
146  *
147  * kseg_to_phys()
148  * is_kseg_va()
149  * is_seg1_va()
150  * 
151  * when _KERNEL is defined, and expressions otherwise.  Since need
152  * to define _KERNEL, we redefine these kernel functions as macros
153  * for the expressions that we would have gotten if _KERNEL had not
154  * been defined.  Yes, this duplicates code from the header files, but
155  * there's no simple way around it.
156  */
157
158 #define kseg_to_phys(addr) ((vm_offset_t)(addr) - UNITY_BASE)
159 #define is_kseg_va(x)   (((unsigned long)(x) & SEG1_BASE) == UNITY_BASE)
160 #define is_seg1_va(x)   (((unsigned long)(x) & SEG1_BASE) == SEG1_BASE)
161
162 #undef  KERNEL
163 #undef  _KERNEL
164 #endif
165
166 #ifdef  AFS_SUN5_ENV /*XXXXX*/
167 #include <sys/t_lock.h>
168 struct vnode foo;
169 #ifdef  AFS_SUN54_ENV
170 #else
171 #ifdef  AFS_SUN52_ENV
172 typedef struct stat_mutex stat_mutex_t;
173 #define kmutex_t                stat_mutex_t
174 #else
175 typedef struct adaptive_mutex2 adaptive_mutex2_t;
176 #define kmutex_t        adaptive_mutex2_t
177 #endif
178 #endif
179 #endif
180
181 #ifdef AFS_SGI53_ENV
182 #define _KERNEL 1
183 #include <sys/sema.h>
184 #ifndef AFS_SGI62_ENV
185 #undef _KERNEL 1
186 #endif
187 #endif
188
189 #ifdef AFS_SGI62_ENV
190 #include <sys/fcntl.h>
191 #ifndef L_SET
192 #define L_SET 0
193 #endif
194 #endif
195
196 #include <sys/param.h>
197
198 #ifndef AFS_SGI64_ENV
199 #include <sys/user.h>
200 #endif
201
202 #ifndef AFS_LINUX20_ENV
203 #include <sys/socket.h>
204 #endif
205
206 #ifndef AFS_LINUX26_ENV
207 #include <sys/file.h>
208 #endif
209
210 /*
211  * On SGIs, when _KERNEL is defined, <netinet/in.h> declares inet_addr()
212  * in a way that conflicts with the declaration in <arpa/inet.h>.
213  *
214  * Here we bring in <netinet/in.h> without _KERNEL defined and restore
215  * _KERNEL afterwards if needed.
216  *
217  * A better solution might be to straighten out which #includes are
218  * sensitive to _KERNEL on SGIs....
219  */
220 #if defined(AFS_SGI_ENV) && defined(_KERNEL)
221 # undef _KERNEL
222 # include <netinet/in.h>        /* struct in_addr */
223 # define _KERNEL 1
224 #else
225 # include <netinet/in.h>        /* struct in_addr */
226 #endif
227
228 #include <arpa/inet.h>          /* inet_ntoa() */
229
230 #if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
231 #ifdef       AFS_SGI_ENV
232 #include <sys/vnode.h>
233 #endif /* AFS_SGI_ENV */
234 #else
235 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
236 #include <sys/vnode.h>
237 #include <sys/mount.h>
238 #include <ufs/ufs/quota.h>
239 #include <ufs/ufs/inode.h>
240 #include <ufs/ffs/fs.h>
241 #else
242 #include "sys/vfs.h"
243 #ifdef AFS_LINUX20_ENV
244 #ifndef UIO_MAXIOV
245 #define UIO_MAXIOV 1            /* don't care */
246 #endif
247 #if __GLIBC_MINOR__ == 0
248 #include <iovec.h>
249 #endif
250 /*#define _TIME_H*/
251 /*#define _SYS_UIO_H */
252 #define _LINUX_SOCKET_H
253 #undef INT_MAX
254 #undef UINT_MAX
255 #undef LONG_MAX
256 #undef ULONG_MAX
257 #define _LINUX_TIME_H
258 #ifndef AFS_LINUX26_ENV
259 #define _LINUX_FCNTL_H
260 #endif
261 #ifdef AFS_IA64_LINUX24_ENV
262 #define flock64  flock
263 #endif /* AFS_IA64_LINUX24_ENV */
264 #ifdef AFS_S390_LINUX20_ENV
265 #define _S390_STATFS_H
266 #else
267 #ifdef AFS_SPARC64_LINUX20_ENV
268 #define _SPARC64_STATFS_H
269 #define _SPARC_STATFS_H
270 #else
271 #ifdef AFS_SPARC_LINUX20_ENV
272 #define _SPARC_STATFS_H
273 #else
274 #ifdef AFS_ALPHA_LINUX20_ENV
275 #define _ALPHA_STATFS_H
276 #else
277 #define _I386_STATFS_H
278 #endif /* AFS_ALPHA_LINUX20_ENV */
279 #endif /* AFS_SPARC_LINUX20_ENV */
280 #endif /* AFS_SPARC64_LINUX20_ENV */
281 #endif /* AFS_S390_LINUX20_ENV */
282 struct timezone {
283     int a, b;
284 };
285 #if 0                           /*ndef AFS_ALPHA_LINUX20_ENV */
286 typedef struct timeval {
287     int tv_sec;
288     int tv_usec;
289 } timeval_t;                    /* Needed here since KERNEL defined. */
290 #endif /*AFS_ALPHA_LINUX20_ENV */
291 #if defined(WORDS_BIGENDIAN)
292 #define _LINUX_BYTEORDER_BIG_ENDIAN_H
293 #else
294 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
295 #endif
296 /* Avoid problems with timer_t redefinition */
297 #ifndef timer_t
298 #define timer_t ktimer_t
299 #define timer_t_redefined
300 #endif
301 #ifdef AFS_LINUX26_ENV
302 /* For some reason, this doesn't get defined in linux/types.h
303    if __KERNEL_STRICT_NAMES is defined. But the definition of
304    struct inode uses it.
305 */
306 #ifndef HAVE_SECTOR_T
307 /* got it from linux/types.h */
308 typedef unsigned long sector_t;
309 #endif /* HAVE_SECTOR_T */
310 #endif /* AFS_LINUX26_ENV */
311 #include <linux/version.h>
312 #include <linux/fs.h>
313 #include <osi_vfs.h>
314 #ifdef timer_t_redefined
315 #undef timer_t
316 #undef timer_t_redefined
317 #endif
318 #else /* AFS_LINUX20_ENV */
319 #ifdef AFS_HPUX110_ENV
320 #define  KERNEL
321 #define  _KERNEL 1
322 /* Declare following so sys/vnode.h will compile with KERNEL defined */
323 #define FILE FILe
324 typedef enum _spustate {        /* FROM /etc/conf/h/_types.h */
325     SPUSTATE_NONE = 0,          /* must be 0 for proper initialization */
326     SPUSTATE_IDLE,              /* spu is idle */
327     SPUSTATE_USER,              /* spu is in user mode */
328     SPUSTATE_SYSTEM,            /* spu is in system mode */
329     SPUSTATE_UNKNOWN,           /* utility code for NEW_INTERVAL() */
330     SPUSTATE_NOCHANGE           /* utility code for NEW_INTERVAL() */
331 } spustate_t;
332 #define k_off_t off_t
333 #include "sys/vnode.h"
334 #undef KERNEL
335 #undef _KERNEL
336 #else /* AFS_HPUX110_ENV */
337 #include "sys/vnode.h"
338 #endif /* else AFS_HPUX110_ENV */
339 #endif /* else AFS_LINUX20_ENV */
340 #ifdef  AFS_HPUX_ENV
341 #include "sys/inode.h"
342 #else
343 #ifndef AFS_AIX_ENV
344 #ifdef  AFS_SUN5_ENV
345 #include "sys/fs/ufs_inode.h"
346 #else
347 #ifndef AFS_LINUX20_ENV
348 #include "ufs/inode.h"
349 #endif
350 #endif
351 #endif
352 #endif
353 #endif
354 #include <signal.h>
355 #endif
356
357 /* AFS includes */
358 #ifdef AFS_AIX41_ENV
359 /* This definition is in rx_machdep.h, currently only for AIX 41 */
360 #define RX_ENABLE_LOCKS
361 /* The following two defines are from rx_machdep.h and are used in rx_
362  * structures.
363  */
364 #define afs_kmutex_t int
365 #define afs_kcondvar_t int
366 #endif /* AFS_AIX41_ENV */
367
368
369 #ifdef AFS_SUN5_ENV
370
371 #define RX_ENABLE_LOCKS
372
373 /**
374   * Removed redefinitions of afs_kmutex_t and afs_kcondvar_t and included
375   * the system header files in which they are defined
376   */
377 #include <sys/mutex.h>
378 #include <sys/condvar.h>
379 typedef kmutex_t afs_kmutex_t;
380 typedef kcondvar_t afs_kcondvar_t;
381 #endif /* AFS_SUN5_ENV */
382
383 #ifdef AFS_DUX40_ENV
384 #define RX_ENABLE_LOCKS
385 typedef struct {
386     unsigned long lock;
387     void *owner;
388 } afs_kmutex_t;
389 typedef int afs_kcondvar_t;
390 #endif /* AFS_DUX40_ENV */
391
392 #ifdef AFS_HPUX110_ENV
393 #define RX_ENABLE_LOCKS
394 typedef struct {
395     void *s_lock;
396     int count;
397     long sa_fill1;
398     void *wait_list;
399     void *sa_fill2[2];
400     int sa_fill2b[2];
401     long sa_fill2c[3];
402     int sa_fill2d[16];
403     int order;
404     int sa_fill3;
405 } afs_kmutex_t;
406 typedef char *afs_kcondvar_t;
407 #endif /* AFS_HPUX110_ENV */
408
409 #ifdef AFS_SGI65_ENV
410 #define RX_ENABLE_LOCKS 1
411 typedef struct {
412     __psunsigned_t opaque1;
413     void *opaque2;
414 } afs_kmutex_t;
415 typedef struct {
416     __psunsigned_t opaque;
417 } afs_kcondvar_t;
418 #endif /* AFS_SGI65_ENV */
419
420 #ifdef AFS_LINUX20_ENV
421 #include <asm/atomic.h>
422 #include <asm/semaphore.h>
423 #define RX_ENABLE_LOCKS 1
424 typedef struct {
425     struct semaphore opaque1;
426     int opaque2;
427 } afs_kmutex_t;
428 typedef void *afs_kcondvar_t;
429 #endif /* AFS_LINUX20_ENV */
430
431 #include <afs/exporter.h>
432 /*#include "afs/osi.h"*/
433
434 typedef struct {
435     int tv_sec;
436     int tv_usec;
437 } osi_timeval_t;                /* Needed here since KERNEL defined. */
438
439 /*#include "afs/volerrors.h"*/
440 #ifdef AFS_LINUX20_ENV
441 #define _SYS_TIME_H
442 #endif
443
444 #include <afs/afsint.h>
445 #include "vlserver/vldbint.h"
446 #include "afs/lock.h"
447
448 #define KERNEL
449
450 #ifndef notdef
451 #define AFS34
452 #define AFS33
453 #define AFS32a
454 #else
455 #define AFS32
456 #endif
457
458
459 #ifdef AFS_SGI61_ENV
460 extern off64_t lseek64();
461 #define KDUMP_SIZE_T size_t
462 #else /* AFS_SGI61_ENV */
463 #define KDUMP_SIZE_T int
464 #endif /* AFS_SGI61_ENV */
465
466 #include "afs/afs.h"            /* XXXX Getting it from the obj tree XXX */
467 #include "afs/afs_axscache.h"   /* XXXX Getting it from the obj tree XXX */
468 #include <afs/afs_stats.h>
469 #include <afs/nfsclient.h>
470
471 #include <afs/cmd.h>
472 #include <rx/rx.h>
473
474
475 #undef  KERNEL
476
477 #if defined(AFS_OSF_ENV) && !defined(v_count)
478 #define v_count         v_usecount
479 #endif
480
481 #ifdef  AFS_OSF_ENV
482 #define KERNELBASE      0x80000000
483 #define coreadj(x)      ((int)x - KERNELBASE)
484 #endif
485
486 #if defined(AFS_SGI_ENV)
487 #define UNIX "/unix"
488 #else
489 #if     defined(AFS_HPUX100_ENV)
490 #define UNIX "/stand/vmunix"
491 #else
492 #ifdef  AFS_HPUX_ENV
493 #define UNIX  "/hp-ux"
494 #else
495 #ifdef  AFS_SUN5_ENV
496 #define UNIX  "/dev/ksyms"
497 #else
498 #define UNIX  "/vmunix"
499 #endif
500 #endif /* AFS_HPUX_ENV */
501 #endif /* AFS_HPUX100_ENV */
502 #endif /* AFS_SGI_ENV */
503
504 #if     defined(AFS_SUN5_ENV)
505 #define CORE "/dev/mem"
506 #else
507 #define CORE "/dev/kmem"
508 #endif
509
510 /* Forward declarations */
511 void print_Conns();
512 void print_cbHash();
513 void print_DindexTimes();
514 void print_DdvnextTbl();
515 void print_DdcnextTbl();
516 void print_DindexFlags();
517 void print_buffers();
518 void print_allocs();
519 void kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len);
520 void print_exporter();
521 void print_nfsclient();
522 void print_unixuser();
523 void print_cell();
524 void print_server();
525 void print_conns();
526 void print_conn();
527 void print_volume();
528 void print_venusfid();
529 void print_vnode();
530 void print_vcache();
531 void print_dcache();
532 void print_bkg();
533 void print_vlru();
534 void print_dlru();
535 void print_callout();
536 void print_dnlc();
537 void print_global_locks();
538 void print_global_afs_resource();
539 void print_global_afs_cache();
540 void print_rxstats();
541 void print_rx();
542 void print_services();
543 #ifdef KDUMP_RX_LOCK
544 void print_peertable_lock();
545 void print_conntable_lock();
546 void print_calltable_lock();
547 #endif
548 void print_peertable();
549 void print_conntable();
550 void print_calltable();
551 void print_eventtable();
552 void print_upDownStats();
553 void print_cmperfstats();
554 void print_cmstats();
555
556
557
558
559 int opencore();
560
561 #if     defined(AFS_HPUX_ENV) && defined(__LP64__)
562 #define afs_nlist nlist64
563 #define AFSNLIST(N, C) nlist64((N), (C))
564 #else /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
565 #ifdef AFS_SGI61_ENV
566 #ifdef AFS_32BIT_KERNEL_ENV
567 #define afs_nlist nlist
568 #define AFSNLIST(N, C) nlist((N), (C))
569 #else
570 #define afs_nlist nlist64
571 #define AFSNLIST(N, C) nlist64((N), (C))
572 #endif /* AFS_32BIT_KERNEL_ENV */
573 #else /* AFS_SGI61_ENV */
574 #ifdef AFS_LINUX20_ENV
575 struct afs_nlist {
576     char *n_name;
577     unsigned long n_value;
578 };
579 #else /* AFS_LINUX20_ENV */
580 #define afs_nlist nlist
581 #endif /* AFS_LINUX20_ENV */
582 #define AFSNLIST(N, C) nlist((N), (C))
583 #endif /* AFS_SGI61_ENV */
584 #endif /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
585
586 char *obj = UNIX, *core = CORE;
587 int kmem;
588
589 int Dcells = 0, Dusers = 0, Dservers = 0, Dconns = 0, Dvols = 0, Ddvols =
590     0, mem = 0;
591 int Dvstats = 0, Ddstats = 0, Dnfs = 0, Dglobals = 0, Dstats = 0, Dlocks =
592     0, Dall = 1;
593 int Dindextimes = 0, Dindexflags = 0, Dvnodes = 0, Dbuffers = 0, DCallbacks =
594     0, Dallocs = 0, UserLevel = 0;
595 int DdvnextTbl = 0, DdcnextTbl = 0;
596 int Nconns = 0, Drxstats = 0, Drx = 0, Dbkg = 0, Dvlru = 0, Ddlru =
597     0, Dcallout = 0;
598 int Ddnlc = 0;
599 int Dgcpags = 0;
600
601 #if     defined(AFS_SUN5_ENV)
602 #include <string.h>
603 #include <sys/types.h>
604 #include <sys/signal.h>
605 #include <sys/elf.h>
606 #include <libelf.h>
607 #include <sys/elf_M32.h>
608 #ifndef AFS_SUN54_ENV
609 typedef ulong_t k_fltset_t;     /* XXXXXXXXXXX */
610 #endif /* !AFS_SUN54_ENV */
611 #include <sys/proc.h>
612 #include <sys/file.h>
613 #define _NLIST_H                /* XXXXXXXXXXXXX */
614 #include <kvm.h>
615 kvm_t *kd;
616 #endif /* defined(AFS_SUN5_ENV) */
617
618 /* Pretty Printers - print real IP addresses and the like if running
619  * in interpret_mode.
620  */
621 int pretty = 1;
622
623 char *
624 PrintIPAddr(int addr)
625 {
626     static char str[32];
627     struct in_addr in_addr;
628
629     if (pretty) {
630         if (addr == 1) {
631             strcpy(str, "local");
632         } else {
633             in_addr.s_addr = addr;
634             (void)strcpy(str, inet_ntoa(in_addr));
635         }
636     } else {
637         (void)sprintf(str, "%x", addr);
638     }
639     return (char *)str;
640 }
641
642 #ifdef AFS_LINUX20_ENV
643 /* Find symbols in a live kernel. */
644 #include <stdio.h>
645 #include <stdlib.h>
646 #include <string.h>
647
648 #ifdef AFS_LINUX26_ENV
649 #define KSYMS "/proc/kallsyms"
650 #else
651 #define KSYMS "/proc/ksyms"
652 #endif
653
654 /* symlist_t contains all the kernel symbols. Forcing a 64 byte array is
655  * a bit wasteful, but simple.
656  */
657 #define MAXNAMELEN 64
658 typedef struct symlist {
659     char s_name[MAXNAMELEN];
660 #ifdef AFS_LINUX_64BIT_KERNEL
661     unsigned long s_value;
662 #else
663     int s_value;
664 #endif /* AFS_LINUX_64BIT_KERNEL */
665 } symlist_t;
666
667 #define KSYM_ALLOC_STEP 128
668 #define KSYM_ALLOC_BASE 1024
669 symlist_t *ksyms = NULL;
670 int nksyms = 0;
671 int availksyms = 0;
672
673 #define MAXLINE 1024
674
675 int
676 compare_strings(const void *a, const void *b)
677 {
678     symlist_t *syma = (symlist_t *) a;
679     symlist_t *symb = (symlist_t *) b;
680     return strcmp(syma->s_name, symb->s_name);
681 }
682
683 /* Read in all the kernel symbols */
684 void
685 read_ksyms(void)
686 {
687     FILE *fp;
688     char line[MAXLINE];
689     char *p, *q;
690
691     if (ksyms)
692         return;
693
694     fp = fopen(KSYMS, "r");
695     if (fp == NULL) {
696         printf("Can't open %s, exiting.\n", KSYMS);
697         exit(1);
698     }
699
700     availksyms = KSYM_ALLOC_BASE;
701     ksyms = (symlist_t *) malloc(availksyms * sizeof(symlist_t));
702     if (!ksyms) {
703         printf("Can't malloc %d elements for symbol list.\n", availksyms);
704         exit(1);
705     }
706
707     /* proc is organized as <addr> <name> <module> */
708     while (fgets(line, MAXLINE, fp)) {
709         if (nksyms >= availksyms) {
710             availksyms += KSYM_ALLOC_STEP;
711             ksyms =
712                 (symlist_t *) realloc(ksyms, availksyms * sizeof(symlist_t));
713             if (!ksyms) {
714                 printf("Failed to realloc %d symbols.\n", availksyms);
715                 exit(1);
716             }
717         }
718 #ifdef AFS_LINUX_64BIT_KERNEL
719         ksyms[nksyms].s_value = (unsigned long)strtoul(line, &p, 16);
720 #else
721         ksyms[nksyms].s_value = (int)strtoul(line, &p, 16);
722 #endif /* AFS_LINUX_64BIT_KERNEL */
723         p++;
724 #ifdef AFS_LINUX26_ENV
725         /* Linux 2.6 /proc/kallsyms has a one-char symbol type
726            between address and name, so step over it and the following
727            blank.
728         */
729         p += 2;
730 #endif
731         q = strchr(p, '\t');
732         if (q)
733             *q = '\0';
734         if (strlen(p) >= MAXLINE) {
735             printf("Symbol '%s' too long, ignoring it.\n", p);
736             continue;
737         }
738         (void)strcpy(ksyms[nksyms].s_name, p);
739         nksyms++;
740     }
741
742     /* Sort them in lexical order */
743     qsort(ksyms, nksyms, sizeof(symlist_t), compare_strings);
744 }
745
746
747
748 /* find_symbol returns 0 if not found, otherwise value for symbol */
749 #ifdef AFS_LINUX_64BIT_KERNEL
750 unsigned long
751 #else
752 int
753 #endif /* AFS_LINUX_64BIT_KERNEL */
754 find_symbol(char *name)
755 {
756     symlist_t *tmp;
757     symlist_t entry;
758
759     if (!ksyms)
760         read_ksyms();
761
762     (void)strcpy(entry.s_name, name);
763     tmp =
764         (symlist_t *) bsearch(&entry, ksyms, nksyms, sizeof(symlist_t),
765                               compare_strings);
766
767     return tmp ? tmp->s_value : 0;
768 }
769
770 /* nlist fills in values in list until a null name is found. */
771 int
772 nlist(void *notused, struct afs_nlist *nlp)
773 {
774     for (; nlp->n_name && *nlp->n_name; nlp++)
775         nlp->n_value = find_symbol(nlp->n_name);
776
777     return 0;
778 }
779
780 #endif
781
782 #if     defined(AFS_SUN5_ENV)
783 #ifdef  _LP64
784 Elf64_Sym *tbl;
785 #else
786 Elf32_Sym *tbl;                 /* symbol tbl */
787 #endif
788 char *tblp;                     /* ptr to symbol tbl */
789 int scnt = 0;
790
791 #ifdef  _LP64
792 Elf64_Sym *
793 symsrch(s)
794      char *s;
795 {
796     Elf64_Sym *sp;
797 #else
798 Elf32_Sym *
799 symsrch(s)
800      char *s;
801 {
802     Elf32_Sym *sp;
803 #endif  /** _LP64 **/
804     char *name;
805     unsigned char type;
806
807     for (sp = tbl; sp < &tbl[scnt]; sp++) {
808 #ifdef _LP64
809         type = ELF64_ST_TYPE(sp->st_info);
810 #else
811         type = ELF32_ST_TYPE(sp->st_info);
812 #endif  /** _LP64 **/
813         if (((type == STB_LOCAL) || (type == STB_GLOBAL)
814              || (type == STB_WEAK))
815             && ((afs_uint32) sp->st_value >= 0x10000)) {
816             name = tblp + sp->st_name;
817             if (!strcmp(name, s))
818                 return (sp);
819         }
820     }
821     return (0);
822 }
823
824 #endif /*defined(AFS_SUN5_ENV) */
825
826
827 #ifndef AFS_KDUMP_LIB
828 static int
829 cmdproc(register struct cmd_syndesc *as, void *arock)
830 {
831     register afs_int32 code = 0;
832
833     if (as->parms[0].items) {   /* -kobj */
834         obj = as->parms[0].items->data;
835     }
836     if (as->parms[1].items) {   /* -kcore */
837         core = as->parms[1].items->data;
838     }
839     if (as->parms[2].items) {   /* -cells */
840         Dcells = 1, Dall = 0;
841     }
842     if (as->parms[3].items) {   /* -users */
843         Dusers = 1, Dall = 0;
844     }
845     if (as->parms[4].items) {   /* -servers */
846         Dservers = 1, Dall = 0;
847     }
848     if (as->parms[5].items) {   /* -conns */
849         Dconns = 1, Dall = 0;
850     }
851     if (as->parms[6].items) {   /* -volumes */
852         Dvols = 1, Dall = 0;
853     }
854     if (as->parms[7].items) {   /* -dvolumes */
855         Ddvols = 1, Dall = 0;
856     }
857     if (as->parms[8].items) {   /* -vstats */
858         Dvstats = 1, Dall = 0;
859     }
860     if (as->parms[9].items) {   /* -dstats */
861         Ddstats = 1, Dall = 0;
862     }
863     if (as->parms[10].items) {  /* -nfstats */
864         Dnfs = 1, Dall = 0;
865     }
866     if (as->parms[11].items) {  /* -globals */
867         Dglobals = 1, Dall = 0;
868     }
869     if (as->parms[12].items) {  /* -stats */
870         Dstats = 1, Dall = 0;
871     }
872     if (as->parms[13].items) {  /* -locks */
873         Dlocks = 1, Dall = 0;
874     }
875     if (as->parms[14].items) {  /* -mem */
876         mem = 1;
877     }
878     if (as->parms[15].items) {  /* -rxstats */
879         Drxstats = 1, Dall = 0;
880     }
881     if (as->parms[16].items) {  /* -rx */
882         Drx = 1, Dall = 0;
883     }
884     if (as->parms[17].items) {  /* -timestable */
885         Dindextimes = 1, Dall = 0;
886     }
887     if (as->parms[18].items) {  /* -flagstable */
888         Dindexflags = 1, Dall = 0;
889     }
890     if (as->parms[19].items) {  /* -cbhash */
891         DCallbacks = 1, Dall = 0;
892     }
893     if (as->parms[20].items) {  /* -vnodes */
894         Dvnodes = 1, Dall = 0;
895     }
896     if (as->parms[21].items) {  /* -buffers */
897         Dbuffers = 1, Dall = 0;
898     }
899     if (as->parms[22].items) {  /* -allocedmem */
900         Dallocs = 1, Dall = 0;
901     }
902     if (as->parms[23].items) {  /* -user */
903         UserLevel = 1;
904     }
905     if (as->parms[24].items) {  /* -bkg */
906         Dbkg = 1, Dall = 0;
907     }
908     if (as->parms[25].items) {  /* -vlru */
909         Dvlru = 1, Dall = 0;
910     }
911     if (as->parms[26].items) {  /* -callout */
912         Dcallout = 1, Dall = 0;
913     }
914     if (as->parms[27].items) {  /* -dnlc */
915         Ddnlc = 1, Dall = 0;
916     }
917     if (as->parms[28].items) {  /* -dlru */
918         Ddlru = 1, Dall = 0;
919     }
920
921     if (as->parms[29].items) {  /* -raw */
922         pretty = 0;
923     }
924
925     if (as->parms[30].items) {  /* -gcpags */
926         Dgcpags = 1, Dall = 0;
927     }
928
929     if (as->parms[31].items) {  /* -dhash */
930         DdvnextTbl = 1, DdcnextTbl = 1, Dall = 0;
931     }
932
933     code = kdump();
934     return code;
935 }
936
937 #include "AFS_component_version_number.c"
938
939 main(argc, argv)
940      int argc;
941      char **argv;
942 {
943     register struct cmd_syndesc *ts;
944     register afs_int32 code;
945
946 #ifdef  AFS_AIX32_ENV
947     struct sigaction nsa;
948
949     sigemptyset(&nsa.sa_mask);
950     nsa.sa_handler = SIG_DFL;
951     nsa.sa_flags = SA_FULLDUMP;
952     sigaction(SIGSEGV, &nsa, NULL);
953 #endif
954
955     ts = cmd_CreateSyntax(NULL, cmdproc, NULL,
956                           "Read internal cache manager structs");
957     cmd_AddParm(ts, "-kobj", CMD_SINGLE, CMD_OPTIONAL,
958                 "kernel object (default /vmunix)");
959     cmd_AddParm(ts, "-kcore", CMD_SINGLE, CMD_OPTIONAL,
960                 "kernel core image (default /dev/kmem)");
961     cmd_AddParm(ts, "-cells", CMD_FLAG, CMD_OPTIONAL, "cell state");
962     cmd_AddParm(ts, "-users", CMD_FLAG, CMD_OPTIONAL, "users state");
963     cmd_AddParm(ts, "-servers", CMD_FLAG, CMD_OPTIONAL, "servers state");
964     cmd_AddParm(ts, "-conns", CMD_FLAG, CMD_OPTIONAL, "conns state");
965     cmd_AddParm(ts, "-volumes", CMD_FLAG, CMD_OPTIONAL,
966                 "incore volume state");
967     cmd_AddParm(ts, "-dvolumes", CMD_FLAG, CMD_OPTIONAL, "disk volume state");
968     cmd_AddParm(ts, "-vstats", CMD_FLAG, CMD_OPTIONAL, "stat file state");
969     cmd_AddParm(ts, "-dstats", CMD_FLAG, CMD_OPTIONAL, "file data state");
970     cmd_AddParm(ts, "-nfstats", CMD_FLAG, CMD_OPTIONAL,
971                 "nfs translator state");
972     cmd_AddParm(ts, "-globals", CMD_FLAG, CMD_OPTIONAL,
973                 "general global state");
974     cmd_AddParm(ts, "-stats", CMD_FLAG, CMD_OPTIONAL,
975                 "general cm performance state");
976     cmd_AddParm(ts, "-locks", CMD_FLAG, CMD_OPTIONAL,
977                 "global cm related locks state");
978     cmd_AddParm(ts, "-mem", CMD_FLAG, CMD_OPTIONAL,
979                 "core represents the physical mem (i.e. /dev/mem) and not virtual");
980     cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL,
981                 "general rx statistics");
982     cmd_AddParm(ts, "-rx", CMD_FLAG, CMD_OPTIONAL, "all info about rx");
983     cmd_AddParm(ts, "-timestable", CMD_FLAG, CMD_OPTIONAL,
984                 "dcache LRU info table");
985     cmd_AddParm(ts, "-flagstable", CMD_FLAG, CMD_OPTIONAL,
986                 "dcache flags info table");
987     cmd_AddParm(ts, "-cbhash", CMD_FLAG, CMD_OPTIONAL,
988                 "vcache hashed by cbExpires");
989     cmd_AddParm(ts, "-vnodes", CMD_FLAG, CMD_OPTIONAL, "afs vnodes");
990     cmd_AddParm(ts, "-buffers", CMD_FLAG, CMD_OPTIONAL,
991                 "afs dir buffer cache");
992     cmd_AddParm(ts, "-allocedmem", CMD_FLAG, CMD_OPTIONAL,
993                 "allocated memory");
994     cmd_AddParm(ts, "-user", CMD_FLAG, CMD_OPTIONAL,
995                 "core is from a user-level program");
996     cmd_AddParm(ts, "-bkg", CMD_FLAG, CMD_OPTIONAL, "background daemon info");
997     cmd_AddParm(ts, "-vlru", CMD_FLAG, CMD_OPTIONAL, "vcache lru list");
998     cmd_AddParm(ts, "-callout", CMD_FLAG, CMD_OPTIONAL,
999                 "callout info (aix only)");
1000     cmd_AddParm(ts, "-dnlc", CMD_FLAG, CMD_OPTIONAL,
1001                 "DNLC table,freelist,trace");
1002     cmd_AddParm(ts, "-dlru", CMD_FLAG, CMD_OPTIONAL, "dcache lru list");
1003
1004
1005     cmd_AddParm(ts, "-raw", CMD_FLAG, CMD_OPTIONAL, "show raw values");
1006     cmd_AddParm(ts, "-gcpags", CMD_FLAG, CMD_OPTIONAL,
1007                 "PAG garbage collection info");
1008     cmd_AddParm(ts, "-dhash", CMD_FLAG, CMD_OPTIONAL,
1009                 "show dcache hash chains");
1010
1011     code = cmd_Dispatch(argc, argv);
1012     return code;
1013 }
1014 #endif /* !AFS_KDUMP_LIB */
1015
1016 #ifdef  AFS_AIX_ENV
1017 #ifndef AFS_KDUMP_LIB
1018 Knlist(sp, cnt, size)
1019      struct afs_nlist *sp;
1020      int cnt, size;
1021 {
1022     register int code;
1023
1024     if (UserLevel)
1025         code = nlist(obj, sp);
1026     else
1027         code = knlist(sp, cnt, size);
1028     return code;
1029 }
1030 #endif /*AFS_KDUMP_LIB */
1031 #endif
1032
1033 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
1034 int
1035 findsym(char *sname, off_t * offset)
1036 {
1037 #if     defined(AFS_SUN5_ENV)
1038 #ifdef  _LP64
1039     Elf64_Sym *ss_ans;
1040 #else
1041     Elf32_Sym *ss_ans;
1042 #endif
1043     ss_ans = symsrch(sname);
1044     if (!ss_ans) {
1045         printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
1046                obj);
1047         *offset = 0;
1048         return 0;
1049     }
1050     *offset = ss_ans->st_value;
1051     return 1;
1052 #else /* defined(AFS_SUN5_ENV) */
1053 #if     defined(AFS_AIX_ENV)
1054     if (!UserLevel) {
1055         struct afs_nlist nl;
1056         nl.n_name = sname;
1057         if (Knlist(&nl, 1, sizeof nl) == -1) {
1058             printf("(WARNING) knlist: couldn't find %s. Proceeding...",
1059                    sname);
1060             *offset = 0;
1061             return 0;
1062         }
1063         *offset = nl.n_value;
1064         return 1;
1065     }
1066 #endif /* defined(AFS_AIX_ENV) */
1067     {
1068         struct afs_nlist request[2];
1069
1070         memset(request, 0, sizeof request);
1071         request[0].n_name = sname;
1072         if (AFSNLIST(obj, request) < 0) {
1073             fprintf(stderr, "nlist(%s, %s) failure: %d (%s)\n", obj, sname,
1074                     errno, strerror(errno));
1075             exit(1);
1076         }
1077 #if     defined(AFS_OSF_ENV)
1078         if (mem) {
1079             long X;
1080
1081             X = coreadj(request[0].n_value);
1082             request[0].n_value = X;
1083         }
1084 #endif /* defined(AFS_OSF_ENV) */
1085
1086         *offset = request[0].n_value;
1087         if (!request[0].n_value) {
1088             printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
1089                    obj);
1090             return 0;
1091         }
1092         return 1;
1093     }
1094 #endif /* defined(AFS_SUN5_ENV) */
1095 }
1096 #endif
1097
1098 #define CBHTSIZE 128
1099
1100 kdump()
1101 {
1102     int cell, cnt, cnt1;
1103 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
1104     printf("Kdump not supported\n");
1105 #else
1106 #ifndef AFS_KDUMP_LIB
1107
1108     kmem = opencore(core);
1109
1110 #endif /* AFS_KDUMP_LIB */
1111
1112 #ifdef KDUMP_RX_LOCK
1113     /* Test to see if kernel is using RX_ENABLE_LOCKS in rx structs. */
1114 #ifdef AFS_SGI53_ENV
1115 #ifdef AFS_SGI64_ENV
1116     use_rx_lock = 1;            /* Always using fine gain locking. */
1117 #else
1118     use_rx_lock = (sysmp(MP_NPROCS) > 1) ? 1 : 0;
1119 #endif
1120 #endif /* AFS_SGI53_ENV */
1121 #endif /* KDUMP_RX_LOCK */
1122
1123     if (Dcells || Dall) {
1124         print_cells(1);         /* Handle the afs_cells structures */
1125         print_cellaliases(1);
1126         print_cellnames(1);
1127     }
1128
1129     if (Dusers || Dall) {
1130         print_users(1);         /* Handle the afs_users structs */
1131     }
1132
1133     if (Dservers || Dall) {
1134         print_servers(1);       /* Handle the afs_servers structs */
1135     }
1136
1137     if (Dconns) {
1138         print_Conns(1);         /* Handle the afs_servers structs */
1139     }
1140
1141     if (Dvols || Dall) {
1142         print_volumes(1);       /* Handle the afs_volumes structs */
1143     }
1144
1145     if (Ddvols || Dall) {
1146         printf
1147             ("\n\nIGNORE reading the 'volumeinfo' file for now (NOT IMPORTANT)!\n");
1148     }
1149
1150     if (DCallbacks || Dall) {
1151         print_cbHash(1);        /* Handle the cbHashT table of queued vcaches */
1152     }
1153
1154     if (Dvstats || Dall || Dvnodes) {
1155         print_vcaches(1);       /* Handle the afs_vcaches structs */
1156     }
1157
1158     if (Ddstats || Dall) {
1159         print_dcaches(1);
1160     }
1161
1162     if (Dindextimes || Dall) {
1163         print_DindexTimes(1);
1164     }
1165
1166     if (Dindexflags || Dall) {
1167         print_DindexFlags(1);
1168     }
1169
1170     if (DdvnextTbl || Dall) {
1171         print_DdvnextTbl(1);
1172     }
1173
1174     if (DdcnextTbl || Dall) {
1175         print_DdcnextTbl(1);
1176     }
1177
1178     if (Dbuffers || Dall) {
1179         print_buffers(1);
1180     }
1181
1182     if (Dnfs || Dall) {
1183         print_nfss(1);
1184     }
1185
1186     if (Dstats || Dall) {
1187         off_t symoff;
1188         struct afs_CMStats afs_cmstats;
1189         struct afs_stats_CMPerf afs_cmperfstats;
1190
1191         printf("\n\nPrinting count references to cm-related functions..\n\n");
1192         findsym("afs_cmstats", &symoff);
1193         kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1194         print_cmstats(&afs_cmstats);
1195         printf("\n\nPrinting some cm struct performance stats..\n\n");
1196         findsym("afs_stats_cmperf", &symoff);
1197         kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1198         print_cmperfstats(&afs_cmperfstats);
1199
1200     }
1201     if (Dlocks || Dall) {
1202         print_global_locks(kmem);
1203     }
1204     if (Dglobals || Dall) {
1205         printf("\n\nPrinting Misc afs globals...\n");
1206         print_global_afs_resource(kmem);
1207         print_global_afs_cache(kmem);
1208     }
1209     if (Dbkg || Dall) {
1210         print_bkg(kmem);
1211     }
1212     if (Dvlru || Dall) {
1213         print_vlru(kmem);
1214     }
1215     if (Ddlru || Dall) {
1216         print_dlru(kmem);
1217     }
1218     if (Drxstats || Dall) {
1219         print_rxstats(kmem);
1220     }
1221     if (Drx || Dall) {
1222         print_rx(kmem);
1223     }
1224 #ifndef AFS_KDUMP_LIB
1225     if (Dallocs || Dall) {
1226         print_allocs(1);
1227     }
1228 #endif
1229     if (Dcallout || Dall) {
1230         print_callout(kmem);
1231     }
1232     if (Ddnlc || Dall) {
1233         print_dnlc(kmem);
1234     }
1235     if (Dgcpags || Dall) {
1236         print_gcpags(1);
1237     }
1238 #endif
1239     return 0;
1240 }
1241
1242 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
1243 int Sum_cellnames = 0, Sum_userstp = 0, Sum_volnames = 0, Sum_exps =
1244     0, Sum_nfssysnames = 0;
1245 int Sum_vcachemvids = 0, Sum_vcachelinkData = 0, Sum_vcacheacc =
1246     0, Sum_vcachelocks = 0;
1247 int Sum_cellaliases = 0, Sum_cellname_names = 0;
1248
1249 int
1250 print_cells(pnt)
1251      int pnt;
1252 {
1253     off_t symoff;
1254     struct cell *cells, cle, *clentry = &cle, *clep;
1255     long j = 0, cell;
1256     struct afs_q CellLRU, lru, *vu = &lru, *tq, *uq;
1257     u_long lru_addr;
1258
1259     if (pnt)
1260         printf("\n\nPrinting Cells' LRU list...\n");
1261     findsym("CellLRU", &symoff);
1262     kread(kmem, symoff, (char *)&CellLRU, sizeof CellLRU);
1263     lru_addr = (u_long) symoff;
1264     for (tq = CellLRU.next; (u_long) tq != lru_addr; tq = uq) {
1265         clep = QTOC(tq);
1266         kread(kmem, (off_t) tq, (char *)vu, sizeof CellLRU);
1267         uq = vu->next;
1268         kread(kmem, (off_t) clep, (char *)clentry, sizeof *clentry);
1269         print_cell(kmem, clentry, clep, pnt);
1270         j++;
1271     }
1272     if (pnt)
1273         printf("... found %d 'afs_cells' entries\n", j);
1274
1275     return j;
1276 }
1277
1278 int
1279 print_cellaliases(int pnt)
1280 {
1281     off_t symoff;
1282     struct cell_alias *ca, cae;
1283     long j = 0;
1284
1285     if (pnt)
1286         printf("\n\nPrinting cell_alias list...\n");
1287     findsym("afs_cellalias_head", &symoff);
1288     kread(kmem, symoff, (char *)&ca, sizeof ca);
1289     while (ca) {
1290         char alias[100], cell[100];
1291
1292         kread(kmem, (off_t) ca, (char *)&cae, sizeof cae);
1293         kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T) 40);
1294         alias[40] = '\0';
1295         Sum_cellaliases += strlen(alias) + 1;
1296         kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T) 40);
1297         cell[40] = '\0';
1298         Sum_cellaliases += strlen(cell) + 1;
1299         if (pnt)
1300             printf("%x: alias=%s cell=%s index=%d\n", ca, alias, cell,
1301                    cae.index);
1302         ca = cae.next;
1303         j++;
1304     }
1305     if (pnt)
1306         printf("... found %d 'cell_alias' entries\n", j);
1307
1308     return j;
1309 }
1310
1311 int
1312 print_cellnames(int pnt)
1313 {
1314     off_t symoff;
1315     struct cell_name *cn, cne;
1316     long j = 0;
1317
1318     if (pnt)
1319         printf("\n\nPrinting cell_name list...\n");
1320     findsym("afs_cellname_head", &symoff);
1321     kread(kmem, symoff, (char *)&cn, sizeof cn);
1322     while (cn) {
1323         char cellname[100];
1324
1325         kread(kmem, (off_t) cn, (char *)&cne, sizeof cne);
1326         kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T) 40);
1327         cellname[40] = '\0';
1328         Sum_cellname_names += strlen(cellname) + 1;
1329         if (pnt)
1330             printf("%x: cellnum=%d cellname=%s used=%d\n", cn, cne.cellnum,
1331                    cellname, cne.used);
1332         cn = cne.next;
1333         j++;
1334     }
1335     if (pnt)
1336         printf("... found %d 'cell_name' entries\n", j);
1337
1338     return j;
1339 }
1340
1341 int
1342 print_users(pnt)
1343      int pnt;
1344 {
1345     off_t symoff;
1346     struct unixuser *afs_users[NUSERS], ue, *uentry = &ue, *uep;
1347     int i, j;
1348
1349     if (pnt)
1350         printf("\n\nPrinting 'afs_users' structures...\n");
1351     findsym("afs_users", &symoff);
1352     kread(kmem, symoff, (char *)afs_users, sizeof afs_users);
1353     for (i = 0, j = 0; i < NUSERS; i++) {
1354         for (uep = afs_users[i]; uep; uep = uentry->next, j++) {
1355             kread(kmem, (off_t) uep, (char *)uentry, sizeof *uentry);
1356             print_unixuser(kmem, uentry, uep, pnt);
1357         }
1358     }
1359     if (pnt)
1360         printf("... found %d 'afs_users' entries\n", j);
1361     return j;
1362 }
1363
1364 struct server **serversFound = NULL;
1365 afs_int32 NserversFound = 0;
1366 #define SF_ALLOCATION_STEP 500
1367
1368 int
1369 add_found_server(sep)
1370      struct server *sep;
1371 {
1372     static afs_int32 NserversAllocated = 0;
1373     static afs_int32 failed = 0;
1374
1375     if (failed)
1376         return -1;
1377
1378     if (NserversFound >= NserversAllocated) {
1379         NserversAllocated += SF_ALLOCATION_STEP;
1380         if (!serversFound) {
1381             serversFound =
1382                 (struct server **)malloc(NserversAllocated *
1383                                          sizeof(struct server *));
1384         } else {
1385             serversFound =
1386                 (struct server **)realloc((char *)serversFound,
1387                                           NserversAllocated *
1388                                           sizeof(struct server *));
1389         }
1390         if (!serversFound) {
1391             printf("Can't allocate %lu bytes for list of found servers.\n",
1392                    NserversAllocated * sizeof(struct server *));
1393             failed = 1;
1394             NserversFound = 0;
1395             return -1;
1396         }
1397     }
1398     serversFound[NserversFound++] = sep;
1399     return 0;
1400 }
1401
1402 int
1403 find_server(sep)
1404      struct server *sep;
1405 {
1406     int i;
1407
1408     for (i = 0; i < NserversFound; i++) {
1409         if (sep == serversFound[i])
1410             return 1;
1411     }
1412     return 0;
1413 }
1414
1415 int
1416 print_servers(pnt)
1417      int pnt;
1418 {
1419     off_t symoff;
1420     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1421     struct srvAddr *afs_srvAddrs[NSERVERS], sa, *sap;
1422     afs_int32 i, nServers, nSrvAddrs, nSrvAddrStructs;
1423     afs_int32 afs_totalServers, afs_totalSrvAddrs;
1424     int failed = 0;
1425     int chainCount[NSERVERS];
1426
1427     if (pnt) {
1428         memset((char *)chainCount, 0, sizeof(chainCount));
1429         printf("\n\nPrinting 'afs_servers' structures...\n");
1430     }
1431     findsym("afs_servers", &symoff);
1432     kread(kmem, symoff, (char *)afs_servers, NSERVERS * sizeof(long));
1433     for (i = 0, nServers = 0; i < NSERVERS; i++) {
1434         if (pnt)
1435             printf(" --- Chain %d ---\n", i);
1436         for (sep = afs_servers[i]; sep; sep = sentry->next, nServers++) {
1437             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1438             if (pnt && !failed) {
1439                 if (add_found_server(sep) < 0)
1440                     failed = 1;
1441             }
1442             if (pnt)
1443                 chainCount[i]++;
1444             if (Dconns || Dall || !pnt)
1445                 print_server(kmem, sentry, sep, 1, pnt);
1446             else
1447                 print_server(kmem, sentry, sep, 0, pnt);
1448         }
1449     }
1450     if (pnt) {
1451         if (Dconns || Dall)
1452             printf("... found %d 'afs_servers' entries (total conns = %d)\n",
1453                    nServers, Nconns);
1454         else
1455             printf("... found %d 'afs_servers' entries\n", nServers);
1456         printf("Chain lengths:\n");
1457         for (i = 0; i < NSERVERS; i++) {
1458             printf("%2d: %5d\n", i, chainCount[i]);
1459         }
1460     }
1461     Dconns = 0;
1462
1463
1464     /* Verify against afs_totalServers. */
1465     if (pnt) {
1466         memset((char *)chainCount, 0, sizeof(chainCount));
1467         if (findsym("afs_totalServers", &symoff)) {
1468             kread(kmem, symoff, (char *)&afs_totalServers, sizeof(afs_int32));
1469             if (afs_totalServers != nServers) {
1470                 printf
1471                     ("ERROR: afs_totalServers = %d, differs from # of servers in hash table.\n",
1472                      afs_totalServers);
1473             } else {
1474                 printf("afs_totalServers = %d, matches hash chain count.\n",
1475                        afs_totalServers);
1476             }
1477         }
1478
1479         printf("\n\nPrinting 'afs_srvAddr' structures...\n");
1480         if (findsym("afs_srvAddrs", &symoff)) {
1481             kread(kmem, symoff, (char *)afs_srvAddrs,
1482                   NSERVERS * sizeof(long));
1483             nSrvAddrStructs = 0;
1484             for (i = 0, nSrvAddrs = 0; i < NSERVERS; i++) {
1485                 printf(" --- Chain %d ---\n", i);
1486                 for (sap = afs_srvAddrs[i]; sap; sap = sa.next_bkt) {
1487                     kread(kmem, (off_t) sap, (char *)&sa, sizeof(sa));
1488                     printf
1489                         ("%lx: sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx\n",
1490                          sap, PrintIPAddr(sa.sa_ip), sa.sa_portal,
1491                          sa.sa_iprank, sa.sa_flags, sa.conns, sa.server,
1492                          sa.next_bkt);
1493                     if (sap != (struct srvAddr *)sa.server) {
1494                         /* only count ones not in a server struct. */
1495                         nSrvAddrStructs++;
1496                     }
1497                     nSrvAddrs++;
1498                     chainCount[i]++;
1499                     if (!failed) {
1500                         if (!find_server(sa.server)) {
1501                             kread(kmem, (off_t) sa.server, (char *)sentry,
1502                                   sizeof *sentry);
1503                             printf
1504                                 ("ERROR: Server missing from hash chain: server=%lx, server->next=%lx\n",
1505                                  sa.server, sentry->next);
1506                             print_server(kmem, sentry, sa.server, 1, pnt);
1507                             printf
1508                                 ("----------------------------------------------------\n");
1509                         }
1510                     }
1511
1512                 }
1513             }
1514             printf
1515                 ("... found %d 'afs_srvAddr' entries, %d alloc'd (not in server struct)\n",
1516                  nSrvAddrs, nSrvAddrStructs);
1517             printf("Chain lengths:\n");
1518             for (i = 0; i < NSERVERS; i++) {
1519                 printf("%2d: %5d\n", i, chainCount[i]);
1520             }
1521             if (findsym("afs_totalSrvAddrs", &symoff)) {
1522                 kread(kmem, symoff, (char *)&afs_totalSrvAddrs,
1523                       sizeof(afs_int32));
1524                 if (afs_totalSrvAddrs != nSrvAddrStructs) {
1525                     printf
1526                         ("ERROR: afs_totalSrvAddrs = %d, differs from number of alloc'd srvAddrs in hash table.\n",
1527                          afs_totalSrvAddrs);
1528                 } else {
1529                     printf
1530                         ("afs_totalSrvAddrs = %d, matches alloc'd srvAddrs in hash chain count.\n",
1531                          afs_totalSrvAddrs);
1532                 }
1533             }
1534         }
1535     }
1536     return nServers;
1537 }
1538
1539
1540 void
1541 print_Conns(pnt)
1542      int pnt;
1543 {
1544     off_t symoff;
1545     struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1546     afs_int32 i, j;
1547
1548     if (pnt)
1549         printf("\n\nPrinting all 'afs_conns' to  the servers...\n");
1550     findsym("afs_servers", &symoff);
1551     kread(kmem, symoff, (char *)afs_servers, sizeof afs_servers);
1552     for (i = 0, j = 0; i < NSERVERS; i++) {
1553         for (sep = afs_servers[i]; sep; sep = sentry->next, j++) {
1554             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1555             print_server(kmem, sentry, sep, 2, pnt);
1556         }
1557     }
1558     if (pnt)
1559         printf("... found %d 'afs_conns' entries\n", Nconns);
1560 }
1561
1562
1563 int
1564 print_volumes(pnt)
1565      int pnt;
1566 {
1567     off_t symoff;
1568     struct volume *afs_volumes[NVOLS], ve, *ventry = &ve, *vep;
1569     afs_int32 i, j;
1570
1571     if (pnt)
1572         printf("\n\nPrinting 'afs_volumes' structures...\n");
1573     findsym("afs_volumes", &symoff);
1574     kread(kmem, symoff, (char *)afs_volumes, NVOLS * sizeof(long));
1575     for (i = 0, j = 0; i < NVOLS; i++) {
1576         for (vep = afs_volumes[i]; vep; vep = ventry->next, j++) {
1577             kread(kmem, (off_t) vep, (char *)ventry, sizeof *ventry);
1578             print_volume(kmem, ventry, vep, pnt);
1579         }
1580     }
1581     if (pnt)
1582         printf("... found %d 'afs_volumes' entries\n", j);
1583     return (j);
1584 }
1585
1586 void
1587 print_cbHash(pnt)
1588      int pnt;
1589 {
1590     off_t symoff;
1591     struct afs_q cbHashT[CBHTSIZE];
1592     afs_int32 i, j;
1593
1594     if (pnt)
1595         printf("\n\nPrinting 'cbHashT' table...\n");
1596     findsym("cbHashT", &symoff);
1597     kread(kmem, symoff, (char *)cbHashT, sizeof cbHashT);
1598     for (i = 0; i < CBHTSIZE; i++) {
1599         if (pnt)
1600             printf("%lx: %x %x\n", (long)symoff + 8 * i, cbHashT[i].prev,
1601                    cbHashT[i].next);
1602     }
1603     if (pnt)
1604         printf("... that should be %d callback hash entries\n", i);
1605 }
1606
1607 int
1608 print_vcaches(pnt)
1609      int pnt;
1610 {
1611     off_t symoff;
1612     struct vcache *afs_vhashTable[VCSIZE], Ve, *Ventry = &Ve, *Vep;
1613     afs_int32 i, j;
1614
1615     if (pnt)
1616         printf("\n\nPrinting afs_vcaches structures...\n");
1617     if (pnt)
1618         printf("print_vcaches: sizeof(struct vcache) = %ld\n",
1619                (long)sizeof(struct vcache));
1620     findsym("afs_vhashT", &symoff);
1621     kread(kmem, symoff, (char *)afs_vhashTable, sizeof afs_vhashTable);
1622     for (i = 0, j = 0; i < VCSIZE; i++) {
1623         if (pnt)
1624             printf("Printing hash chain %d...\n", i);
1625         for (Vep = afs_vhashTable[i]; Vep; Vep = Ventry->hnext, j++) {
1626             kread(kmem, (off_t) Vep, (char *)Ventry, sizeof *Ventry);
1627             if (Dvstats || Dall || !pnt)
1628                 print_vcache(kmem, Ventry, Vep, pnt);
1629             if (Dvnodes || Dall)
1630                 print_vnode(kmem, Ventry, Vep, pnt);
1631         }
1632     }
1633     if (pnt)
1634         printf("... found %d 'afs_vcaches' entries\n", j);
1635     return j;
1636 }
1637
1638 int
1639 print_dcaches(pnt)
1640      int pnt;
1641 {
1642     off_t symoff;
1643     long table, *ptr;
1644     struct dcache dc, *dcp = &dc, *dp;
1645     afs_int32 i, j, count;
1646     struct afs_q dlru;
1647
1648     /* Handle the afs_dcaches structs */
1649     if (pnt)
1650         printf("\n\nPrinting afs_dcache related structures...\n");
1651     findsym("afs_cacheFiles", &symoff);
1652     kread(kmem, symoff, (char *)&count, sizeof count);
1653     findsym("afs_indexTable", &symoff);
1654     kread(kmem, symoff, (char *)&table, sizeof(long));
1655     ptr = (long *)malloc(count * sizeof(long));
1656     kread(kmem, table, (char *)ptr, count * sizeof(long));
1657     for (i = 0, j = 0; i < count; i++) {
1658         if (dp = (struct dcache *)ptr[i]) {
1659             if (pnt)
1660                 printf("afs_indexTable[%d] %x: ", i, dp);
1661             kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1662             print_dcache(kmem, dcp, dp, pnt);
1663             j++;
1664         }
1665     }
1666     if (pnt)
1667         printf("... found %d 'dcache' entries\n", j);
1668     findsym("afs_DLRU", &symoff);
1669     kread(kmem, symoff, (char *)&dlru, sizeof(struct afs_q));
1670     if (pnt)
1671         printf("DLRU next=0x%x, prev=0x%x\n", dlru.next, dlru.prev);
1672     free(ptr);
1673
1674     return j;
1675 }
1676
1677
1678 void
1679 print_DindexTimes(pnt)
1680      int pnt;
1681 {
1682     off_t symoff;
1683     long table;
1684     afs_hyper_t *ptr;
1685     afs_int32 temp, *indexTime = &temp;
1686     afs_int32 i, j, count;
1687
1688     /* Handle the afs_indexTimes array */
1689     if (pnt)
1690         printf("\n\nPrinting afs_indexTimes[]...\n");
1691     findsym("afs_cacheFiles", &symoff);
1692     kread(kmem, symoff, (char *)&count, sizeof count);
1693     findsym("afs_indexTimes", &symoff);
1694     kread(kmem, symoff, (char *)&table, sizeof(long));
1695     ptr = (afs_hyper_t *) malloc(count * sizeof(afs_hyper_t));
1696     kread(kmem, table, (char *)ptr, count * sizeof(afs_hyper_t));
1697     for (i = 0, j = 0; i < count; i++) {
1698         if (pnt)
1699             printf("afs_indexTimes[%d]\t%10d.%d\n", i, ptr[i].high,
1700                    ptr[i].low);
1701 /*      if (dp = (struct dcache *)ptr[i]) {
1702         printf("afs_indexTable[%d] %lx: ", i, dp);
1703         kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1704         print_dcache(kmem, dcp, dp);
1705         }
1706 */
1707         j++;
1708     }
1709     if (pnt)
1710         printf("afs_indexTimes has %d entries\n", j);
1711     free(ptr);
1712 }
1713
1714
1715 void
1716 print_DdvnextTbl(pnt)
1717      int pnt;
1718 {
1719     off_t symoff;
1720     long table;
1721     afs_int32 *ptr;
1722     afs_int32 temp, *indexTime = &temp;
1723     afs_int32 i, j, count;
1724
1725     /* Handle the afs_dvnextTbl arrays */
1726     if (pnt)
1727         printf("\n\nPrinting afs_dvnextTbl[]...\n");
1728     findsym("afs_cacheFiles", &symoff);
1729     kread(kmem, symoff, (char *)&count, sizeof count);
1730     findsym("afs_dvnextTbl", &symoff);
1731     kread(kmem, symoff, (char *)&table, sizeof(long));
1732     ptr = (afs_int32 *) malloc(count * sizeof(afs_int32));
1733     kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1734     for (i = 0, j = 0; i < count; i++) {
1735         if (pnt)
1736             printf("afs_dvnextTbl[%d]\t%d\n", i, ptr[i]);
1737         j++;
1738     }
1739     if (pnt)
1740         printf("afs_dvnextTbl has %d entries\n", j);
1741     free(ptr);
1742 }
1743
1744
1745 void
1746 print_DdcnextTbl(pnt)
1747      int pnt;
1748 {
1749     off_t symoff;
1750     long table;
1751     afs_int32 *ptr;
1752     afs_int32 temp, *indexTime = &temp;
1753     afs_int32 i, j, count;
1754
1755     /* Handle the afs_dcnextTbl arrays */
1756     if (pnt)
1757         printf("\n\nPrinting afs_dcnextTbl[]...\n");
1758     findsym("afs_cacheFiles", &symoff);
1759     kread(kmem, symoff, (char *)&count, sizeof count);
1760     findsym("afs_dcnextTbl", &symoff);
1761     kread(kmem, symoff, (char *)&table, sizeof(long));
1762     ptr = (afs_int32 *) malloc(count * sizeof(afs_int32));
1763     kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1764     for (i = 0, j = 0; i < count; i++) {
1765         if (pnt)
1766             printf("afs_dcnextTbl[%d]\t%d\n", i, ptr[i]);
1767         j++;
1768     }
1769     if (pnt)
1770         printf("afs_dcnextTbl has %d entries\n", j);
1771     free(ptr);
1772 }
1773
1774
1775 void
1776 print_DindexFlags(pnt)
1777      int pnt;
1778 {
1779     off_t symoff;
1780     afs_int32 count;
1781     long table;
1782     unsigned char *flags;
1783     afs_int32 temp, *indexTime = &temp;
1784     afs_int32 i, j;
1785
1786     /* Handle the afs_indexFlags array */
1787     if (pnt)
1788         printf("\n\nPrinting afs_indexFlags[]...\n");
1789     findsym("afs_cacheFiles", &symoff);
1790     kread(kmem, symoff, (char *)&count, sizeof count);
1791     findsym("afs_indexFlags", &symoff);
1792     kread(kmem, symoff, (char *)&table, sizeof(long));
1793     flags = (unsigned char *)malloc(count * sizeof(char));
1794     kread(kmem, table, flags, count * sizeof(char));
1795     for (i = 0, j = 0; i < count; i++) {
1796         if (pnt)
1797             printf("afs_indexFlags[%d]\t%4u\n", i, flags[i]);
1798         j++;
1799     }
1800     if (pnt)
1801         printf("afs_indexFlags has %d entries\n", j);
1802     free(flags);
1803 }
1804
1805
1806 void
1807 print_buffers(pnt)
1808      int pnt;
1809 {
1810     off_t symoff;
1811     long table;
1812     afs_int32 count;
1813     unsigned char *buffers;
1814     struct buffer *bp;
1815     afs_int32 i, j;
1816
1817     if (pnt)
1818         printf("\n\nPrinting 'buffers' table...\n");
1819     findsym("Buffers", &symoff);
1820     kread(kmem, symoff, (char *)&table, sizeof(long));
1821     findsym("nbuffers", &symoff);
1822     kread(kmem, symoff, (char *)&count, sizeof(int));
1823     buffers = (unsigned char *)malloc(count * sizeof(struct buffer));
1824     kread(kmem, table, buffers, count * sizeof(struct buffer));
1825     bp = (struct buffer *)buffers;
1826     for (i = 0, j = 0; i < count; i++, bp++) {
1827 #ifdef AFS_SGI62_ENV
1828         if (pnt)
1829             printf
1830                 ("Buffer #%d:\tfid=%llu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1831                  i, bp->fid[0], bp->page, bp->accesstime, bp->hashNext,
1832                  bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1833 #else
1834         if (pnt)
1835             printf
1836                 ("Buffer #%d:\tfid=%lu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1837                  i, bp->fid, bp->page, bp->accesstime, bp->hashNext,
1838                  bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1839 #endif
1840         j++;
1841     }
1842     if (pnt)
1843         printf("\n\t   ... that should be %d buffer entries\n", i);
1844 }
1845
1846
1847 int
1848 print_nfss(pnt)
1849      int pnt;
1850 {
1851     off_t symoff;
1852     struct afs_exporter *exp_entry, ex, *exp = &ex, *exp1;
1853     struct nfsclientpag *afs_nfspags[NNFSCLIENTS], e, *entry = &e, *ep;
1854     long i, j, cell;
1855
1856     /* Handle the afs_exporter structures */
1857     if (pnt)
1858         printf("\n\nPrinting 'afs_exporters' link list...\n");
1859     findsym("root_exported", &symoff);
1860     kread(kmem, symoff, (char *)&cell, sizeof(long));
1861     for (exp1 = (struct afs_exporter *)cell, j = 0; exp1;
1862          exp1 = exp->exp_next, j++) {
1863         kread(kmem, (off_t) exp1, (char *)exp, sizeof *exp);
1864         if (pnt)
1865             printf("AFS_EXPORTER(%x): \n", exp1);
1866         print_exporter(kmem, exp, exp1, pnt);
1867         Sum_exps++;
1868     }
1869     if (pnt)
1870         printf("... found %d 'afs_exporters' entries\n", j);
1871
1872     /* Handle the afs_nfsclientpags structs */
1873     if (pnt)
1874         printf("\n\nPrinting 'afs_nfsclientpags' structures...\n");
1875     if (!findsym("afs_nfspags", &symoff))
1876         return 0;
1877     kread(kmem, symoff, (char *)afs_nfspags, sizeof afs_nfspags);
1878     for (i = 0, j = 0; i < NNFSCLIENTS; i++) {
1879         for (ep = afs_nfspags[i]; ep; ep = entry->next, j++) {
1880             kread(kmem, (off_t) ep, (char *)entry, sizeof *entry);
1881             print_nfsclient(kmem, entry, ep, pnt);
1882         }
1883     }
1884     if (pnt)
1885         printf("... found %d 'afs_nfsclientpags' entries\n", j);
1886     return j;
1887 }
1888
1889 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
1890 typedef struct event {
1891     struct event *next;         /* next in hash chain */
1892     char *event;                /* lwp event: an address */
1893     int refcount;               /* Is it in use? */
1894     kcondvar_t cond;            /* Currently associated condition variable */
1895     int seq;                    /* Sequence number: this is incremented
1896                                  * by wakeup calls; wait will not return until
1897                                  * it changes */
1898 } event_t;
1899 #endif
1900
1901
1902 #ifdef AFS_LINUX22_ENV
1903 /* This is replicated from LINUX/osi_alloc.c */
1904 #define MEM_SPACE sizeof(int)
1905
1906 #define KM_TYPE 1
1907 #define VM_TYPE 2
1908 struct osi_linux_mem {
1909     int mem_next;               /* types are or'd into low bits of next */
1910     char data[1];
1911 };
1912 #define MEMTYPE(A) ((A) & 0x3)
1913 #define MEMADDR(A) ((struct osi_linux_mem*)((A) & (~0x3)))
1914 #define PR_MEMTYPE(A) ((MEMTYPE(A) == KM_TYPE) ? "phys" : "virt")
1915 void
1916 print_alloced_memlist(void)
1917 {
1918     off_t symoff;
1919     struct osi_linux_mem *memp, memlist, next;
1920     off_t next_addr;
1921     int count;
1922     int n = 0;
1923
1924     findsym("afs_linux_memlist_size", &symoff);
1925     kread(kmem, symoff, (char *)&count, sizeof count);
1926     findsym("afs_linux_memlist", &symoff);
1927     kread(kmem, symoff, (char *)&memp, sizeof memp);
1928     if (memp) {
1929 #ifdef AFS_LINUX_64BIT_KERNEL
1930         kread(kmem, (unsigned long)memp, (char *)&next, sizeof next);
1931 #else
1932         kread(kmem, (int)memp, (char *)&next, sizeof next);
1933 #endif /* AFS_LINUX_64BIT_KERNEL */
1934     } else {
1935         memset(&next, 0, sizeof next);
1936     }
1937     printf("Allocated memory list: %d elements\n", count);
1938     printf("%20s %4s %10s\n", "Address", "Type", "Next");
1939     printf("%20lx %4s %10x\n", (long)((char *)memp) + MEM_SPACE,
1940            PR_MEMTYPE(next.mem_next), next.mem_next);
1941     n = 1;
1942     while (next_addr = (off_t) MEMADDR(next.mem_next)) {
1943         n++;
1944         memlist = next;
1945         kread(kmem, next_addr, (char *)&next, sizeof next);
1946         printf("%20lx %4s %10x\n", (long)next_addr + MEM_SPACE,
1947                PR_MEMTYPE(next.mem_next), next.mem_next);
1948     }
1949     printf("Found %d elements in allocated memory list, expected %d\n", n,
1950            count);
1951 }
1952 #endif
1953
1954 void
1955 print_allocs(pnt)
1956      int pnt;
1957 {
1958     off_t symoff;
1959     long count, i, j, k, l, m, n, T = 0, tvs;
1960     struct afs_CMStats afs_cmstats;
1961     struct afs_stats_CMPerf afs_cmperfstats;
1962
1963     findsym("afs_cmstats", &symoff);
1964     kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1965     findsym("afs_stats_cmperf", &symoff);
1966     kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1967
1968     T += MAXSYSNAME;
1969     printf("\n\n%20s:\t%8d bytes\n", "Sysname area", MAXSYSNAME);
1970
1971     Sum_cellnames = 0;
1972     i = print_cells(0);
1973     j = (i * sizeof(struct cell)) + Sum_cellnames;
1974     T += j;
1975     printf
1976         ("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n",
1977          "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
1978
1979     Sum_cellaliases = 0;
1980     i = print_cellaliases(0);
1981     j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
1982     T += j;
1983     printf
1984         ("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n",
1985          "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
1986
1987     Sum_cellname_names = 0;
1988     i = print_cellnames(0);
1989     j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
1990     T += j;
1991     printf
1992         ("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n",
1993          "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
1994
1995     Sum_userstp = 0;
1996     i = print_users(0);
1997     j = (i * sizeof(struct unixuser)) + Sum_userstp;
1998     T += j;
1999     printf
2000         ("%20s:\t%8d bytes\t[%d users/%d bytes each + %d bytes for secret tokens]\n",
2001          "User package", j, i, sizeof(struct unixuser), Sum_userstp);
2002
2003     i = print_servers(0);
2004     j = (i * sizeof(struct server));
2005     T += j;
2006     printf("%20s:\t%8d bytes\t[%d servers/%d bytes each]\n", "Server package",
2007            j, i, sizeof(struct server));
2008     j = (Nconns * sizeof(struct conn));
2009     T += j;
2010     printf("%20s:\t%8d bytes\t[%d conns/%d bytes each]\n",
2011            "Connection package", j, Nconns, sizeof(struct conn));
2012
2013     i = (AFS_NCBRS * sizeof(struct afs_cbr)) * (j =
2014                                                 afs_cmperfstats.
2015                                                 CallBackAlloced);
2016     T += i;
2017     if (i)
2018         printf("%20s:\t%8d bytes\t[%d cbs/%d bytes each]\n",
2019                "Server CB free pool", i, (j * AFS_NCBRS),
2020                sizeof(struct afs_cbr));
2021
2022     Sum_volnames = 0;
2023     i = print_volumes(0);
2024     j = (MAXVOLS * sizeof(struct volume)) + Sum_volnames;
2025     T += j;
2026     printf
2027         ("%20s:\t%8d bytes\t[%d volumes/%d bytes each + %d bytes for volnames - %d active entries]\n",
2028          "Volume package", j, MAXVOLS, sizeof(struct volume), Sum_volnames,
2029          i);
2030
2031     Sum_vcachemvids = Sum_vcachelinkData = Sum_vcacheacc = Sum_vcachelocks =
2032         0;
2033     tvs = i = print_vcaches(0);
2034     j = (i * sizeof(struct vcache));
2035 /*    T += j;*/
2036 /*    printf("%20s:\t%d bytes\t[%d vcaches/%d bytes each]\n", "Vcache package", j, i, sizeof(struct vcache));*/
2037 #ifdef  AFS_AIX32_ENV
2038     i = (tvs + Sum_vcachemvids + Sum_vcachelinkData +
2039          Sum_vcachelocks) * AFS_SMALLOCSIZ;
2040     printf
2041         ("%20s:\t%8d bytes\t[%d act gnodes, %d mount pnts, %d symbolic links, %d unix locks]\n",
2042          "[VC use of sml fp]*", i, tvs, Sum_vcachemvids, Sum_vcachelinkData,
2043          Sum_vcachelocks);
2044 #else
2045     i = (Sum_vcachemvids + Sum_vcachelinkData +
2046          Sum_vcachelocks) * AFS_SMALLOCSIZ;
2047     printf
2048         ("%20s:\t8%d bytes\t[%d mount pnts, %d symbolic links, %d unix locks]\n",
2049          "[VC use of sml fp]*", i, Sum_vcachemvids, Sum_vcachelinkData,
2050          Sum_vcachelocks);
2051 #endif
2052
2053 #define NAXSs (1000 / sizeof(struct axscache))
2054 #ifdef  AFS32
2055     i = (NAXSs * sizeof(struct axscache));
2056     T += i;
2057     printf("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each]\n",
2058            "ACL List free pool", i, Sum_vcacheacc, sizeof(struct axscache));
2059 #else
2060     {
2061         struct axscache *xp, xpe, *nxp = &xpe;
2062
2063         findsym("afs_xaxscnt", &symoff);
2064         kread(kmem, symoff, (char *)&i, sizeof i);
2065         j = i * (NAXSs * sizeof(struct axscache));
2066         T += j;
2067         printf
2068             ("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each - %d blocks of %d]\n",
2069              "ACL List free pool", j, Sum_vcacheacc, sizeof(struct axscache),
2070              i, (NAXSs * sizeof(struct axscache)));
2071     }
2072 #endif
2073
2074 #ifdef  AFS32
2075     i = print_dcaches(0);
2076     j = (i * sizeof(struct dcache));
2077     T += j;
2078     printf
2079         ("%20s:\t%8d bytes\t[%d dcaches/%d bytes each - ONLY USED COUNTED]\n",
2080          "Dcache package", j, i, sizeof(struct dcache));
2081 #else
2082     findsym("afs_dcentries", &symoff);
2083     kread(kmem, symoff, (char *)&i, sizeof i);
2084     j = (i * sizeof(struct dcache));
2085     T += j;
2086     printf("%20s:\t%8d bytes\t[%d dcaches/%d bytes each]\n", "Dcache package",
2087            j, i, sizeof(struct dcache));
2088 #endif
2089     findsym("afs_cacheFiles", &symoff);
2090     kread(kmem, symoff, (char *)&i, sizeof i);
2091     findsym("afs_cacheStats", &symoff);
2092     kread(kmem, symoff, (char *)&j, sizeof j);
2093
2094     k = (j * sizeof(struct vcache));
2095     printf
2096         ("%20s:\t%8d bytes\t[%d free vcaches/%d bytes each - %d active entries]\n",
2097          "Vcache free list", k, j, sizeof(struct vcache), tvs);
2098     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2099            "Dcache Index Table", i * 4, i, 4);
2100 #ifndef AFS32
2101     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2102            "Dcache Index Times", i * 8, i, 8);
2103 #else
2104     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2105            "Dcache Index Times", i * 4, i, 4);
2106 #endif
2107     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2108            "Dcache Index Flags", i, i, 1);
2109 /*    printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Dcache free list", i, i, 1);*/
2110 #ifndef AFS32
2111     T += k + (i * 4) + (i * 8) + i;
2112 #else
2113     T += k + (i * 4) + (i * 4) + i;
2114 #endif
2115
2116     i = (j = afs_cmperfstats.bufAlloced) * sizeof(struct buffer);
2117     T += i;
2118     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Buffer package",
2119            i, j, sizeof(struct buffer));
2120 #if     !AFS_USEBUFFERS
2121 #define AFS_BUFFER_PAGESIZE 2048
2122     i = j * AFS_BUFFER_PAGESIZE;
2123     T += i;
2124     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2125            "Xtra Buffer pkg area", i, j, AFS_BUFFER_PAGESIZE);
2126 #endif
2127
2128     Sum_exps = 0;
2129     Sum_nfssysnames = 0;
2130     i = print_nfss(0);
2131     k = Sum_exps * sizeof(struct afs_exporter);
2132     T += k;
2133     if (k)
2134         printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2135                "Xlator Exporter list", k, Sum_exps,
2136                sizeof(struct afs_exporter));
2137
2138     j = (i * sizeof(struct nfsclientpag)) + Sum_nfssysnames;
2139     T += j;
2140     if (j)
2141         printf
2142             ("%20s:\t%8d bytes\t[%d entries/%d bytes each + %d for remote sysnames]\n",
2143              "Xlator Nfs clnt pkg", j, i, sizeof(struct nfsclientpag),
2144              Sum_nfssysnames);
2145
2146     i = (j = afs_cmperfstats.LargeBlocksAlloced) * AFS_LRALLOCSIZ;
2147     T += i;
2148     printf
2149         ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2150          "Large Free Pool", i, j, AFS_LRALLOCSIZ,
2151          afs_cmperfstats.LargeBlocksActive);
2152
2153     i = (j = afs_cmperfstats.SmallBlocksAlloced) * AFS_SMALLOCSIZ;
2154     T += i;
2155     printf
2156         ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2157          "Small Free Pool", i, j, AFS_SMALLOCSIZ,
2158          afs_cmperfstats.SmallBlocksActive);
2159
2160 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
2161     findsym("afs_evhashcnt", &symoff);
2162     kread(kmem, symoff, (char *)&j, sizeof j);
2163     i = (j * sizeof(event_t));
2164     T += i;
2165     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2166            "afs glock Event Pool", i, j, sizeof(event_t));
2167 /*    printf("XXXXXXX Count event queue allocs!!!! XXXXXX\n");*/
2168
2169 #endif
2170     i = j = 0;
2171     if (findsym("rxevent_nFree", &symoff))
2172         kread(kmem, symoff, (char *)&j, sizeof j);
2173     if (findsym("rxevent_nPosted", &symoff))
2174         kread(kmem, symoff, (char *)&i, sizeof i);
2175     k = (i + j) * sizeof(struct rxevent);
2176     if (k) {
2177         T += k;
2178         printf("%20s:\t%8d bytes\t[%d free, %d posted/%d bytes each]\n",
2179                "Rx event pkg", k, j, i, sizeof(struct rxevent));
2180     } else {
2181         T += (k = 20 * sizeof(struct rxevent));
2182         printf
2183             ("%20s:\t%8d bytes\t[%d entries/%d bytes each - THIS IS MIN ALLOC/NOT ACTUAL]\n",
2184              "Rx event pkg", k, 20, sizeof(struct rxevent));
2185     }
2186
2187     findsym("rx_nFreePackets", &symoff);
2188     kread(kmem, symoff, (char *)&count, sizeof count);
2189 /*
2190     findsym("rx_initSendWindow", &symoff);
2191     kread(kmem, symoff, (char *) &i, sizeof i);
2192 */
2193     i = 0;
2194     findsym("rx_nPackets", &symoff);
2195     kread(kmem, symoff, (char *)&j, sizeof j);
2196     k = (j + i + 2) * sizeof(struct rx_packet);
2197     T += k;
2198     printf("%20s:\t%8d bytes\t[%d free packets/%d bytes each]\n",
2199            "Rx packet freelist", k, count, sizeof(struct rx_packet));
2200 #define rx_hashTableSize 256    /* XXX */
2201     i = (rx_hashTableSize * sizeof(struct rx_connection *));
2202     j = (rx_hashTableSize * sizeof(struct rx_peer *));
2203     k = i + j;
2204     T += k;
2205     printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2206            "Rx conn/peer tables", k, rx_hashTableSize,
2207            sizeof(struct rx_connection *));
2208
2209     findsym("rxi_Alloccnt", &symoff);
2210     kread(kmem, symoff, (char *)&j, sizeof j);
2211     findsym("rxi_Allocsize", &symoff);
2212     kread(kmem, symoff, (char *)&i, sizeof i);
2213     T += i;
2214     printf("%20s:\t%8d bytes\t[%d outstanding allocs]\n", "RX misc allocs", i,
2215            j);
2216
2217
2218     j = afs_cmperfstats.OutStandingMemUsage;
2219     printf("\n\n%20s:\t%8d bytes\n", "Mem used by afs", j);
2220     printf("%20s:\t%8d bytes\n", "Accounted-for mem", T);
2221     printf("%20s:\t%8d bytes\n", "Non acc'd-for mem", j - T);
2222
2223     printf
2224         ("\n\nNOTE:\n\tAll [...]* entries above aren't counted towards the total mem since they're redundant\n");
2225
2226 #ifdef AFS_LINUX22_ENV
2227     if (pnt)
2228         print_alloced_memlist();
2229 #endif
2230 }
2231
2232 #if     defined(sparc) && !defined(__linux__)
2233 int
2234 readmem(kmem, buf, vad, len)
2235      int kmem, len;
2236 #ifdef AFS_SUN57_ENV
2237      uintptr_t vad;
2238 #else
2239      int vad;
2240 #endif          /** AFS_SUN57_ENV **/
2241      char *buf;
2242 {
2243     int newlen;
2244     if ((newlen = kvm_kread(kd, vad, buf, len)) != len) {
2245         printf("Couldn't process dumpfile with supplied namelist %s\n", obj);
2246         exit(1);
2247     }
2248 }
2249 #endif
2250
2251 #ifdef  AFS_OSF_ENV
2252 static
2253 read_addr(int fd, unsigned long addr, unsigned long *val)
2254 {
2255     if (lseek(fd, addr, SEEK_SET) == -1)
2256         return (0);
2257     if (read(fd, val, sizeof(long)) != sizeof(long))
2258         return (0);
2259     return (1);
2260 }
2261
2262 static pt_entry_t *ptes = NULL;
2263 static
2264 addr_to_offset(unsigned long addr, unsigned long *ret, int fd)
2265 {
2266     off_t symoff;
2267     pt_entry_t pte, *val;
2268     char *str, *ptr;
2269
2270     if (IS_SEG1_VA(addr)) {
2271         if (ptes == NULL) {
2272             int i, loc;
2273             unsigned long loc1, loc2[2];
2274             findsym("kernel_pmap", &symoff);
2275             loc1 = coreadj(symoff);
2276             /*printf("ptes=%lx -> %lx\n", symoff, loc1); */
2277             if (lseek(fd, loc1, L_SET /*0 */ ) != loc1) {
2278                 perror("lseek");
2279                 exit(1);
2280             }
2281             if ((i = read(fd, (char *)&loc1, sizeof(long))) != sizeof(long)) {
2282                 printf("Read of kerne_map failed\n");
2283                 return;         /*exit(1); */
2284             }
2285             loc = loc1;
2286             /*printf("loc1 %lx -> %lx\n",  loc1, loc); */
2287             if (lseek(fd, loc, L_SET /*0 */ ) != loc) {
2288                 perror("lseek");
2289                 exit(1);
2290             }
2291             if ((i =
2292                  read(fd, (char *)loc2,
2293                       2 * sizeof(long))) != 2 * sizeof(long)) {
2294                 printf("Read of kerne_map failed\n");
2295                 return;         /*exit(1); */
2296             }
2297             ptes = (pt_entry_t *) loc2[1];
2298             /*printf("ptes=%lx\n", ptes); */
2299
2300         }
2301         if (!addr_to_offset
2302             ((unsigned long)(ptes + LEVEL1_PT_OFFSET(addr)),
2303              (unsigned long *)&val, fd))
2304             return (0);
2305         if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2306             return (0);
2307         val = ((pt_entry_t *) PTETOPHYS(&pte)) + LEVEL2_PT_OFFSET(addr);
2308         if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2309             return (0);
2310         val = ((pt_entry_t *) PTETOPHYS(&pte)) + LEVEL3_PT_OFFSET(addr);
2311         if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2312             return (0);
2313         *ret = PTETOPHYS(&pte) + (addr & ((1 << PGSHIFT) - 1));
2314         return (1);
2315     } else if (IS_KSEG_VA(addr)) {
2316         *ret = KSEG_TO_PHYS(addr);
2317         return (1);
2318     } else {
2319         return (0);
2320     }
2321 }
2322 #endif
2323
2324 #ifndef AFS_KDUMP_LIB
2325 void
2326 kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
2327 {
2328     int i;
2329
2330     memset(buf, 0, len);
2331
2332 #ifdef  AFS_OSF_ENV
2333     if (mem) {
2334         unsigned long ret;
2335         i = addr_to_offset(loc, &ret, kmem);
2336         if (i == 1)
2337             loc = ret;
2338         else {
2339             unsigned long loc1;
2340             loc1 = coreadj(loc);
2341             loc = loc1;
2342         }
2343     }
2344 #else
2345 #if     defined(sparc) && !defined(__linux__)
2346 #ifndef AFS_SUN5_ENV
2347     if (mem) {
2348 #endif
2349         readmem(kmem, buf, (off_t) loc, len);
2350         return;
2351 #ifndef AFS_SUN5_ENV
2352     }
2353 #endif
2354 #endif
2355 #endif
2356 #if     ! defined(AFS_SUN5_ENV)
2357 #if defined(AFS_SGI61_ENV) && !defined(AFS_32BIT_KERNEL_ENV)
2358     if (lseek64(kmem, loc, L_SET /*0 */ ) != loc)
2359 #else
2360     if (lseek(kmem, loc, L_SET /*0 */ ) != loc)
2361 #endif
2362     {
2363         perror("lseek");
2364         exit(1);
2365     }
2366     if (loc == 0) 
2367         printf("WARNING: Read failed: loc=0\n"); 
2368     else
2369         if ((i = read(kmem, buf, len)) != len) {
2370             printf("WARNING: Read failed: ");
2371             if (sizeof(loc) > sizeof(long)) {
2372                 printf("loc=%llx", loc);
2373             } else {
2374                 printf("loc=%lx", (long)loc);
2375             }
2376             printf(", buf=%lx, len=%ld, i=%d, errno=%d\n", (long)buf,
2377                    (long)len, i, errno);
2378             return;                     /*exit(1); */
2379         }
2380 #endif
2381 }
2382 #endif /* AFS_KDUMP_LIB */
2383
2384 #ifdef  AFS_SUN5_ENV
2385
2386 /**
2387   * When examining the dump of a 64 bit kernel, we use this function to
2388   * read symbols. The function opencore() calls this or rdsymbols() using
2389   * the macro RDSYMBOLS
2390   */
2391
2392 rdsymbols()
2393 {
2394
2395     FILE *fp;
2396     Elf *efd;
2397     Elf_Scn *cn = NULL;
2398 #ifdef  _LP64
2399     Elf64_Shdr *shdr;
2400     Elf64_Sym *stbl, *p1, *p2;
2401     Elf64_Shdr *(*elf_getshdr) (Elf_Scn *) = elf64_getshdr;
2402 #else
2403     Elf32_Shdr *shdr;
2404     Elf32_Sym *stbl, *p1, *p2;
2405     Elf32_Shdr *(*elf_getshdr) (Elf_Scn *) = elf32_getshdr;
2406 #endif
2407     Elf_Data *dp = NULL, *sdp = NULL;
2408
2409     int nsyms, i, fd;
2410
2411     if (!(fp = fopen(obj, "r"))) {
2412         printf("Can't open %s (%d)\n", core, errno);
2413         exit(1);
2414     }
2415
2416     fd = fileno(fp);
2417     lseek(fd, 0L, 0);
2418     if ((efd = elf_begin(fd, ELF_C_READ, 0)) == NULL) {
2419         printf("Can't elf begin (%d)\n", errno);
2420         exit(1);
2421     }
2422     while (cn = elf_nextscn(efd, cn)) {
2423         if ((shdr = elf_getshdr(cn)) == NULL) {
2424             elf_end(efd);
2425             printf("Can't read section header (%d)\n", errno);
2426             exit(1);
2427         }
2428         if (shdr->sh_type == SHT_SYMTAB)
2429             break;
2430     }
2431     dp = elf_getdata(cn, dp);
2432     p1 = stbl = (void *)dp->d_buf;
2433     nsyms = dp->d_size / sizeof(*stbl);
2434     cn = elf_getscn(efd, shdr->sh_link);
2435     sdp = elf_getdata(cn, sdp);
2436     tblp = malloc(sdp->d_size);
2437     memcpy(tblp, sdp->d_buf, sdp->d_size);
2438     p2 = tbl = malloc(nsyms * sizeof(*stbl));
2439     for (i = 0, scnt = 0; i < nsyms; i++, p1++, p2++) {
2440         p2->st_name = p1->st_name;
2441         p2->st_value = p1->st_value;
2442         p2->st_size = p1->st_size;
2443         p2->st_info = p1->st_info;
2444         p2->st_shndx = p1->st_shndx;
2445         scnt++;
2446     }
2447     elf_end(efd);
2448     close(fd);
2449 }
2450
2451 #endif          /** AFS_SUN5_ENV **/
2452
2453
2454 int
2455 opencore(core)
2456      char *core;
2457 {
2458 #ifdef AFS_KDUMP_LIB
2459     return 0;
2460 #else /* AFS_KDUMP_LIB */
2461     int fd;
2462
2463 #if     defined(sparc) && !defined(__linux__)
2464 #ifndef AFS_SUN5_ENV
2465     if (mem) {
2466 #endif
2467
2468         if ((kd = kvm_open(obj, core, NULL, O_RDONLY, "crash")) == NULL) {
2469             printf("Can't open kvm - core file %s\n", core);
2470             exit(1);
2471         }
2472 #ifndef AFS_SUN5_ENV
2473     } else
2474 #endif
2475 #ifdef  AFS_SUN5_ENV
2476         rdsymbols();
2477 #endif
2478 #endif /* sparc */
2479
2480     {
2481         if ((fd = open(core, O_RDONLY)) < 0) {
2482             perror(core);
2483             exit(1);
2484         }
2485         return fd;
2486     }
2487 #endif /* AFS_KDUMP_LIB */
2488 }
2489
2490
2491 void
2492 print_exporter(kmem, exporter, ptr, pnt)
2493      int kmem, pnt;
2494      struct afs_exporter *exporter, *ptr;
2495 {
2496     if (pnt) {
2497         printf("\tstates=%x, type=%x, *data=%lx\n", exporter->exp_states,
2498                exporter->exp_type, exporter->exp_data);
2499         printf
2500             ("\texp_stats (calls=%d, rejectedcalls=%d, nopag=%d, invalidpag=%d)\n",
2501              exporter->exp_stats.calls, exporter->exp_stats.rejectedcalls,
2502              exporter->exp_stats.nopag, exporter->exp_stats.invalidpag);
2503     }
2504 }
2505
2506
2507 void
2508 print_nfsclient(kmem, ep, ptr, pnt)
2509      int kmem, pnt;
2510      struct nfsclientpag *ep, *ptr;
2511 {
2512     char sysname[100];
2513         int count;
2514
2515     if (pnt)
2516         printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
2517                ptr, ep->uid, ep->host, ep->pag,
2518                ep->lastcall, ep->refCount, ep->sysnamecount);
2519
2520         for(count = 0; count < ep->sysnamecount; count++){
2521                 kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
2522                 printf("   %lx: @sys[%d]=%s\n",
2523                         ep->sysname[count], count, sysname);
2524                 Sum_nfssysnames += MAXSYSNAME;
2525         }
2526 }
2527
2528
2529 #if     defined(AFS_SUN5_ENV)
2530 pmutex(sp, mp)
2531      char *sp;
2532      kmutex_t *mp;
2533 {
2534 #ifdef  AFS_SUN54_ENV
2535
2536 #else
2537     struct stat_mutex *smp = (struct stat_mutex *)mp;
2538
2539     printf("%s mutex: %x %x\n", sp, smp->m_stats_lock, smp->m_type);
2540 #endif
2541 }
2542
2543 #endif
2544
2545 void
2546 print_unixuser(kmem, uep, ptr, pnt)
2547      int kmem, pnt;
2548      struct unixuser *uep, *ptr;
2549 {
2550     Sum_userstp += uep->stLen;
2551     if (pnt) {
2552         printf
2553             ("%lx: uid=x%x, cell=%x, vid=%d, refc=%d, states=%x, tokTime=%d, tikLen=%d\n",
2554              ptr, uep->uid, uep->cell, uep->vid, uep->refCount, uep->states,
2555              uep->tokenTime, uep->stLen);
2556         printf
2557             ("\tstp=%lx, clearTok[Han=x%x, x<%x,%x,%x,%x,%x,%x,%x,%x>, vid=%d, Bt=%d, Et=%d], exporter=%lx\n",
2558              uep->stp, uep->ct.AuthHandle, uep->ct.HandShakeKey[0],
2559              uep->ct.HandShakeKey[1], uep->ct.HandShakeKey[2],
2560              uep->ct.HandShakeKey[3], uep->ct.HandShakeKey[4],
2561              uep->ct.HandShakeKey[5], uep->ct.HandShakeKey[6],
2562              uep->ct.HandShakeKey[7], uep->ct.ViceId, uep->ct.BeginTimestamp,
2563              uep->ct.EndTimestamp, uep->exporter);
2564     }
2565 }
2566
2567 void
2568 print_cell(kmem, clep, ptr, pnt)
2569      int kmem, pnt;
2570      struct cell *clep, *ptr;
2571 {
2572     int i;
2573     char cellName[100];
2574     struct in_addr in;
2575
2576
2577     kread(kmem, (off_t) clep->cellName, cellName, (KDUMP_SIZE_T) 40);
2578     cellName[40] = 0;
2579     Sum_cellnames += strlen(cellName) + 1;
2580     if (pnt) {
2581         printf
2582             ("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n",
2583              ptr, cellName, clep->states, clep->cellNum, clep->cellIndex,
2584              clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
2585 #ifdef  AFS33
2586         if (clep->lcellp)
2587             printf("\tlinked cellp %lx\n", clep->lcellp);
2588 #endif
2589         printf("\tCell's servers: ");
2590         for (i = 0; i < MAXCELLHOSTS; i++) {
2591             if (pretty && (clep->cellHosts[i] == 0))
2592                 break;
2593             printf("[%lx] ", clep->cellHosts[i]);
2594         }
2595         printf("\n");
2596     }
2597 }
2598
2599
2600 void
2601 print_server(kmem, sep, ptr, conns, pnt)
2602      int kmem, conns, pnt;
2603      struct server *sep, *ptr;
2604 {
2605     struct srvAddr sa, *sap = &sa, *sap1;
2606     int j, mh = 0, cnt;
2607
2608     if (conns != 2 && pnt) {
2609         printf
2610             ("%lx: cell=%lx, addr=%lx, flags=0x%x, actTime=%x, lastDownS=%x, numDownIn=%d, sumofDownt=%d\n",
2611              ptr, sep->cell, sep->addr, sep->flags, sep->activationTime,
2612              sep->lastDowntimeStart, sep->numDowntimeIncidents,
2613              sep->sumOfDowntimes);
2614         if (sep->flags & SRVR_MULTIHOMED) {
2615             if (pnt) {
2616                 printf
2617                     ("\tuuid=[%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x]  addr_uniquifier=%x\n",
2618                      sep->sr_uuid.time_low, sep->sr_uuid.time_mid,
2619                      sep->sr_uuid.time_hi_and_version,
2620                      sep->sr_uuid.clock_seq_hi_and_reserved,
2621                      sep->sr_uuid.clock_seq_low, sep->sr_uuid.node[0],
2622                      sep->sr_uuid.node[1], sep->sr_uuid.node[2],
2623                      sep->sr_uuid.node[3], sep->sr_uuid.node[4],
2624                      sep->sr_uuid.node[5], sep->sr_addr_uniquifier);
2625             }
2626             mh = 1;
2627         }
2628         for (j = 0, cnt = 1, sap1 = sep->addr; sap1;
2629              sap1 = sap->next_sa, j++, cnt++) {
2630             kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2631             if (pnt) {
2632                 if (mh) {
2633                     printf
2634                         ("\t   #%d ip-addr(%lx): [sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, next_bkt=%lx]\n",
2635                          cnt, sap1, PrintIPAddr(sap->sa_ip), sap->sa_portal,
2636                          sap->sa_iprank, sap->sa_flags, sap->conns,
2637                          sap->server, sap->next_bkt);
2638                 } else {
2639                     printf
2640                         ("\t[sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx]\n",
2641                          PrintIPAddr(sap->sa_ip), sap->sa_portal,
2642                          sap->sa_iprank, sap->sa_flags, sap->conns,
2643                          sap->server, sap->next_bkt);
2644                 }
2645             }
2646         }
2647     }
2648     if (sep->cbrs && pnt) {
2649         struct afs_cbr cba, *cbsap = &cba, *cbsap1;
2650
2651         printf(" Callbacks to be returned:\n");
2652         for (j = 0, cbsap1 = sep->cbrs; cbsap1; cbsap1 = cbsap->next, j++) {
2653             kread(kmem, (off_t) cbsap1, (char *)cbsap, sizeof(*cbsap));
2654             printf("     #%2d) %lx [v=%d, n=%d, u=%d]\n", j, cbsap1,
2655                    cbsap->fid.Volume, cbsap->fid.Vnode, cbsap->fid.Unique);
2656         }
2657     }
2658     if (conns) {
2659         for (j = 0, sap1 = sep->addr; sap1; sap1 = sap->next_sa, j++) {
2660             kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2661             print_conns(kmem, sap1, sap->conns, conns, pnt);
2662         }
2663     } else if (pnt)
2664         printf("\n");
2665 }
2666
2667
2668 void
2669 print_conns(kmem, srv, conns, Con, pnt)
2670      int kmem, Con, pnt;
2671      struct srvAddr *srv;
2672      struct conn *conns;
2673 {
2674     struct conn *cep, ce, *centry = &ce;
2675     int i = 1;
2676
2677     cep = (struct conn *)conns;
2678     if (pnt && Con != 2) {
2679         if (cep)
2680             printf("\tRPC connections for server %lx:\n", srv);
2681         else
2682             printf("\tNO RPC connections for server %x\n", srv);
2683     }
2684     for (; cep; cep = centry->next, Nconns++, i++) {
2685         if (pnt && Con != 2)
2686             printf("\t   #%d> ", i);
2687         kread(kmem, (off_t) cep, (char *)centry, sizeof *centry);
2688         print_conn(kmem, centry, cep, pnt);
2689     }
2690 }
2691
2692
2693 void
2694 print_conn(kmem, conns, ptr, pnt)
2695      int kmem, pnt;
2696      struct conn *conns, *ptr;
2697 {
2698     if (!pnt)
2699         return;
2700     printf("%lx: user=%lx, rx=%lx, srvr=%lx, ref=%d, port=%d, forceC=%d\n",
2701            ptr, conns->user, conns->id, conns->srvr, conns->refCount,
2702            conns->port, conns->forceConnectFS);
2703
2704 }
2705
2706
2707 void
2708 print_volume(kmem, vep, ptr, pnt)
2709      int kmem, pnt;
2710      struct volume *vep, *ptr;
2711 {
2712     int i;
2713     afs_int32 *loc;
2714     char Volname[100];
2715
2716
2717
2718     loc = (afs_int32 *) & vep->lock;
2719     if (vep->name) {
2720         kread(kmem, (off_t) vep->name, Volname, (KDUMP_SIZE_T) 40);
2721         Sum_volnames += strlen(Volname) + 1;
2722     }
2723     if (!pnt)
2724         return;
2725     printf("%lx: cell=%x, vol=%d, name=%s, roVol=%d, backVol=%d\n", ptr,
2726            vep->cell, vep->volume, (vep->name ? Volname : "nil"), vep->roVol,
2727            vep->backVol);
2728 #ifdef  AFS33
2729     printf
2730         ("\trwVol=%d, AcTime=%d, copyDate=%d, expTime=%d, vtix=%d, refC=%d, states=%x\n",
2731          vep->rwVol, vep->accessTime, vep->copyDate, vep->expireTime,
2732          vep->vtix, vep->refCount, vep->states);
2733 #else
2734     printf
2735         ("\trwVol=%d, AcTime=%d, copyDate=%d, vtix=%d, refC=%d, states=%x\n",
2736          vep->rwVol, vep->accessTime, vep->copyDate, vep->vtix, vep->refCount,
2737          vep->states);
2738 #endif
2739     printf("\tVolume's statuses: ");
2740     for (i = 0; i < MAXHOSTS && vep->serverHost[i]; i++)
2741         printf("[%d] ", vep->status[i]);
2742     printf("\n");
2743
2744     printf("\tVolume's servers: ");
2745     for (i = 0; i < MAXHOSTS && vep->serverHost[i]; i++)
2746         printf("[%lx] ", vep->serverHost[i]);
2747     printf("\n");
2748
2749     print_venusfid("\tdotdot", &vep->dotdot);
2750     printf("\n");
2751
2752     print_venusfid("\tmtpnt", &vep->mtpoint);
2753     printf("\n");
2754
2755 #ifdef  AFS33
2756     if (vep->rootVnode)
2757         printf("\trootVnode = %d, rootUnique = %d\n", vep->rootVnode,
2758                vep->rootUnique);
2759 #endif
2760     printf("\tlock=0x%x\n", *loc);
2761 }
2762
2763
2764 void
2765 print_venusfid(string, vid)
2766      char *string;
2767      struct VenusFid *vid;
2768 {
2769     printf("%s(c=%x, v=%d, n=%d, u=%d)", string, vid->Cell, vid->Fid.Volume,
2770            vid->Fid.Vnode, vid->Fid.Unique);
2771 }
2772
2773
2774 void
2775 print_vnode(kmem, vep, ptr, pnt)
2776      int kmem, pnt;
2777      struct vnode *vep, *ptr;
2778 {
2779 #ifdef AFS_AIX_ENV
2780     struct gnode gnode;
2781     struct gnode *save_gnode;
2782 #endif /* AFS_AIX_ENV */
2783
2784     if (!pnt)
2785         return;
2786     printf("\n");
2787 #ifdef AFS_AIX_ENV
2788     save_gnode = vep->v_gnode;
2789     kread(kmem, (off_t) save_gnode, (char *)&gnode, sizeof(struct gnode));
2790     vep->v_gnode = &gnode;
2791 #endif /* AFS_AIX_ENV */
2792
2793 #ifdef  AFS_SUN5_ENV
2794     printf("%x: v_type=%d, v_flag=%d, v_count=%d, \n", ptr, vep->v_type,
2795            vep->v_flag, vep->v_count);
2796     printf
2797         ("\tv_v_stream=%x, v_pages=0x%x, v_mountdhere=%d, v_rdev=%d, v_vfsp=0x%x, v_filocks=0x%x\n",
2798          vep->v_stream, vep->v_pages, vep->v_vfsmountedhere, vep->v_rdev,
2799          vep->v_vfsp, vep->v_filocks);
2800     pmutex("\tVnode", &vep->v_lock);
2801     printf("\tCond v: 0x%x\n", vep->v_cv);
2802 #endif
2803 #ifdef AFS_AIX_ENV
2804     vep->v_gnode = save_gnode;
2805 #endif /* AFS_AIX_ENV */
2806 #ifdef AFS_SGI65_ENV
2807 #if defined(AFS_32BIT_KERNEL_ENV)
2808     printf("%lx: v_mreg=0x%lx", ptr, vep->v_mreg);
2809 #else
2810     printf("%llx: v_mreg=0x%llx", ptr, vep->v_mreg);
2811 #endif
2812     printf(", v_mregb=0x%lx\n", vep->v_mregb);
2813 #endif
2814 #ifdef AFS_LINUX22_ENV
2815     /* Print out the stat cache and other inode info. */
2816     printf
2817         ("\ti_ino=%d, i_mode=%x, i_nlink=%d, i_uid=%d, i_gid=%d, i_size=%d\n",
2818          vep->i_ino, vep->i_mode, vep->i_nlink, vep->i_uid, vep->i_gid,
2819          vep->i_size);
2820 #ifdef AFS_LINUX24_ENV
2821     printf
2822         ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2823          vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2824          vep->i_data.nrpages);
2825 #else
2826     printf
2827         ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2828          vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2829          vep->i_nrpages);
2830 #endif
2831 #ifdef AFS_LINUX26_ENV
2832     printf("\ti_op=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2833            vep->i_rdev, vep->i_sb);
2834 #else /* AFS_LINUX26_ENV */
2835     printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2836            vep->i_dev, vep->i_rdev, vep->i_sb);
2837 #endif /* AFS_LINUX26_ENV */
2838 #ifdef AFS_LINUX24_ENV
2839 #ifdef AFS_PARISC_LINUX24_ENV
2840     printf("\ti_sem: count=%d, wait=0x%x\n", vep->i_sem.count,
2841            vep->i_sem.wait);
2842 #else
2843     printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n", vep->i_sem.count,
2844            vep->i_sem.sleepers, vep->i_sem.wait);
2845 #endif
2846 #else
2847     printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count,
2848            vep->i_sem.waking, vep->i_sem.wait);
2849 #endif
2850 #ifdef AFS_LINUX26_ENV
2851     printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2852            vep->i_hash.pprev, vep->i_hash.next, vep->i_list.prev,
2853            vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2854 #else /* AFS_LINUX26_ENV */
2855     printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2856            vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev,
2857            vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2858 #endif /* AFS_LINUX26_ENV */
2859 #endif /* AFS_LINUX22_ENV */
2860 }
2861
2862 void
2863 print_vcache(kmem, vep, ptr, pnt)
2864      int kmem, pnt;
2865      struct vcache *vep, *ptr;
2866 {
2867     long *loc, j = 0;
2868     char *cloc;
2869     struct VenusFid vid;
2870     struct axscache acc, *accp = &acc, *acp;
2871     struct SimpleLocks sl, *slcp = &sl, *slp;
2872     char linkchar;
2873
2874     if (vep->mvid) {
2875         kread(kmem, (off_t) vep->mvid, (char *)&vid, sizeof(struct VenusFid));
2876         Sum_vcachemvids++;
2877     }
2878     if (vep->linkData)
2879         Sum_vcachelinkData++;
2880     loc = (long *)&vep->lock;
2881
2882     if (pnt) {
2883         if (!Dvnodes)
2884             printf("\n");
2885 #ifdef  AFS33
2886         printf("%lx: refC=%d, pv=%d, pu=%d, flushDv=%d.%d, mapDV=%d.%d, ",
2887                ptr, VREFCOUNT(vep), vep->parentVnode, vep->parentUnique,
2888                vep->flushDV.high, vep->flushDV.low, vep->mapDV.high,
2889                vep->mapDV.low);
2890 #ifdef AFS_64BIT_CLIENT
2891         printf
2892             ("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2893              (int)(vep->truncPos >> 32), (int)(vep->truncPos & 0xffffffff),
2894              vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters);
2895 #else /* AFS_64BIT_CLIENT */
2896         printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2897                vep->truncPos, vep->callback, vep->cbExpires, vep->opens,
2898                vep->execsOrWriters);
2899 #endif /* AFS_64BIT_CLIENT */
2900         printf("flcnt=%d, mvstat=%d\n", vep->flockCount, vep->mvstat);
2901         printf("\tstates=x%x, ", vep->states);
2902 #ifdef  AFS_SUN5_ENV
2903         printf("vstates=x%x, ", vep->vstates);
2904 #endif /* AFS_SUN5_ENV */
2905         printf("dchint=%x, anyA=0x%x\n", vep->dchint, vep->anyAccess);
2906 #ifdef AFS_64BIT_CLIENT
2907         printf
2908             ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2909              (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff),
2910              vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date,
2911              vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2912 #else /* AFS_64BIT_CLIENT */
2913         printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=%d]\n",
2914                vep->quick.dc, vep->quick.stamp, vep->quick.f,
2915                vep->quick.minLoc, vep->quick.len);
2916         printf
2917             ("\tmstat[len=%d, DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2918              vep->m.Length, vep->m.DataVersion.high, vep->m.DataVersion.low,
2919              vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode,
2920              vep->m.LinkCount);
2921 #endif /* AFS_64BIT_CLIENT */
2922 #else /* AFS33 */
2923         printf
2924             ("%x: refC=%d, pv=%d, pu=%d, flushDv=%d, mapDV=%d, truncPos=%d\n",
2925              ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique,
2926              vep->flushDV, vep->mapDV, vep->truncPos);
2927         printf("\tcallb=x%x, cbE=%d, opens=%d, XoW=%d, flcnt=%d, mvstat=%d\n",
2928                vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters,
2929                vep->flockCount, vep->mvstat);
2930         printf("\tstates=x%x, dchint=%x, anyA=0x%x\n", vep->states,
2931                vep->h1.dchint, vep->anyAccess);
2932         printf
2933             ("\tmstat[len=%d, DV=%d, Date=%d, Owner=%d, Group=%d, Mode=%d, linkc=%d]\n",
2934              vep->m.Length, vep->m.DataVersion, vep->m.Date, vep->m.Owner,
2935              vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2936 #endif /* AFS33 */
2937 #ifdef  AFS_AIX32_ENV
2938         loc = (afs_int32 *) & vep->pvmlock;
2939         printf("\tpvmlock=x%x, segid=%X, credp=%lx\n", *loc, vep->segid,
2940                vep->credp);
2941 #endif
2942         printf
2943             ("\tlock [wait=%x excl=%x readers=%x #waiting=%x last_reader=%d writer=%d src=%d]\n",
2944              vep->lock.wait_states, vep->lock.excl_locked,
2945              vep->lock.readers_reading, vep->lock.num_waiting,
2946              vep->lock.pid_last_reader, vep->lock.pid_writer,
2947              vep->lock.src_indicator);
2948         print_venusfid("\tfid", &vep->fid);
2949         if (vep->mvid) {
2950             printf(" ");
2951             print_venusfid("mvid", &vid);
2952         }
2953         printf("\n");
2954     }
2955     if (vep->Access) {
2956         if (pnt)
2957             printf("\tAccess Link list: %x\n", vep->Access);
2958         for (j = 0, acp = vep->Access; acp; acp = accp->next, j++) {
2959             kread(kmem, (off_t) acp, (char *)accp, sizeof(*accp));
2960             Sum_vcacheacc++;
2961             if (pnt)
2962                 printf("\t   %lx: %d) uid=0x%x, access=0x%x, next=%lx\n", acp,
2963                        j, accp->uid, accp->axess, accp->next);
2964         }
2965     }
2966     if (vep->slocks) {
2967         if (pnt)
2968             printf("\tLocking Link list: %lx\n", vep->slocks);
2969     }
2970 #ifdef  AFS33
2971     if (pnt)
2972         printf("\tCallbacks queue prev= %lx next= %lx\n", vep->callsort.prev,
2973                vep->callsort.next);
2974 #endif
2975     printf("\tvlruq.prev=%lx, vlruq.next=%lx\n", vep->vlruq.prev,
2976            vep->vlruq.next);
2977
2978     /* For defect 7733 - Print linkData field for symlinks */
2979     if (pnt) {
2980         if (vep->linkData) {
2981             cloc = (char *)vep->linkData;
2982             printf("\tSymlink information = '");
2983             while (1) {
2984                 kread(kmem, (off_t) cloc, &linkchar, (KDUMP_SIZE_T) 1);
2985                 cloc++;
2986                 if (linkchar == '\0') {
2987                     printf("'\n");
2988                     break;
2989                 } else {
2990                     printf("%c", linkchar);
2991                 }
2992             }
2993         }
2994     }
2995 #ifdef AFS_LINUX22_ENV
2996     printf("\tmapcnt=%d\n", vep->mapcnt);
2997 #endif
2998 }
2999
3000
3001 void
3002 print_dcache(kmem, dcp, dp, pnt)
3003      int kmem, pnt;
3004      struct dcache *dcp, *dp;
3005 {
3006     if (!pnt)
3007         return;
3008     printf("%lx: ", dp);
3009     print_venusfid(" fid", &dcp->f.fid);
3010     printf("refcnt=%d, dflags=%x, mflags=%x, validPos=%d\n", dcp->refCount,
3011            dcp->dflags, dcp->mflags, dcp->validPos);
3012
3013 #ifdef  AFS33
3014     printf("\tf.modtime=%d, f.versNo=%d.%d\n", dcp->f.modTime,
3015            dcp->f.versionNo.high, dcp->f.versionNo.low);
3016 #else
3017     printf("\tf.hvn=%d, f.hcn=%d, f.modtime=%d, f.versNo=%d\n",
3018            dcp->f.hvNextp, dcp->f.hcNextp, dcp->f.modTime, dcp->f.versionNo);
3019 #endif
3020 #ifdef AFS_SGI62_ENV
3021     printf
3022         ("\tf.chunk=%d, f.inode=%lld, f.chunkBytes=%d, f.states=%x",
3023          dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
3024 #else
3025     printf
3026         ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x\n",
3027          dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
3028 #endif
3029     printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d\n",
3030            dcp->lruq.prev, dcp->lruq.next, dcp->index);
3031 }
3032
3033 void
3034 print_bkg(kmem)
3035      int kmem;
3036 {
3037     off_t symoff;
3038     struct brequest afs_brs[NBRS], ue, *uentry = &ue, *uep;
3039     afs_int32 count, i, j;
3040     short scount;
3041
3042     printf("\n\nPrinting some background daemon info...\n\n");
3043     findsym("afs_brsWaiters", &symoff);
3044     kread(kmem, symoff, (char *)&scount, sizeof scount);
3045     printf("Number of processes waiting for bkg daemon %d\n", scount);
3046     findsym("afs_brsDaemons", &symoff);
3047     kread(kmem, symoff, (char *)&scount, sizeof scount);
3048     printf("Number of free bkg daemons %d\n", scount);
3049     findsym("afs_brs", &symoff);
3050     kread(kmem, symoff, (char *)afs_brs, sizeof afs_brs);
3051     printf("Print the current bkg process table\n");
3052     for (i = 0, j = 0; i < NBRS; i++, j++) {
3053 /*      kread(kmem, (off_t) afs_brs[i], (char *)uentry, sizeof *uentry);*/
3054         uentry = &afs_brs[i];
3055         if (uentry->refCount == 0)
3056             break;
3057         printf
3058             ("[%d] vcache=0x%lx, cred=0x%lx, code=%d, refCount=%d, opcode=%d, flags=%x [%lx, %lx, %lx, %lx]\n",
3059              i, uentry->vc, uentry->cred, uentry->code, uentry->refCount,
3060              uentry->opcode, uentry->flags, uentry->size_parm[0],
3061              uentry->size_parm[1], uentry->ptr_parm[0], uentry->ptr_parm[1]);
3062
3063     }
3064     printf("... found %d active 'afs_brs' entries\n", j);
3065 }
3066
3067 void
3068 print_vlru(kmem)
3069      int kmem;
3070 {
3071     off_t symoff;
3072     struct vcache Ve, *Ventry = &Ve, *Vep, *tvc;
3073     struct afs_q VLRU, vlru, *vu = &vlru, *tq, *uq;
3074     u_long vlru_addr, l1, l2, l3;
3075     afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
3076     short scount;
3077
3078     printf("\n\nPrinting vcache VLRU info (oldest first)...\n\n");
3079     findsym("afs_cacheStats", &symoff);
3080     kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
3081 #ifdef  AFS_OSF_ENV
3082     findsym("afs_maxvcount", &symoff);
3083     kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
3084     findsym("afs_vcount", &symoff);
3085     kread(kmem, symoff, (char *)&vcount, sizeof vcount);
3086     findsym("max_vnodes", &symoff);
3087     kread(kmem, symoff, (char *)&nvnode, sizeof nvnode);
3088     printf("max number of vcache entries = %d\n", maxvcount);
3089     printf("number of vcaches in use = %d\n", vcount);
3090     printf("total number of system vnode entries = %d\n", nvnode);
3091 #endif
3092     findsym("VLRU", &symoff);
3093     kread(kmem, symoff, (char *)&VLRU, sizeof VLRU);
3094     vlru_addr = (u_long) symoff;
3095     for (tq = VLRU.prev; (u_long) tq != vlru_addr; tq = uq) {
3096         tvc = QTOV(tq);
3097         kread(kmem, (off_t) tq, (char *)vu, sizeof VLRU);
3098         uq = vu->prev;
3099         kread(kmem, (off_t) tvc, (char *)Ventry, sizeof *Ventry);
3100         print_vcache(kmem, Ventry, tvc, 1);
3101         j++;
3102     }
3103     printf("... found %d active vcache entries in the VLRU\n", j);
3104 }
3105
3106 void
3107 print_dlru(kmem)
3108      int kmem;
3109 {
3110     off_t symoff;
3111     struct dcache Ve, *Ventry = &Ve, *Vep, *tdc;
3112     struct afs_q DLRU, dlru, *vu = &dlru, *tq, *uq;
3113     u_long dlru_addr, l1, l2, l3;
3114     afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
3115     short scount;
3116
3117     printf("\n\nPrinting vcache DLRU info...\n\n");
3118     findsym("afs_DLRU", &symoff);
3119     kread(kmem, symoff, (char *)&DLRU, sizeof DLRU);
3120     dlru_addr = (u_long) symoff;
3121     for (tq = DLRU.prev; (u_long) tq != dlru_addr; tq = uq) {
3122         tdc = (struct dcache *)tq;
3123         kread(kmem, (off_t) tq, (char *)vu, sizeof DLRU);
3124         uq = vu->prev;
3125         kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
3126         print_dcache(kmem, Ventry, tdc, 1);
3127         j++;
3128     }
3129     printf("... found %d active dcache entries in the DLRU\n\n\n", j);
3130
3131     findsym("afs_freeDSList", &symoff);
3132     kread(kmem, symoff, (char *)&dlru_addr, sizeof dlru_addr);
3133     printf("\tfreeDSList link list starts at 0x%x\n", dlru_addr);
3134     j = 0;
3135     for (tdc = (struct dcache *)dlru_addr; tdc;
3136          tdc = (struct dcache *)Ventry->lruq.next) {
3137         kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
3138         print_dcache(kmem, Ventry, tdc, 1);
3139         j++;
3140 /*      printf("%3d) %x\n", j, tdc);*/
3141     }
3142     printf("... found %d dcache entries in the freeDSList\n", j);
3143 }
3144
3145 int
3146 print_gcpags(pnt)
3147      int pnt;
3148 {
3149     off_t symoff;
3150     afs_int32 afs_gcpags;
3151     afs_int32 afs_gcpags_procsize;
3152
3153     if (pnt)
3154         printf("\n\nPrinting GCPAGS structures...\n");
3155
3156     findsym("afs_gcpags", &symoff);
3157     kread(kmem, symoff, (char *)&afs_gcpags, sizeof afs_gcpags);
3158
3159     findsym("afs_gcpags_procsize", &symoff);
3160     kread(kmem, symoff, (char *)&afs_gcpags_procsize,
3161           sizeof afs_gcpags_procsize);
3162
3163     printf("afs_gcpags=%d\n", afs_gcpags);
3164     printf("afs_gcpags_procsize=%d\n", afs_gcpags_procsize);
3165
3166     return 0;
3167 }
3168
3169
3170 #ifdef  AFS_AIX_ENV
3171 #include <sys/syspest.h>        /* to define the assert and ASSERT macros       */
3172 #include <sys/timer.h>          /* For the timer related defines                */
3173 #include <sys/intr.h>           /* for the serialization defines                */
3174 #include <sys/malloc.h>         /* for the parameters to xmalloc()              */
3175
3176 struct tos {
3177     struct tos *toprev;         /* previous tos in callout table */
3178     struct tos *tonext;         /* next tos in callout table    */
3179     struct trb *trb;            /* this timer request block     */
3180     afs_int32 type;
3181     long p1;
3182 };
3183
3184 struct callo {
3185     int ncallo;                 /* number of callout table elements     */
3186     struct tos *head;           /* callout table head element           */
3187 };
3188 #endif
3189
3190 void
3191 print_callout(kmem)
3192      int kmem;
3193 {
3194     off_t symoff;
3195 #ifndef AFS_AIX_ENV
3196     printf("\n\nCallout table doesn't exist for this system\n");
3197 #else
3198     struct callo Co, *Coe = &Co, *Cop;
3199     struct tos To, *Toe = &To, *tos;
3200     struct trb Trb, *Trbe = &Trb, *trb;
3201     register int i = 0;
3202
3203
3204     printf("\n\nPrinting callout table info...\n\n");
3205     findsym("afs_callo", &symoff);
3206     kread(kmem, symoff, (char *)&Co, sizeof Co);
3207     printf("Number of callouts %d\n", Co.ncallo);
3208     if (Co.ncallo > 0) {
3209         printf("Count\tType\taddr\tfunc\tdata\n");
3210         for (tos = Co.head; tos != NULL; tos = Toe->tonext) {
3211             i++;
3212             kread(kmem, (off_t) tos, (char *)&To, sizeof To);
3213             kread(kmem, (off_t) Toe->trb, (char *)&Trb, sizeof Trb);
3214             printf("%d\t%d\t%x\t%x\t%x\n", i, Toe->type, Toe->p1, Trbe->tof,
3215                    Trbe->func_data);
3216         }
3217     }
3218 #endif
3219 }
3220
3221 void
3222 print_dnlc(kmem)
3223      int kmem;
3224 {
3225     struct nc *nameHash[256];
3226
3227 }
3228
3229
3230 void
3231 print_global_locks(kmem)
3232      int kmem;
3233 {
3234     off_t symoff;
3235     afs_int32 count;
3236     int i;
3237     static struct {
3238         char *name;
3239     } locks[] = { {
3240     "afs_xvcache"}, {
3241     "afs_xdcache"}, {
3242     "afs_xserver"}, {
3243     "afs_xvcb"}, {
3244     "afs_xbrs"}, {
3245     "afs_xcell"}, {
3246     "afs_xconn"}, {
3247     "afs_xuser"}, {
3248     "afs_xvolume"},
3249 #ifndef AFS_AIX_ENV
3250     {
3251     "osi_fsplock"},
3252 #endif
3253     {
3254     "osi_flplock"}, {
3255     "afs_xcbhash"}, {
3256     "afs_xinterface"}, {
3257     0},};
3258
3259
3260     printf("\n\nPrinting afs global locks...\n\n");
3261     for (i = 0; locks[i].name; i++) {
3262         findsym(locks[i].name, &symoff);
3263         kread(kmem, symoff, (char *)&count, sizeof count);
3264         printf("%s = 0x%x\n", locks[i].name, count);
3265     }
3266 }
3267
3268
3269 void
3270 print_global_afs_resource(kmem)
3271      int kmem;
3272 {
3273     off_t symoff;
3274     char sysname[100];
3275     afs_int32 count;
3276     long addr;
3277
3278     printf("\n\nPrinting some general resource related globals...\n\n");
3279     findsym("afs_setTimeHost", &symoff);
3280     kread(kmem, symoff, (char *)&count, sizeof count);
3281     printf("\tafs_setTimeHost = 0x%x\n", count);
3282     findsym("afs_volCounter", &symoff);
3283     kread(kmem, symoff, (char *)&count, sizeof count);
3284     printf("\tafs_volCounter = 0x%x\n", count);
3285     findsym("afs_cellindex", &symoff);
3286     kread(kmem, symoff, (char *)&count, sizeof count);
3287     printf("\tafs_cellIndex = 0x%x\n", count);
3288     findsym("afs_marinerHost", &symoff);
3289     kread(kmem, symoff, (char *)&count, sizeof count);
3290     printf("\tafs_marinerHost = 0x%x\n", count);
3291     findsym("afs_sysname", &symoff);
3292     kread(kmem, symoff, (char *)&addr, sizeof addr);
3293 #ifdef  AFS_HPUX_ENV
3294     printf("\tafs_sysname = %d\n", addr);
3295 #else
3296     kread(kmem, (off_t) addr, sysname, (KDUMP_SIZE_T) 30);
3297     printf("\tafs_sysname = %s\n", sysname);
3298 #endif
3299 #ifdef AFS_SGI65_ENV
3300     findsym("afs_ipno", &symoff);
3301     kread(kmem, symoff, (char *)&count, sizeof count);
3302     printf("\tCPU BOARD = IP%d\n", count);
3303 #endif
3304 }
3305
3306
3307 void
3308 print_global_afs_cache(kmem)
3309      int kmem;
3310 {
3311     off_t symoff;
3312     char sysname[100];
3313     afs_int32 count;
3314 #ifdef AFS_SGI62_ENV
3315     ino64_t inode;
3316 #endif
3317 #ifndef AFS32
3318     afs_hyper_t h;
3319 #endif
3320
3321     printf("\n\nPrinting some general cache related globals...\n\n");
3322     findsym("afs_mariner", &symoff);
3323     kread(kmem, symoff, (char *)&count, sizeof count);
3324     printf("\tafs_mariner = 0x%x\n", count);
3325 #ifndef AFS_OSF_ENV
3326     findsym("freeVCList", &symoff);
3327     kread(kmem, symoff, (char *)&count, sizeof count);
3328     printf("\tafs_freeVCList = 0x%x XXX\n", count);
3329 #endif
3330     findsym("afs_freeDCList", &symoff);
3331     kread(kmem, symoff, (char *)&count, sizeof count);
3332     printf("\tfreeDCList = 0x%x\n", count);
3333     findsym("afs_freeDCCount", &symoff);
3334     kread(kmem, symoff, (char *)&count, sizeof count);
3335     printf("\tfreeDCCount = 0x%x (%d)\n", count, count);
3336     findsym("afs_discardDCList", &symoff);
3337     kread(kmem, symoff, (char *)&count, sizeof count);
3338     printf("\tdiscardDCList = 0x%x\n", count);
3339     findsym("afs_discardDCCount", &symoff);
3340     kread(kmem, symoff, (char *)&count, sizeof count);
3341     printf("\tdiscardDCCount = 0x%x (%d)\n", count, count);
3342     findsym("afs_freeDSList", &symoff);
3343     kread(kmem, symoff, (char *)&count, sizeof count);
3344     printf("\tfreeDSList= 0x%x XXXX\n", count);
3345 #ifdef AFS_SGI62_ENV
3346     findsym("cacheInode", &symoff);
3347     kread(kmem, symoff, (char *)&inode, sizeof inode);
3348     printf("\tcacheInode = 0x%llx (%lld)\n", inode, inode);
3349     findsym("volumeInode", &symoff);
3350     kread(kmem, symoff, (char *)&inode, sizeof inode);
3351     printf("\tvolumeInode = 0x%llx (%lld)\n", inode, inode);
3352 #else
3353     findsym("cacheInode", &symoff);
3354     kread(kmem, symoff, (char *)&count, sizeof count);
3355     printf("\tcacheInode = 0x%x (%d)\n", count, count);
3356     findsym("volumeInode", &symoff);
3357     kread(kmem, symoff, (char *)&count, sizeof count);
3358     printf("\tvolumeInode = 0x%x (%d)\n", count, count);
3359 #endif
3360     findsym("cacheDiskType", &symoff);
3361     kread(kmem, symoff, (char *)&count, sizeof count);
3362     printf("\tcacheDiskType = 0x%x (%d)\n", count, count);
3363 #ifndef AFS32
3364     findsym("afs_indexCounter", &symoff);
3365     kread(kmem, symoff, (char *)&h, sizeof(struct afs_hyper_t));
3366     printf("\tafs_indexCounter = 0x%X.%X (%d.%d)\n", h.high, h.low, h.high,
3367            h.low);
3368 #endif
3369     findsym("afs_cacheFiles", &symoff);
3370     kread(kmem, symoff, (char *)&count, sizeof count);
3371     printf("\tafs_cacheFiles = 0x%x (%d)\n", count, count);
3372     findsym("afs_cacheBlocks", &symoff);
3373     kread(kmem, symoff, (char *)&count, sizeof count);
3374     printf("\tafs_cacheBlocks = 0x%x (%d)\n", count, count);
3375     findsym("afs_cacheStats", &symoff);
3376     kread(kmem, symoff, (char *)&count, sizeof count);
3377     printf("\tafs_cacheStats = 0x%x (%d)\n", count, count);
3378     findsym("afs_blocksUsed", &symoff);
3379     kread(kmem, symoff, (char *)&count, sizeof count);
3380     printf("\tafs_blocksUsed = 0x%x (%d)\n", count, count);
3381     findsym("afs_blocksDiscarded", &symoff);
3382     kread(kmem, symoff, (char *)&count, sizeof count);
3383     printf("\tafs_blocksDiscarded = 0x%x (%d)\n", count, count);
3384     findsym("afs_fsfragsize", &symoff);
3385     kread(kmem, symoff, (char *)&count, sizeof count);
3386     printf("\tafs_fsfragsize = 0x%x\n", count);
3387     findsym("afs_WaitForCacheDrain", &symoff);
3388     kread(kmem, symoff, (char *)&count, sizeof count);
3389     printf("\tafs_WaitForCacheDrain = 0x%x (%d)\n", count, count);
3390     findsym("afs_CacheTooFull", &symoff);
3391     kread(kmem, symoff, (char *)&count, sizeof count);
3392     printf("\tafs_CacheTooFull = 0x%x (%d)\n", count, count);
3393
3394
3395     if (findsym("pagCounter", &symoff)) {
3396         kread(kmem, symoff, (char *)&count, sizeof count);
3397         printf("\tpagCounter = 0x%x (%d)\n", count, count);
3398     } else {
3399         printf("Ignoring pagCounter\n");
3400     }
3401 }
3402
3403
3404 void
3405 print_rxstats(kmem)
3406      int kmem;
3407 {
3408     off_t symoff;
3409     char sysname[100];
3410     afs_int32 count, i;
3411     struct rx_stats rx_stats;
3412
3413     printf("\n\nPrinting some general RX stats...\n\n");
3414     findsym("rx_stats", &symoff);
3415     kread(kmem, symoff, (char *)&rx_stats, sizeof rx_stats);
3416     printf("\t\tpacketRequests = %d\n", rx_stats.packetRequests);
3417     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECEIVE,
3418            rx_stats.receivePktAllocFailures);
3419     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND,
3420            rx_stats.sendPktAllocFailures);
3421     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SPECIAL,
3422            rx_stats.specialPktAllocFailures);
3423     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECV_CBUF,
3424            rx_stats.receiveCbufPktAllocFailures);
3425     printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND_CBUF,
3426            rx_stats.sendCbufPktAllocFailures);
3427     printf("\t\tsocketGreedy = %d\n", rx_stats.socketGreedy);
3428     printf("\t\tbogusPacketOnRead = %d\n", rx_stats.bogusPacketOnRead);
3429     printf("\t\tbogusHost = %d\n", rx_stats.bogusHost);
3430     printf("\t\tnoPacketOnRead = %d\n", rx_stats.noPacketOnRead);
3431     printf("\t\tnoPacketBuffersOnRead = %d\n",
3432            rx_stats.noPacketBuffersOnRead);
3433     printf("\t\tselects = %d\n", rx_stats.selects);
3434     printf("\t\tsendSelects = %d\n", rx_stats.sendSelects);
3435     for (i = 0; i < RX_N_PACKET_TYPES; i++)
3436         printf("\t\tpacketsRead[%d] = %d\n", i, rx_stats.packetsRead[i]);
3437     printf("\t\tdataPacketsRead = %d\n", rx_stats.dataPacketsRead);
3438     printf("\t\tackPacketsRead = %d\n", rx_stats.ackPacketsRead);
3439     printf("\t\tdupPacketsRead = %d\n", rx_stats.dupPacketsRead);
3440     printf("\t\tspuriousPacketsRead = %d\n", rx_stats.spuriousPacketsRead);
3441     for (i = 0; i < RX_N_PACKET_TYPES; i++)
3442         printf("\t\tpacketsSent[%d] = %d\n", i, rx_stats.packetsSent[i]);
3443     printf("\t\tackPacketsSent = %d\n", rx_stats.ackPacketsSent);
3444     printf("\t\tpingPacketsSent = %d\n", rx_stats.pingPacketsSent);
3445     printf("\t\tabortPacketsSent = %d\n", rx_stats.abortPacketsSent);
3446     printf("\t\tbusyPacketsSent = %d\n", rx_stats.busyPacketsSent);
3447     printf("\t\tdataPacketsSent = %d\n", rx_stats.dataPacketsSent);
3448     printf("\t\tdataPacketsReSent = %d\n", rx_stats.dataPacketsReSent);
3449     printf("\t\tdataPacketsPushed = %d\n", rx_stats.dataPacketsPushed);
3450     printf("\t\tignoreAckedPacket = %d\n", rx_stats.ignoreAckedPacket);
3451     printf("\t\ttotalRtt = %d sec, %d usec\n", rx_stats.totalRtt.sec,
3452            rx_stats.totalRtt.usec);
3453     printf("\t\tminRtt = %d sec, %d usec\n", rx_stats.minRtt.sec,
3454            rx_stats.minRtt.usec);
3455     printf("\t\tmaxRtt = %d sec, %d usec\n", rx_stats.maxRtt.sec,
3456            rx_stats.maxRtt.usec);
3457     printf("\t\tnRttSamples = %d\n", rx_stats.nRttSamples);
3458     printf("\t\tnServerConns = %d\n", rx_stats.nServerConns);
3459     printf("\t\tnClientConns = %d\n", rx_stats.nClientConns);
3460     printf("\t\tnPeerStructs = %d\n", rx_stats.nPeerStructs);
3461     printf("\t\tnCallStructs = %d\n", rx_stats.nCallStructs);
3462     printf("\t\tnFreeCallStructs = %d\n", rx_stats.nFreeCallStructs);
3463     printf("\t\tnetSendFailures  = %d\n", rx_stats.netSendFailures);
3464     printf("\t\tfatalErrors      = %d\n", rx_stats.fatalErrors);
3465 }
3466
3467
3468 void
3469 print_rx(kmem)
3470      int kmem;
3471 {
3472     off_t symoff;
3473     char sysname[100], c;
3474     afs_int32 count, i, ar[100];
3475     short sm;
3476     struct rx_stats rx_stats;
3477
3478     printf("\n\nPrinting some RX globals...\n\n");
3479     findsym("rx_extraQuota", &symoff);
3480     kread(kmem, symoff, (char *)&count, sizeof count);
3481     printf("\trx_extraQuota = %d\n", count);
3482     findsym("rx_extraPackets", &symoff);
3483     kread(kmem, symoff, (char *)&count, sizeof count);
3484     printf("\trx_extraPackets = %d\n", count);
3485     findsym("rx_stackSize", &symoff);
3486     kread(kmem, symoff, (char *)&count, sizeof count);
3487     printf("\trx_stackSize = %d\n", count);
3488     findsym("rx_connDeadTime", &symoff);
3489     kread(kmem, symoff, (char *)&count, sizeof count);
3490
3491     printf("\trx_connDeadTime = %d\n", count);
3492     findsym("rx_idleConnectionTime", &symoff);
3493     kread(kmem, symoff, (char *)&count, sizeof count);
3494
3495     printf("\trx_idleConnectionTime = %d\n", count);
3496
3497     findsym("rx_idlePeerTime", &symoff);
3498     kread(kmem, symoff, (char *)&count, sizeof count);
3499     printf("\trx_idlePeerTime = %d\n", count);
3500
3501     findsym("rx_initSendWindow", &symoff);
3502     kread(kmem, symoff, (char *)&count, sizeof count);
3503     printf("\trx_initSendWindow = %d\n", count);
3504
3505     findsym("rxi_nSendFrags", &symoff);
3506     kread(kmem, symoff, (char *)&count, sizeof count);
3507     printf("\trxi_nSendFrags = %d\n", count);
3508
3509     findsym("rx_nPackets", &symoff);
3510     kread(kmem, symoff, (char *)&count, sizeof count);
3511
3512     printf("\trx_nPackets = %d\n", count);
3513     findsym("rx_nFreePackets", &symoff);
3514     kread(kmem, symoff, (char *)&count, sizeof count);
3515
3516     printf("\trx_nFreePackets = %d\n", count);
3517     findsym("rx_socket", &symoff);
3518     kread(kmem, symoff, (char *)&count, sizeof count);
3519
3520     printf("\trx_socket = 0x%x\n", count);
3521     findsym("rx_port", &symoff);
3522     kread(kmem, symoff, (char *)&sm, sizeof sm);
3523
3524     printf("\trx_Port = %d\n", sm);
3525     findsym("rx_packetQuota", &symoff);
3526     kread(kmem, symoff, (char *)ar, sizeof ar);
3527
3528     for (i = 0; i < RX_N_PACKET_CLASSES; i++)
3529         printf("\trx_packetQuota[%d] = %d\n", i, ar[i]);
3530     findsym("rx_nextCid", &symoff);
3531     kread(kmem, symoff, (char *)&count, sizeof count);
3532
3533     printf("\trx_nextCid = 0x%x\n", count);
3534     findsym("rx_epoch", &symoff);
3535     kread(kmem, symoff, (char *)&count, sizeof count);
3536
3537     printf("\trx_epoch = 0u%u\n", count);
3538     findsym("rx_waitingForPackets", &symoff);
3539     kread(kmem, symoff, (char *)&c, sizeof(c));
3540
3541     printf("\trx_waitingForPackets = %x\n", (int)c);
3542     findsym("rxi_nCalls", &symoff);
3543     kread(kmem, symoff, (char *)&count, sizeof count);
3544
3545     printf("\trxi_nCalls = %d\n", count);
3546     findsym("rxi_dataQuota", &symoff);
3547     kread(kmem, symoff, (char *)&count, sizeof count);
3548
3549     printf("\trxi_dataQuota = %d\n", count);
3550 #ifdef  AFS_AIX_ENV
3551     if (findsym("rxi_Alloccnt", &symoff)) {
3552         kread(kmem, symoff, (char *)&count, sizeof count);
3553         printf("\trxi_Alloccnt = %d\n", count);
3554     }
3555
3556     if (findsym("rxi_Allocsize", &symoff)) {
3557         kread(kmem, symoff, (char *)&count, sizeof count);
3558         printf("\trxi_Allocsize = %d\n", count);
3559     }
3560 #endif
3561     findsym("rxi_availProcs", &symoff);
3562     kread(kmem, symoff, (char *)&count, sizeof count);
3563
3564     printf("\trxi_availProcs = %d\n", count);
3565     findsym("rxi_totalMin", &symoff);
3566     kread(kmem, symoff, (char *)&count, sizeof count);
3567
3568     printf("\trxi_totalMin = %d\n", count);
3569     findsym("rxi_minDeficit", &symoff);
3570     kread(kmem, symoff, (char *)&count, sizeof count);
3571
3572     printf("\trxi_minDeficit = %d\n", count);
3573     print_services(kmem);
3574 #ifdef KDUMP_RX_LOCK
3575     if (use_rx_lock) {
3576         print_peertable_lock(kmem);
3577         print_conntable_lock(kmem);
3578         print_calltable_lock(kmem);
3579     } else {
3580         print_peertable(kmem);
3581         print_conntable(kmem);
3582         print_calltable(kmem);
3583     }
3584 #else
3585     print_peertable(kmem);
3586     print_conntable(kmem);
3587     print_calltable(kmem);
3588 #endif
3589     print_eventtable(kmem);
3590     print_rxstats(kmem);
3591 }
3592
3593
3594 void
3595 print_services(kmem)
3596      afs_int32 kmem;
3597 {
3598     off_t symoff;
3599     struct rx_service *rx_services[RX_MAX_SERVICES], se, *sentry = &se, *sep;
3600     char sysname[100];
3601     afs_int32 count, i, j;
3602
3603     findsym("rx_services", &symoff);
3604     kread(kmem, symoff, (char *)rx_services, RX_MAX_SERVICES * sizeof(long));
3605
3606     printf("\n\nPrinting all 'rx_services' structures...\n");
3607     for (i = 0, j = 0; i < RX_MAX_SERVICES; i++) {
3608         if (rx_services[i]) {
3609             j++;
3610             kread(kmem, (off_t) rx_services[i], (char *)sentry,
3611                   sizeof *sentry);
3612             kread(kmem, (off_t) sentry->serviceName, sysname,
3613                   (KDUMP_SIZE_T) 40);
3614             printf
3615                 ("\t%lx: serviceId=%d, port=%d, serviceName=%s, socket=0x%x\n",
3616                  rx_services[i], sentry->serviceId, sentry->servicePort,
3617                  sysname, sentry->socket);
3618             printf
3619                 ("\t\tnSecObj=%d, nReqRunning=%d, maxProcs=%d, minProcs=%d, connDeadTime=%d, idleDeadTime=%d\n",
3620                  sentry->nSecurityObjects, sentry->nRequestsRunning,
3621                  sentry->maxProcs, sentry->minProcs, sentry->connDeadTime,
3622                  sentry->idleDeadTime);
3623         }
3624     }
3625     printf("... found %d 'rx_services' entries in the table\n", j);
3626 }
3627
3628
3629 #ifdef KDUMP_RX_LOCK
3630 void
3631 print_peertable_lock(kmem)
3632      afs_int32 kmem;
3633 {
3634     off_t symoff;
3635     struct rx_peer_rx_lock *rx_peerTable[256], se, *sentry = &se, *sep;
3636     long count, i, j;
3637
3638     findsym("rx_peerHashTable", &symoff);
3639     kread(kmem, symoff, (char *)&count, sizeof(long));
3640     if (!count) {
3641         printf("No 'rx_peer' structures found.\n");
3642         return;
3643     }
3644
3645     kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3646     printf("\n\nPrinting all 'rx_peer' structures...\n");
3647     for (i = 0, j = 0; i < 256; i++) {
3648         for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3649             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3650             printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3651                    sentry->host);
3652             printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3653                    sentry->natMTU, sentry->maxMTU);
3654             printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3655                    sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3656                    sentry->timeout.usec, sentry->nSent, sentry->reSends);
3657             printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3658                    sentry->refCount, sentry->port, sentry->idleWhen);
3659             printf
3660                 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3661                  sentry->congestionQueue.prev, sentry->congestionQueue.next,
3662                  sentry->inPacketSkew, sentry->outPacketSkew);
3663             printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3664         }
3665     }
3666     printf("... found %d 'rx_peer' entries in the table\n", j);
3667 }
3668
3669 #endif /* KDUMP_RX_LOCK */
3670 void
3671 print_peertable(kmem)
3672      afs_int32 kmem;
3673 {
3674     off_t symoff;
3675     struct rx_peer *rx_peerTable[256], se, *sentry = &se, *sep;
3676     long count, i, j;
3677
3678     findsym("rx_peerHashTable", &symoff);
3679     kread(kmem, symoff, (char *)&count, sizeof(long));
3680
3681     kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3682     printf("\n\nPrinting all 'rx_peer' structures...\n");
3683     for (i = 0, j = 0; i < 256; i++) {
3684         for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3685             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3686             printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3687                    sentry->host);
3688             printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3689                    sentry->natMTU, sentry->maxMTU);
3690             printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3691                    sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3692                    sentry->timeout.usec, sentry->nSent, sentry->reSends);
3693             printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3694                    sentry->refCount, sentry->port, sentry->idleWhen);
3695             printf
3696                 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3697                  sentry->congestionQueue.prev, sentry->congestionQueue.next,
3698                  sentry->inPacketSkew, sentry->outPacketSkew);
3699 #ifdef RX_ENABLE_LOCKS
3700             printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3701 #endif /* RX_ENABLE_LOCKS */
3702         }
3703     }
3704     printf("... found %d 'rx_peer' entries in the table\n", j);
3705 }
3706
3707
3708 #ifdef KDUMP_RX_LOCK
3709 void
3710 print_conntable_lock(kmem)
3711      afs_int32 kmem;
3712 {
3713     off_t symoff;
3714     struct rx_connection_rx_lock *rx_connTable[256], se, *sentry = &se;
3715     struct rx_connection_rx_lock *sep;
3716     long count, i, j;
3717
3718     findsym("rx_connHashTable", &symoff);
3719     kread(kmem, symoff, (char *)&count, sizeof(long));
3720     if (!count) {
3721         printf("No 'rx_connection' structures found.\n");
3722         return;
3723     }
3724
3725     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3726     printf("\n\nPrinting all 'rx_connection' structures...\n");
3727     for (i = 0, j = 0; i < 256; i++) {
3728         for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3729             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3730             printf
3731                 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3732                  sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3733             printf("\t\tcall[%lx=%d, %lx=%d, %lx=%d, %lx=%d]\n", se.call[0],
3734                    se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3735                    se.callNumber[2], se.call[3], se.callNumber[3]);
3736             printf
3737                 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3738                  se.timeout, se.flags, se.type, se.serviceId, se.service,
3739                  se.refCount);
3740             printf
3741                 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3742                  se.serial, se.lastSerial, se.secondsUntilDead,
3743                  se.secondsUntilPing, se.securityIndex);
3744             printf
3745                 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3746                  se.error, se.securityObject, se.securityData,
3747                  se.securityHeaderSize, se.securityMaxTrailerSize);
3748             printf
3749                 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3750                  se.challengeEvent, se.lastSendTime, se.maxSerial,
3751                  se.hardDeadTime);
3752             if (se.flags & RX_CONN_MAKECALL_WAITING)
3753                 printf
3754                     ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3755             printf
3756                 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3757                  se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3758                  se.refCount);
3759         }
3760     }
3761     printf("... found %d 'rx_connection' entries in the table\n", j);
3762 }
3763 #endif /* KDUMP_RX_LOCK */
3764
3765 void
3766 print_conntable(kmem)
3767      afs_int32 kmem;
3768 {
3769     off_t symoff;
3770     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
3771     long count, i, j;
3772
3773     findsym("rx_connHashTable", &symoff);
3774     kread(kmem, symoff, (char *)&count, sizeof(long));
3775
3776     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3777     printf("\n\nPrinting all 'rx_connection' structures...\n");
3778     for (i = 0, j = 0; i < 256; i++) {
3779         for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3780             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3781             printf
3782                 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3783                  sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3784             printf("\t\tcall[%x=%d, %x=%d, %x=%d, %x=%d]\n", se.call[0],
3785                    se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3786                    se.callNumber[2], se.call[3], se.callNumber[3]);
3787             printf
3788                 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3789                  se.timeout, se.flags, se.type, se.serviceId, se.service,
3790                  se.refCount);
3791             printf
3792                 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3793                  se.serial, se.lastSerial, se.secondsUntilDead,
3794                  se.secondsUntilPing, se.securityIndex);
3795             printf
3796                 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3797                  se.error, se.securityObject, se.securityData,
3798                  se.securityHeaderSize, se.securityMaxTrailerSize);
3799             printf
3800                 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3801                  se.challengeEvent, se.lastSendTime, se.maxSerial,
3802                  se.hardDeadTime);
3803             if (se.flags & RX_CONN_MAKECALL_WAITING)
3804                 printf
3805                     ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3806 #ifdef RX_ENABLE_LOCKS
3807             printf
3808                 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3809                  se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3810                  se.refCount);
3811 #endif /* RX_ENABLE_LOCKS */
3812         }
3813     }
3814     printf("... found %d 'rx_connection' entries in the table\n", j);
3815 }
3816
3817
3818 #ifdef KDUMP_RX_LOCK
3819 void
3820 print_calltable_lock(kmem)
3821      afs_int32 kmem;
3822 {
3823     off_t symoff;
3824     struct rx_connection_rx_lock *rx_connTable[256], se;
3825     struct rx_connection_rx_lock *sentry = &se;
3826     struct rx_connection_rx_lock *sep;
3827     long count, i, j, k;
3828
3829     findsym("rx_connHashTable", &symoff);
3830     kread(kmem, symoff, (char *)&count, sizeof(long));
3831     if (!count) {
3832         printf("No 'rx_call' structures found.\n");
3833         return;
3834     }
3835
3836     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3837     printf("\n\nPrinting all active 'rx_call' structures...\n");
3838     for (i = 0, j = 0; i < 256; i++) {
3839         for (sep = rx_connTable[i]; sep; sep = se.next) {
3840             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3841             for (k = 0; k < RX_MAXCALLS; k++) {
3842                 struct rx_call_rx_lock ce, *centry = &ce;
3843                 struct rx_call_rx_lock *call = se.call[k];
3844                 if (call) {
3845                     j++;
3846                     kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
3847                     printf
3848                         ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
3849                          call, centry->conn, centry->queue_item_header.prev,
3850                          centry->queue_item_header.next, centry->tq.prev,
3851                          centry->tq.next, centry->rq.prev, centry->rq.next);
3852                     printf
3853                         ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
3854                          centry->curvec, centry->curpos, centry->nLeft,
3855                          centry->nFree, centry->currentPacket,
3856                          centry->callNumber);
3857                     printf
3858                         ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
3859                          centry->channel, centry->state, centry->mode,
3860                          centry->flags, centry->localStatus,
3861                          centry->remoteStatus);
3862                     printf
3863                         ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
3864                          centry->error, centry->timeout, centry->rnext,
3865                          centry->rprev, centry->rwind, centry->tfirst,
3866                          centry->tnext);
3867                     printf
3868                         ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
3869                          centry->twind, centry->resendEvent,
3870                          centry->timeoutEvent, centry->keepAliveEvent,
3871                          centry->delayedAckEvent);
3872                     printf
3873                         ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
3874                          centry->lastSendTime, centry->lastReceiveTime,
3875                          centry->lastAcked, centry->startTime,
3876                          centry->startWait);
3877                     if (centry->flags & RX_CALL_WAIT_PROC)
3878                         printf
3879                             ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
3880                     if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
3881                         printf
3882                             ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
3883                     if (centry->flags & RX_CALL_READER_WAIT)
3884                         printf
3885                             ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
3886                     if (centry->flags & RX_CALL_WAIT_PACKETS)
3887                         printf
3888                             ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
3889                     printf
3890                         ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
3891                          centry->lock, centry->cv_twind, centry->cv_rq,
3892                          centry->refCount);
3893                     printf("\t\t: MTU=%d\n", centry->MTU);
3894                 }
3895             }
3896         }
3897     }
3898     printf("... found %d 'rx_call' entries in the table\n", j);
3899 }
3900 #endif /* KDUMP_RX_LOCK */
3901
3902 void
3903 print_calltable(kmem)
3904      afs_int32 kmem;
3905 {
3906     off_t symoff;
3907     struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
3908     long count, i, j, k;
3909
3910     findsym("rx_connHashTable", &symoff);
3911     kread(kmem, symoff, (char *)&count, sizeof(long));
3912
3913     kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3914     printf("\n\nPrinting all active 'rx_call' structures...\n");
3915     for (i = 0, j = 0; i < 256; i++) {
3916         for (sep = rx_connTable[i]; sep; sep = se.next) {
3917             kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3918             for (k = 0; k < RX_MAXCALLS; k++) {
3919                 struct rx_call ce, *centry = &ce, *call = se.call[k];
3920                 if (call) {
3921                     j++;
3922                     kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
3923                     printf
3924                         ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
3925                          call, centry->conn, centry->queue_item_header.prev,
3926                          centry->queue_item_header.next, centry->tq.prev,
3927                          centry->tq.next, centry->rq.prev, centry->rq.next);
3928                     printf
3929                         ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
3930                          centry->curvec, centry->curpos, centry->nLeft,
3931                          centry->nFree, centry->currentPacket,
3932                          centry->callNumber);
3933                     printf
3934                         ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
3935                          centry->channel, centry->state, centry->mode,
3936                          centry->flags, centry->localStatus,
3937                          centry->remoteStatus);
3938                     printf
3939                         ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
3940                          centry->error, centry->timeout, centry->rnext,
3941                          centry->rprev, centry->rwind, centry->tfirst,
3942                          centry->tnext);
3943                     printf
3944                         ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
3945                          centry->twind, centry->resendEvent,
3946                          centry->timeoutEvent, centry->keepAliveEvent,
3947                          centry->delayedAckEvent);
3948                     printf
3949                         ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
3950                          centry->lastSendTime, centry->lastReceiveTime,
3951                          centry->lastAcked, centry->startTime,
3952                          centry->startWait);
3953                     if (centry->flags & RX_CALL_WAIT_PROC)
3954                         printf
3955                             ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
3956                     if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
3957                         printf
3958                             ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
3959                     if (centry->flags & RX_CALL_READER_WAIT)
3960                         printf
3961                             ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
3962                     if (centry->flags & RX_CALL_WAIT_PACKETS)
3963                         printf
3964                             ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
3965 #ifdef RX_ENABLE_LOCKS
3966                     printf
3967                         ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
3968                          centry->lock, centry->cv_twind, centry->cv_rq,
3969                          centry->refCount);
3970 #endif /* RX_ENABLE_LOCKS */
3971                     printf("\t\t: MTU=%d\n", centry->MTU);
3972                 }
3973             }
3974         }
3975     }
3976     printf("... found %d 'rx_call' entries in the table\n", j);
3977 }
3978
3979 void
3980 print_eventtable(kmem)
3981      afs_int32 kmem;
3982 {
3983     off_t symoff;
3984     struct rx_queue epq;
3985     struct rx_queue evq;
3986     char *epend, *evend;
3987     afs_int32 count, i, j = 0, k = 0;
3988
3989 #if ! defined(AFS_HPUX_ENV) && ! defined(AFS_AIX_ENV)
3990     findsym("rxevent_nFree", &symoff);
3991     kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
3992     printf("\n\n\trxevent_nFree = %d\n", count);
3993
3994     findsym("rxevent_nPosted", &symoff);
3995     kread(kmem, symoff, (char *)&count, sizeof(afs_int32));
3996     printf("\trxevent_nPosted = %d\n", count);
3997 #endif
3998 }
3999
4000 /*
4001  * print_upDownStats
4002  *
4003  * Print the up/downtime stats for the given class of server records
4004  * provided.
4005  */
4006 void
4007 print_upDownStats(a_upDownP)
4008      struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */
4009
4010 {                               /*print_upDownStats */
4011
4012     /*
4013      * First, print the simple values.
4014      */
4015     printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
4016     printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
4017     printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
4018     printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
4019     printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
4020     printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
4021     printf("\t\t%10d numDowntimeIncidents\n",
4022            a_upDownP->numDowntimeIncidents);
4023     printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
4024     printf("\t\t%10d maxDowntimesInARecord\n",
4025            a_upDownP->maxDowntimesInARecord);
4026     printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
4027     printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
4028     printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
4029
4030     /*
4031      * Now, print the array values.
4032      */
4033     printf("\t\tDowntime duration distribution:\n");
4034     printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
4035     printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
4036     printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
4037     printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
4038     printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
4039     printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
4040     printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
4041
4042     printf("\t\tDowntime incident distribution:\n");
4043     printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
4044     printf("\t\t\t%8d: 1 time\n", a_upDownP->downDurations[1]);
4045     printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downDurations[2]);
4046     printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downDurations[3]);
4047     printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downDurations[4]);
4048     printf("\t\t\t%8d: > 50 times\n", a_upDownP->downDurations[5]);
4049 }                               /*print_upDownStats */
4050
4051
4052 void
4053 print_cmperfstats(perfP)
4054      struct afs_stats_CMPerf *perfP;
4055 {
4056     struct afs_stats_SrvUpDownInfo *upDownP;    /*Ptr to server up/down info */
4057
4058     printf("\t%10d numPerfCalls\n", perfP->numPerfCalls);
4059     printf("\t%10d epoch\n", perfP->epoch);
4060     printf("\t%10d numCellsVisible\n", perfP->numCellsVisible);
4061     printf("\t%10d numCellsContacted\n", perfP->numCellsContacted);
4062     printf("\t%10d dlocalAccesses\n", perfP->dlocalAccesses);
4063     printf("\t%10d vlocalAccesses\n", perfP->vlocalAccesses);
4064     printf("\t%10d dremoteAccesses\n", perfP->dremoteAccesses);
4065     printf("\t%10d vremoteAccesses\n", perfP->vremoteAccesses);
4066     printf("\t%10d cacheNumEntries\n", perfP->cacheNumEntries);
4067     printf("\t%10d cacheBlocksTotal\n", perfP->cacheBlocksTotal);
4068     printf("\t%10d cacheBlocksInUse\n", perfP->cacheBlocksInUse);
4069     printf("\t%10d cacheBlocksOrig\n", perfP->cacheBlocksOrig);
4070     printf("\t%10d cacheMaxDirtyChunks\n", perfP->cacheMaxDirtyChunks);
4071     printf("\t%10d cacheCurrDirtyChunks\n", perfP->cacheCurrDirtyChunks);
4072     printf("\t%10d dcacheHits\n", perfP->dcacheHits);
4073     printf("\t%10d vcacheHits\n", perfP->vcacheHits);
4074     printf("\t%10d dcacheMisses\n", perfP->dcacheMisses);
4075     printf("\t%10d vcacheMisses\n", perfP->vcacheMisses);
4076     printf("\t%10d cacheFlushes\n", perfP->cacheFlushes);
4077     printf("\t%10d cacheFilesReused\n", perfP->cacheFilesReused);
4078     printf("\t%10d vcacheXAllocs\n", perfP->vcacheXAllocs);
4079     printf("\t%10d dcacheXAllocs\n", perfP->dcacheXAllocs);
4080
4081     printf("\t%10d bufAlloced\n", perfP->bufAlloced);
4082     printf("\t%10d bufHits\n", perfP->bufHits);
4083     printf("\t%10d bufMisses\n", perfP->bufMisses);
4084     printf("\t%10d bufFlushDirty\n", perfP->bufFlushDirty);
4085
4086     printf("\t%10d LargeBlocksActive\n", perfP->LargeBlocksActive);
4087     printf("\t%10d LargeBlocksAlloced\n", perfP->LargeBlocksAlloced);
4088     printf("\t%10d SmallBlocksActive\n", perfP->SmallBlocksActive);
4089     printf("\t%10d SmallBlocksAlloced\n", perfP->SmallBlocksAlloced);
4090     printf("\t%10d MediumBlocksActive\n", perfP->MediumBlocksActive);
4091     printf("\t%10d MediumBlocksAlloced\n", perfP->MediumBlocksAlloced);
4092     printf("\t%10d OutStandingMemUsage\n", perfP->OutStandingMemUsage);
4093     printf("\t%10d OutStandingAllocs\n", perfP->OutStandingAllocs);
4094     printf("\t%10d CallBackAlloced\n", perfP->CallBackAlloced);
4095     printf("\t%10d CallBackFlushes\n", perfP->CallBackFlushes);
4096     printf("\t%10d CallBackLoops\n", perfP->cbloops);
4097
4098     printf("\t%10d srvRecords\n", perfP->srvRecords);
4099     printf("\t%10d srvNumBuckets\n", perfP->srvNumBuckets);
4100     printf("\t%10d srvMaxChainLength\n", perfP->srvMaxChainLength);
4101     printf("\t%10d srvRecordsHWM\n", perfP->srvRecordsHWM);
4102     printf("\t%10d srvMaxChainLengthHWM\n", perfP->srvMaxChainLengthHWM);
4103
4104     printf("\t%10d sysName_ID\n", perfP->sysName_ID);
4105     printf("\t%10d osi_Read_EFAULTS\n", perfP->osiread_efaults);
4106
4107     printf("\tFile Server up/downtimes, same cell:\n");
4108     print_upDownStats(&(perfP->fs_UpDown[0]));
4109
4110     printf("\tFile Server up/downtimes, diff cell:\n");
4111     print_upDownStats(&(perfP->fs_UpDown[1]));
4112
4113     printf("\tVL Server up/downtimes, same cell:\n");
4114     print_upDownStats(&(perfP->vl_UpDown[0]));
4115
4116     printf("\tVL Server up/downtimes, diff cell:\n");
4117     print_upDownStats(&(perfP->vl_UpDown[1]));
4118 }
4119
4120
4121 void
4122 print_cmstats(cmp)
4123      struct afs_CMStats *cmp;
4124 {
4125     printf("\t%10d afs_init\n", cmp->callInfo.C_afs_init);
4126     printf("\t%10d gop_rdwr\n", cmp->callInfo.C_gop_rdwr);
4127     printf("\t%10d aix_gnode_rele\n", cmp->callInfo.C_aix_gnode_rele);
4128     printf("\t%10d gettimeofday\n", cmp->callInfo.C_gettimeofday);
4129     printf("\t%10d m_cpytoc\n", cmp->callInfo.C_m_cpytoc);
4130     printf("\t%10d aix_vattr_null\n", cmp->callInfo.C_aix_vattr_null);
4131     printf("\t%10d afs_gn_frunc\n", cmp->callInfo.C_afs_gn_ftrunc);
4132     printf("\t%10d afs_gn_rdwr\n", cmp->callInfo.C_afs_gn_rdwr);
4133     printf("\t%10d afs_gn_ioctl\n", cmp->callInfo.C_afs_gn_ioctl);
4134     printf("\t%10d afs_gn_locktl\n", cmp->callInfo.C_afs_gn_lockctl);
4135     printf("\t%10d afs_gn_readlink\n", cmp->callInfo.C_afs_gn_readlink);
4136     printf("\t%10d afs_gn_readdir\n", cmp->callInfo.C_afs_gn_readdir);
4137     printf("\t%10d afs_gn_select\n", cmp->callInfo.C_afs_gn_select);
4138     printf("\t%10d afs_gn_strategy\n", cmp->callInfo.C_afs_gn_strategy);
4139     printf("\t%10d afs_gn_symlink\n", cmp->callInfo.C_afs_gn_symlink);
4140     printf("\t%10d afs_gn_revoke\n", cmp->callInfo.C_afs_gn_revoke);
4141     printf("\t%10d afs_gn_link\n", cmp->callInfo.C_afs_gn_link);
4142     printf("\t%10d afs_gn_mkdir\n", cmp->callInfo.C_afs_gn_mkdir);
4143     printf("\t%10d afs_gn_mknod\n", cmp->callInfo.C_afs_gn_mknod);
4144     printf("\t%10d afs_gn_remove\n", cmp->callInfo.C_afs_gn_remove);
4145     printf("\t%10d afs_gn_rename\n", cmp->callInfo.C_afs_gn_rename);
4146     printf("\t%10d afs_gn_rmdir\n", cmp->callInfo.C_afs_gn_rmdir);
4147     printf("\t%10d afs_gn_fid\n", cmp->callInfo.C_afs_gn_fid);
4148     printf("\t%10d afs_gn_lookup\n", cmp->callInfo.C_afs_gn_lookup);
4149     printf("\t%10d afs_gn_open\n", cmp->callInfo.C_afs_gn_open);
4150     printf("\t%10d afs_gn_create\n", cmp->callInfo.C_afs_gn_create);
4151     printf("\t%10d afs_gn_hold\n", cmp->callInfo.C_afs_gn_hold);
4152     printf("\t%10d afs_gn_rele\n", cmp->callInfo.C_afs_gn_rele);
4153     printf("\t%10d afs_gn_unmap\n", cmp->callInfo.C_afs_gn_unmap);
4154     printf("\t%10d afs_gn_access\n", cmp->callInfo.C_afs_gn_access);
4155     printf("\t%10d afs_gn_getattr\n", cmp->callInfo.C_afs_gn_getattr);
4156     printf("\t%10d afs_gn_setattr\n", cmp->callInfo.C_afs_gn_setattr);
4157     printf("\t%10d afs_gn_fclear\n", cmp->callInfo.C_afs_gn_fclear);
4158     printf("\t%10d afs_gn_fsync\n", cmp->callInfo.C_afs_gn_fsync);
4159     printf("\t%10d phash\n", cmp->callInfo.C_pHash);
4160     printf("\t%10d DInit\n", cmp->callInfo.C_DInit);
4161     printf("\t%10d DRead\n", cmp->callInfo.C_DRead);
4162     printf("\t%10d FixupBucket\n", cmp->callInfo.C_FixupBucket);
4163     printf("\t%10d afs_newslot\n", cmp->callInfo.C_afs_newslot);
4164     printf("\t%10d DRelease\n", cmp->callInfo.C_DRelease);
4165     printf("\t%10d DFlush\n", cmp->callInfo.C_DFlush);
4166     printf("\t%10d DFlushEntry\n", cmp->callInfo.C_DFlushEntry);
4167     printf("\t%10d DVOffset\n", cmp->callInfo.C_DVOffset);
4168     printf("\t%10d DZap\n", cmp->callInfo.C_DZap);
4169     printf("\t%10d DNew\n", cmp->callInfo.C_DNew);
4170     printf("\t%10d afs_RemoveVCB\n", cmp->callInfo.C_afs_RemoveVCB);
4171     printf("\t%10d afs_NewVCache\n", cmp->callInfo.C_afs_NewVCache);
4172     printf("\t%10d afs_FlushActiveVcaches\n",
4173            cmp->callInfo.C_afs_FlushActiveVcaches);
4174     printf("\t%10d afs_VerifyVCache\n", cmp->callInfo.C_afs_VerifyVCache);
4175     printf("\t%10d afs_WriteVCache\n", cmp->callInfo.C_afs_WriteVCache);
4176     printf("\t%10d afs_GetVCache\n", cmp->callInfo.C_afs_GetVCache);
4177     printf("\t%10d afs_StuffVcache\n", cmp->callInfo.C_afs_StuffVcache);
4178     printf("\t%10d afs_FindVCache\n", cmp->callInfo.C_afs_FindVCache);
4179     printf("\t%10d afs_PutDCache\n", cmp->callInfo.C_afs_PutDCache);
4180     printf("\t%10d afs_PutVCache\n", cmp->callInfo.C_afs_PutVCache);
4181     printf("\t%10d CacheStoreProc\n", cmp->callInfo.C_CacheStoreProc);
4182     printf("\t%10d afs_FindDcache\n", cmp->callInfo.C_afs_FindDCache);
4183     printf("\t%10d afs_TryToSmush\n", cmp->callInfo.C_afs_TryToSmush);
4184     printf("\t%10d afs_AdjustSize\n", cmp->callInfo.C_afs_AdjustSize);
4185     printf("\t%10d afs_CheckSize\n", cmp->callInfo.C_afs_CheckSize);
4186     printf("\t%10d afs_StoreWarn\n", cmp->callInfo.C_afs_StoreWarn);
4187     printf("\t%10d CacheFetchProc\n", cmp->callInfo.C_CacheFetchProc);
4188     printf("\t%10d UFS_CacheStoreProc\n", cmp->callInfo.C_UFS_CacheStoreProc);
4189     printf("\t%10d UFS_CacheFetchProc\n", cmp->callInfo.C_UFS_CacheFetchProc);
4190     printf("\t%10d afs_GetDCache\n", cmp->callInfo.C_afs_GetDCache);
4191     printf("\t%10d afs_SimpleVStat\n", cmp->callInfo.C_afs_SimpleVStat);
4192     printf("\t%10d afs_ProcessFS\n", cmp->callInfo.C_afs_ProcessFS);
4193     printf("\t%10d afs_InitCacheInfo\n", cmp->callInfo.C_afs_InitCacheInfo);
4194     printf("\t%10d afs_InitVolumeInfo\n", cmp->callInfo.C_afs_InitVolumeInfo);
4195     printf("\t%10d afs_InitCacheFile\n", cmp->callInfo.C_afs_InitCacheFile);
4196     printf("\t%10d afs_CacheInit\n", cmp->callInfo.C_afs_CacheInit);
4197     printf("\t%10d afs_GetDSlot\n", cmp->callInfo.C_afs_GetDSlot);
4198     printf("\t%10d afs_WriteThroughDSlots\n",
4199            cmp->callInfo.C_afs_WriteThroughDSlots);
4200     printf("\t%10d afs_MemGetDSlot\n", cmp->callInfo.C_afs_MemGetDSlot);
4201     printf("\t%10d afs_UFSGetDSlot\n", cmp->callInfo.C_afs_UFSGetDSlot);
4202     printf("\t%10d afs_StoreDCache\n", cmp->callInfo.C_afs_StoreDCache);
4203     printf("\t%10d afs_StoreMini\n", cmp->callInfo.C_afs_StoreMini);
4204     printf("\t%10d afs_StoreAllSegments\n",
4205            cmp->callInfo.C_afs_StoreAllSegments);
4206     printf("\t%10d afs_InvalidateAllSegments\n",
4207            cmp->callInfo.C_afs_InvalidateAllSegments);
4208     printf("\t%10d afs_TruncateAllSegments\n",
4209            cmp->callInfo.C_afs_TruncateAllSegments);
4210     printf("\t%10d afs_CheckVolSync\n", cmp->callInfo.C_afs_CheckVolSync);
4211     printf("\t%10d afs_wakeup\n", cmp->callInfo.C_afs_wakeup);
4212     printf("\t%10d afs_CFileOpen\n", cmp->callInfo.C_afs_CFileOpen);
4213     printf("\t%10d afs_CFileTruncate\n", cmp->callInfo.C_afs_CFileTruncate);
4214     printf("\t%10d afs_GetDownD\n", cmp->callInfo.C_afs_GetDownD);
4215     printf("\t%10d afs_WriteDCache\n", cmp->callInfo.C_afs_WriteDCache);
4216     printf("\t%10d afs_FlushDCache\n", cmp->callInfo.C_afs_FlushDCache);
4217     printf("\t%10d afs_GetDownDSlot\n", cmp->callInfo.C_afs_GetDownDSlot);
4218     printf("\t%10d afs_FlushVCache\n", cmp->callInfo.C_afs_FlushVCache);
4219     printf("\t%10d afs_GetDownV\n", cmp->callInfo.C_afs_GetDownV);
4220     printf("\t%10d afs_QueueVCB\n", cmp->callInfo.C_afs_QueueVCB);
4221     printf("\t%10d afs_call\n", cmp->callInfo.C_afs_call);
4222     printf("\t%10d afs_syscall_call\n", cmp->callInfo.C_afs_syscall_call);
4223     printf("\t%10d afs_syscall_icreate\n",
4224            cmp->callInfo.C_afs_syscall_icreate);
4225     printf("\t%10d afs_syscall_iopen\n", cmp->callInfo.C_afs_syscall_iopen);
4226     printf("\t%10d afs_syscall_iincdec\n",
4227            cmp->callInfo.C_afs_syscall_iincdec);
4228     printf("\t%10d afs_syscall_ireadwrite\n",
4229            cmp->callInfo.C_afs_syscall_ireadwrite);
4230     printf("\t%10d afs_syscall\n", cmp->callInfo.C_afs_syscall);
4231     printf("\t%10d lpioctl\n", cmp->callInfo.C_lpioctl);
4232     printf("\t%10d lsetpag\n", cmp->callInfo.C_lsetpag);
4233     printf("\t%10d afs_CheckInit\n", cmp->callInfo.C_afs_CheckInit);
4234     printf("\t%10d ClearCallback\n", cmp->callInfo.C_ClearCallBack);
4235     printf("\t%10d SRXAFSCB_GetCE\n", cmp->callInfo.C_SRXAFSCB_GetCE);
4236     printf("\t%10d SRXAFSCB_GetLock\n", cmp->callInfo.C_SRXAFSCB_GetLock);
4237     printf("\t%10d SRXAFSCB_CallBack\n", cmp->callInfo.C_SRXAFSCB_CallBack);
4238     printf("\t%10d SRXAFSCB_InitCallBackState\n",
4239            cmp->callInfo.C_SRXAFSCB_InitCallBackState);
4240     printf("\t%10d SRXAFSCB_Probe\n", cmp->callInfo.C_SRXAFSCB_Probe);
4241     printf("\t%10d afs_Chunk\n", cmp->callInfo.C_afs_Chunk);
4242     printf("\t%10d afs_ChunkBase\n", cmp->callInfo.C_afs_ChunkBase);
4243     printf("\t%10d afs_ChunkOffset\n", cmp->callInfo.C_afs_ChunkOffset);
4244     printf("\t%10d afs_ChunkSize\n", cmp->callInfo.C_afs_ChunkSize);
4245     printf("\t%10d afs_ChunkToBase\n", cmp->callInfo.C_afs_ChunkToBase);
4246     printf("\t%10d afs_ChunkToSize\n", cmp->callInfo.C_afs_ChunkToSize);
4247     printf("\t%10d afs_SetChunkSize\n", cmp->callInfo.C_afs_SetChunkSize);
4248     printf("\t%10d afs_config\n", cmp->callInfo.C_afs_config);
4249     printf("\t%10d mem_freebytes\n", cmp->callInfo.C_mem_freebytes);
4250     printf("\t%10d mem_getbytes\n", cmp->callInfo.C_mem_getbytes);
4251     printf("\t%10d afs_Daemon\n", cmp->callInfo.C_afs_Daemon);
4252     printf("\t%10d afs_CheckRootVolume\n",
4253            cmp->callInfo.C_afs_CheckRootVolume);
4254     printf("\t%10d BPath\n", cmp->callInfo.C_BPath);
4255     printf("\t%10d BPrefetch\n", cmp->callInfo.C_BPrefetch);
4256     printf("\t%10d BStore\n", cmp->callInfo.C_BStore);
4257     printf("\t%10d afs_BBusy\n", cmp->callInfo.C_afs_BBusy);
4258     printf("\t%10d afs_BQueue\n", cmp->callInfo.C_afs_BQueue);
4259     printf("\t%10d afs_BRelease\n", cmp->callInfo.C_afs_BRelease);
4260     printf("\t%10d afs_BackgroundDaemon\n",
4261            cmp->callInfo.C_afs_BackgroundDaemon);
4262     printf("\t%10d exporter_add\n", cmp->callInfo.C_exporter_add);
4263     printf("\t%10d exporter_find\n", cmp->callInfo.C_exporter_find);
4264     printf("\t%10d afs_gfs_kalloc\n", cmp->callInfo.C_afs_gfs_kalloc);
4265     printf("\t%10d afs_gfs_kfree\n", cmp->callInfo.C_afs_gfs_kfree);
4266     printf("\t%10d gop_lookupname\n", cmp->callInfo.C_gop_lookupname);
4267     printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
4268     printf("\t%10d gfs_vattr_null\n", cmp->callInfo.C_gfs_vattr_null);
4269     printf("\t%10d afs_lock\n", cmp->callInfo.C_afs_lock);
4270     printf("\t%10d afs_unlock\n", cmp->callInfo.C_afs_unlock);
4271     printf("\t%10d afs_update\n", cmp->callInfo.C_afs_update);
4272     printf("\t%10d afs_gclose\n", cmp->callInfo.C_afs_gclose);
4273     printf("\t%10d afs_gopen\n", cmp->callInfo.C_afs_gopen);
4274     printf("\t%10d afs_greadlink\n", cmp->callInfo.C_afs_greadlink);
4275     printf("\t%10d afs_select\n", cmp->callInfo.C_afs_select);
4276     printf("\t%10d afs_gbmap\n", cmp->callInfo.C_afs_gbmap);
4277     printf("\t%10d afs_getfsdata\n", cmp->callInfo.C_afs_getfsdata);
4278     printf("\t%10d afs_gsymlink\n", cmp->callInfo.C_afs_gsymlink);
4279     printf("\t%10d afs_namei\n", cmp->callInfo.C_afs_namei);
4280     printf("\t%10d afs_gmount\n", cmp->callInfo.C_afs_gmount);
4281     printf("\t%10d afs_gget\n", cmp->callInfo.C_afs_gget);
4282     printf("\t%10d afs_glink\n", cmp->callInfo.C_afs_glink);
4283     printf("\t%10d afs_gmkdir\n", cmp->callInfo.C_afs_gmkdir);
4284     printf("\t%10d afs_unlink\n", cmp->callInfo.C_afs_unlink);
4285     printf("\t%10d afs_grmdir\n", cmp->callInfo.C_afs_grmdir);
4286     printf("\t%10d afs_makenode\n", cmp->callInfo.C_afs_makenode);
4287     printf("\t%10d afs_grename\n", cmp->callInfo.C_afs_grename);
4288     printf("\t%10d afs_rele\n", cmp->callInfo.C_afs_rele);
4289     printf("\t%10d afs_syncgp\n", cmp->callInfo.C_afs_syncgp);
4290     printf("\t%10d afs_getval\n", cmp->callInfo.C_afs_getval);
4291     printf("\t%10d afs_trunc\n", cmp->callInfo.C_afs_trunc);
4292     printf("\t%10d afs_rwgp\n", cmp->callInfo.C_afs_rwgp);
4293     printf("\t%10d afs_stat\n", cmp->callInfo.C_afs_stat);
4294     printf("\t%10d afsc_link\n", cmp->callInfo.C_afsc_link);
4295     printf("\t%10d afs_vfs_mount\n", cmp->callInfo.C_afs_vfs_mount);
4296     printf("\t%10d afs_uniqtime\n", cmp->callInfo.C_afs_uniqtime);
4297     printf("\t%10d iopen\n", cmp->callInfo.C_iopen);
4298     printf("\t%10d idec\n", cmp->callInfo.C_idec);
4299     printf("\t%10d iinc\n", cmp->callInfo.C_iinc);
4300     printf("\t%10d ireadwrite\n", cmp->callInfo.C_ireadwrite);
4301     printf("\t%10d iread\n", cmp->callInfo.C_iread);
4302     printf("\t%10d iwrite\n", cmp->callInfo.C_iwrite);
4303     printf("\t%10d iforget\n", cmp->callInfo.C_iforget);
4304     printf("\t%10d icreate\n", cmp->callInfo.C_icreate);
4305     printf("\t%10d igetinode\n", cmp->callInfo.C_igetinode);
4306     printf("\t%10d osi_SleepR\n", cmp->callInfo.C_osi_SleepR);
4307     printf("\t%10d osi_SleepS\n", cmp->callInfo.C_osi_SleepS);
4308     printf("\t%10d osi_SleepW\n", cmp->callInfo.C_osi_SleepW);
4309     printf("\t%10d osi_Sleep\n", cmp->callInfo.C_osi_Sleep);
4310     printf("\t%10d afs_LookupMCE\n", cmp->callInfo.C_afs_LookupMCE);
4311     printf("\t%10d afs_MemReadBlk\n", cmp->callInfo.C_afs_MemReadBlk);
4312     printf("\t%10d afs_MemReadUIO\n", cmp->callInfo.C_afs_MemReadUIO);
4313     printf("\t%10d afs_MemWriteBlk\n", cmp->callInfo.C_afs_MemWriteBlk);
4314     printf("\t%10d afs_MemWriteUIO\n", cmp->callInfo.C_afs_MemWriteUIO);
4315     printf("\t%10d afs_MemCacheStoreProc\n",
4316            cmp->callInfo.C_afs_MemCacheStoreProc);
4317     printf("\t%10d afs_MemCacheFetchProc\n",
4318            cmp->callInfo.C_afs_MemCacheFetchProc);
4319     printf("\t%10d afs_MemCacheTruncate\n",
4320            cmp->callInfo.C_afs_MemCacheTruncate);
4321     printf("\t%10d afs_MemCacheStoreProc\n",
4322            cmp->callInfo.C_afs_MemCacheStoreProc);
4323     printf("\t%10d afs_GetNfsClientPag\n",
4324            cmp->callInfo.C_afs_GetNfsClientPag);
4325     printf("\t%10d afs_FindNfsClientPag\n",
4326            cmp->callInfo.C_afs_FindNfsClientPag);
4327     printf("\t%10d afs_PutNfsClientPag\n",
4328            cmp->callInfo.C_afs_PutNfsClientPag);
4329     printf("\t%10d afs_nfsclient_reqhandler\n",
4330            cmp->callInfo.C_afs_nfsclient_reqhandler);
4331     printf("\t%10d afs_nfsclient_GC\n", cmp->callInfo.C_afs_nfsclient_GC);
4332     printf("\t%10d afs_nfsclient_hold\n", cmp->callInfo.C_afs_nfsclient_hold);
4333     printf("\t%10d afs_nfsclient_stats\n",
4334            cmp->callInfo.C_afs_nfsclient_stats);
4335     printf("\t%10d afs_nfsclient_sysname\n",
4336            cmp->callInfo.C_afs_nfsclient_sysname);
4337     printf("\t%10d afs_rfs_dispatch\n", cmp->callInfo.C_afs_rfs_dispatch);
4338     printf("\t%10d afs_nfs2afscall\n", cmp->callInfo.C_Nfs2AfsCall);
4339     printf("\t%10d afs_sun_xuntext\n", cmp->callInfo.C_afs_sun_xuntext);
4340     printf("\t%10d osi_Active\n", cmp->callInfo.C_osi_Active);
4341     printf("\t%10d osi_FlushPages\n", cmp->callInfo.C_osi_FlushPages);
4342     printf("\t%10d osi_FlushText\n", cmp->callInfo.C_osi_FlushText);
4343     printf("\t%10d osi_CallProc\n", cmp->callInfo.C_osi_CallProc);
4344     printf("\t%10d osi_CancelProc\n", cmp->callInfo.C_osi_CancelProc);
4345     printf("\t%10d osi_Invisible\n", cmp->callInfo.C_osi_Invisible);
4346     printf("\t%10d osi_Time\n", cmp->callInfo.C_osi_Time);
4347     printf("\t%10d osi_Alloc\n", cmp->callInfo.C_osi_Alloc);
4348     printf("\t%10d osi_SetTime\n", cmp->callInfo.C_osi_SetTime);
4349     printf("\t%10d osi_Dump\n", cmp->callInfo.C_osi_Dump);
4350     printf("\t%10d osi_Free\n", cmp->callInfo.C_osi_Free);
4351     printf("\t%10d osi_UFSOpen\n", cmp->callInfo.C_osi_UFSOpen);
4352     printf("\t%10d osi_Close\n", cmp->callInfo.C_osi_Close);
4353     printf("\t%10d osi_Stat\n", cmp->callInfo.C_osi_Stat);
4354     printf("\t%10d osi_Truncate\n", cmp->callInfo.C_osi_Truncate);
4355     printf("\t%10d osi_Read\n", cmp->callInfo.C_osi_Read);
4356     printf("\t%10d osi_Write\n", cmp->callInfo.C_osi_Write);
4357     printf("\t%10d osi_MapStrategy\n", cmp->callInfo.C_osi_MapStrategy);
4358     printf("\t%10d osi_AllocLargeSpace\n",
4359            cmp->callInfo.C_osi_AllocLargeSpace);
4360     printf("\t%10d osi_FreeLargeSpace\n", cmp->callInfo.C_osi_FreeLargeSpace);
4361     printf("\t%10d osi_AllocSmallSpace\n",
4362            cmp->callInfo.C_osi_AllocSmallSpace);
4363     printf("\t%10d osi_FreeSmallSpace\n", cmp->callInfo.C_osi_FreeSmallSpace);
4364     printf("\t%10d osi_CloseToTheEdge\n", cmp->callInfo.C_osi_CloseToTheEdge);
4365     printf("\t%10d osi_xgreedy\n", cmp->callInfo.C_osi_xgreedy);
4366     printf("\t%10d osi_FreeSocket\n", cmp->callInfo.C_osi_FreeSocket);
4367     printf("\t%10d osi_NewSocket\n", cmp->callInfo.C_osi_NewSocket);
4368     printf("\t%10d osi_NetSend\n", cmp->callInfo.C_osi_NetSend);
4369     printf("\t%10d WaitHack\n", cmp->callInfo.C_WaitHack);
4370     printf("\t%10d osi_CancelWait\n", cmp->callInfo.C_osi_CancelWait);
4371     printf("\t%10d osi_Wakeup\n", cmp->callInfo.C_osi_Wakeup);
4372     printf("\t%10d osi_Wait\n", cmp->callInfo.C_osi_Wait);
4373     printf("\t%10d dirp_Read\n", cmp->callInfo.C_dirp_Read);
4374     printf("\t%10d dirp_Cpy\n", cmp->callInfo.C_dirp_Cpy);
4375     printf("\t%10d dirp_Eq\n", cmp->callInfo.C_dirp_Eq);
4376     printf("\t%10d dirp_Write\n", cmp->callInfo.C_dirp_Write);
4377     printf("\t%10d dirp_Zap\n", cmp->callInfo.C_dirp_Zap);
4378     printf("\t%10d afs_ioctl\n", cmp->callInfo.C_afs_ioctl);
4379     printf("\t%10d handleIoctl\n", cmp->callInfo.C_HandleIoctl);
4380     printf("\t%10d afs_xioctl\n", cmp->callInfo.C_afs_xioctl);
4381     printf("\t%10d afs_pioctl\n", cmp->callInfo.C_afs_pioctl);
4382     printf("\t%10d HandlePioctl\n", cmp->callInfo.C_HandlePioctl);
4383     printf("\t%10d PGetVolumeStatus\n", cmp->callInfo.C_PGetVolumeStatus);
4384     printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
4385     printf("\t%10d PFlush\n", cmp->callInfo.C_PFlush);
4386     printf("\t%10d PFlushVolumeData\n", cmp->callInfo.C_PFlushVolumeData);
4387     printf("\t%10d PNewStatMount\n", cmp->callInfo.C_PNewStatMount);
4388     printf("\t%10d PGetTokens\n", cmp->callInfo.C_PGetTokens);
4389     printf("\t%10d PSetTokens\n", cmp->callInfo.C_PSetTokens);
4390     printf("\t%10d PUnlog\n", cmp->callInfo.C_PUnlog);
4391     printf("\t%10d PCheckServers\n", cmp->callInfo.C_PCheckServers);
4392     printf("\t%10d PCheckAuth\n", cmp->callInfo.C_PCheckAuth);
4393     printf("\t%10d PCheckVolNames\n", cmp->callInfo.C_PCheckVolNames);
4394     printf("\t%10d PFindVolume\n", cmp->callInfo.C_PFindVolume);
4395     printf("\t%10d Prefetch\n", cmp->callInfo.C_Prefetch);
4396     printf("\t%10d PGetCacheSize\n", cmp->callInfo.C_PGetCacheSize);
4397     printf("\t%10d PSetCacheSize\n", cmp->callInfo.C_PSetCacheSize);
4398     printf("\t%10d PSetSysName\n", cmp->callInfo.C_PSetSysName);
4399     printf("\t%10d PExportAfs\n", cmp->callInfo.C_PExportAfs);
4400     printf("\t%10d HandleClientContext\n",
4401            cmp->callInfo.C_HandleClientContext);
4402     printf("\t%10d PViceAccess\n", cmp->callInfo.C_PViceAccess);
4403     printf("\t%10d PRemoveCallBack\n", cmp->callInfo.C_PRemoveCallBack);
4404     printf("\t%10d PRemoveMount\n", cmp->callInfo.C_PRemoveMount);
4405     printf("\t%10d PSetVolumeStatus\n", cmp->callInfo.C_PSetVolumeStatus);
4406     printf("\t%10d PListCells\n", cmp->callInfo.C_PListCells);
4407     printf("\t%10d PNewCell\n", cmp->callInfo.C_PNewCell);
4408     printf("\t%10d PGetUserCell\n", cmp->callInfo.C_PGetUserCell);
4409     printf("\t%10d PGetCellStatus\n", cmp->callInfo.C_PGetCellStatus);
4410     printf("\t%10d PSetCellStatus\n", cmp->callInfo.C_PSetCellStatus);
4411     printf("\t%10d PVenusLogging\n", cmp->callInfo.C_PVenusLogging);
4412     printf("\t%10d PGetAcl\n", cmp->callInfo.C_PGetAcl);
4413     printf("\t%10d PGetFID\n", cmp->callInfo.C_PGetFID);
4414     printf("\t%10d PSetAcl\n", cmp->callInfo.C_PSetAcl);
4415     printf("\t%10d PGetFileCell\n", cmp->callInfo.C_PGetFileCell);
4416     printf("\t%10d PGetWSCell\n", cmp->callInfo.C_PGetWSCell);
4417     printf("\t%10d PGetSPrefs\n", cmp->callInfo.C_PGetSPrefs);
4418     printf("\t%10d PSetSPrefs\n", cmp->callInfo.C_PSetSPrefs);
4419     printf("\t%10d afs_ResetAccessCache\n",
4420            cmp->callInfo.C_afs_ResetAccessCache);
4421     printf("\t%10d afs_FindUser\n", cmp->callInfo.C_afs_FindUser);
4422     printf("\t%10d afs_GetUser\n", cmp->callInfo.C_afs_GetUser);
4423     printf("\t%10d afs_GCUserData\n", cmp->callInfo.C_afs_GCUserData);
4424     printf("\t%10d afs_PutUser\n", cmp->callInfo.C_afs_PutUser);
4425     printf("\t%10d afs_SetPrimary\n", cmp->callInfo.C_afs_SetPrimary);
4426     printf("\t%10d afs_ResetUserConns\n", cmp->callInfo.C_afs_ResetUserConns);
4427     printf("\t%10d afs_RemoveUserConns\n", cmp->callInfo.C_RemoveUserConns);
4428     printf("\t%10d afs_ResourceInit\n", cmp->callInfo.C_afs_ResourceInit);
4429     printf("\t%10d afs_GetCell\n", cmp->callInfo.C_afs_GetCell);
4430     printf("\t%10d afs_GetCellByIndex\n", cmp->callInfo.C_afs_GetCellByIndex);
4431     printf("\t%10d afs_GetCellByName\n", cmp->callInfo.C_afs_GetCellByName);
4432     printf("\t%10d afs_GetRealCellByIndex\n",
4433            cmp->callInfo.C_afs_GetRealCellByIndex);
4434     printf("\t%10d afs_NewCell\n", cmp->callInfo.C_afs_NewCell);
4435     printf("\t%10d CheckVLDB\n", cmp->callInfo.C_CheckVLDB);
4436     printf("\t%10d afs_GetVolume\n", cmp->callInfo.C_afs_GetVolume);
4437     printf("\t%10d afs_PutVolume\n", cmp->callInfo.C_afs_PutVolume);
4438     printf("\t%10d afs_GetVolumeByName\n",
4439            cmp->callInfo.C_afs_GetVolumeByName);
4440     printf("\t%10d afs_random\n", cmp->callInfo.C_afs_random);
4441     printf("\t%10d InstallVolumeEntry\n", cmp->callInfo.C_InstallVolumeEntry);
4442     printf("\t%10d InstallVolumeInfo\n", cmp->callInfo.C_InstallVolumeInfo);
4443     printf("\t%10d afs_ResetVolumeInfo\n",
4444            cmp->callInfo.C_afs_ResetVolumeInfo);
4445     printf("\t%10d afs_FindServer\n", cmp->callInfo.C_afs_FindServer);
4446     printf("\t%10d afs_GetServer\n", cmp->callInfo.C_afs_GetServer);
4447     printf("\t%10d afs_SortServers\n", cmp->callInfo.C_afs_SortServers);
4448     printf("\t%10d afs_CheckServers\n", cmp->callInfo.C_afs_CheckServers);
4449     printf("\t%10d ServerDown\n", cmp->callInfo.C_ServerDown);
4450     printf("\t%10d afs_Conn\n", cmp->callInfo.C_afs_Conn);
4451     printf("\t%10d afs_PutConn\n", cmp->callInfo.C_afs_PutConn);
4452     printf("\t%10d afs_ConnByHost\n", cmp->callInfo.C_afs_ConnByHost);
4453     printf("\t%10d afs_ConnByMHosts\n", cmp->callInfo.C_afs_ConnByMHosts);
4454     printf("\t%10d afs_Analyze\n", cmp->callInfo.C_afs_Analyze);
4455     printf("\t%10d afs_CheckLocks\n", cmp->callInfo.C_afs_CheckLocks);
4456     printf("\t%10d CheckVLServer\n", cmp->callInfo.C_CheckVLServer);
4457     printf("\t%10d afs_CheckCacheResets\n",
4458            cmp->callInfo.C_afs_CheckCacheResets);
4459     printf("\t%10d afs_CheckVolumeNames\n",
4460            cmp->callInfo.C_afs_CheckVolumeNames);
4461     printf("\t%10d afs_CheckCode\n", cmp->callInfo.C_afs_CheckCode);
4462     printf("\t%10d afs_CopyError\n", cmp->callInfo.C_afs_CopyError);
4463     printf("\t%10d afs_FinalizeReq\n", cmp->callInfo.C_afs_FinalizeReq);
4464     printf("\t%10d afs_GetVolCache\n", cmp->callInfo.C_afs_GetVolCache);
4465     printf("\t%10d afs_GetVolSlot\n", cmp->callInfo.C_afs_GetVolSlot);
4466     printf("\t%10d afs_UFSGetVolSlot\n", cmp->callInfo.C_afs_UFSGetVolSlot);
4467     printf("\t%10d afs_MemGetVolSlot\n", cmp->callInfo.C_afs_MemGetVolSlot);
4468     printf("\t%10d afs_WriteVolCache\n", cmp->callInfo.C_afs_WriteVolCache);
4469     printf("\t%10d haveCallbacksfrom\n", cmp->callInfo.C_HaveCallBacksFrom);
4470     printf("\t%10d afs_getpage\n", cmp->callInfo.C_afs_getpage);
4471     printf("\t%10d afs_putpage\n", cmp->callInfo.C_afs_putpage);
4472     printf("\t%10d afs_nfsrdwr\n", cmp->callInfo.C_afs_nfsrdwr);
4473     printf("\t%10d afs_map\n", cmp->callInfo.C_afs_map);
4474     printf("\t%10d afs_cmp\n", cmp->callInfo.C_afs_cmp);
4475     printf("\t%10d afs_PageLeft\n", cmp->callInfo.C_afs_PageLeft);
4476     printf("\t%10d afs_mount\n", cmp->callInfo.C_afs_mount);
4477     printf("\t%10d afs_unmount\n", cmp->callInfo.C_afs_unmount);
4478     printf("\t%10d afs_root\n", cmp->callInfo.C_afs_root);
4479     printf("\t%10d afs_statfs\n", cmp->callInfo.C_afs_statfs);
4480     printf("\t%10d afs_sync\n", cmp->callInfo.C_afs_sync);
4481     printf("\t%10d afs_vget\n", cmp->callInfo.C_afs_vget);
4482     printf("\t%10d afs_index\n", cmp->callInfo.C_afs_index);
4483     printf("\t%10d afs_setpag\n", cmp->callInfo.C_afs_setpag);
4484     printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
4485     printf("\t%10d getpag\n", cmp->callInfo.C_getpag);
4486     printf("\t%10d genpag\n", cmp->callInfo.C_genpag);
4487     printf("\t%10d afs_GetMariner\n", cmp->callInfo.C_afs_GetMariner);
4488     printf("\t%10d afs_AddMarinerName\n", cmp->callInfo.C_afs_AddMarinerName);
4489     printf("\t%10d afs_open\n", cmp->callInfo.C_afs_open);
4490     printf("\t%10d afs_close\n", cmp->callInfo.C_afs_close);
4491     printf("\t%10d afs_closex\n", cmp->callInfo.C_afs_closex);
4492     printf("\t%10d afs_write\n", cmp->callInfo.C_afs_write);
4493     printf("\t%10d afs_UFSwrite\n", cmp->callInfo.C_afs_UFSWrite);
4494     printf("\t%10d afs_Memwrite\n", cmp->callInfo.C_afs_MemWrite);
4495     printf("\t%10d afs_rdwr\n", cmp->callInfo.C_afs_rdwr);
4496     printf("\t%10d afs_read\n", cmp->callInfo.C_afs_read);
4497     printf("\t%10d afs_UFSread\n", cmp->callInfo.C_afs_UFSRead);
4498     printf("\t%10d afs_Memread\n", cmp->callInfo.C_afs_MemRead);
4499     printf("\t%10d afs_CopyOutAttrs\n", cmp->callInfo.C_afs_CopyOutAttrs);
4500     printf("\t%10d afs_access\n", cmp->callInfo.C_afs_access);
4501     printf("\t%10d afs_getattr\n", cmp->callInfo.C_afs_getattr);
4502     printf("\t%10d afs_setattr\n", cmp->callInfo.C_afs_setattr);
4503     printf("\t%10d afs_VAttrToAS\n", cmp->callInfo.C_afs_VAttrToAS);
4504     printf("\t%10d EvalMountPoint\n", cmp->callInfo.C_EvalMountPoint);
4505     printf("\t%10d afs_lookup\n", cmp->callInfo.C_afs_lookup);
4506     printf("\t%10d afs_create\n", cmp->callInfo.C_afs_create);
4507     printf("\t%10d afs_LocalHero\n", cmp->callInfo.C_afs_LocalHero);
4508     printf("\t%10d afs_remove\n", cmp->callInfo.C_afs_remove);
4509     printf("\t%10d afs_link\n", cmp->callInfo.C_afs_link);
4510     printf("\t%10d afs_rename\n", cmp->callInfo.C_afs_rename);
4511     printf("\t%10d afs_InitReq\n", cmp->callInfo.C_afs_InitReq);
4512     printf("\t%10d afs_mkdir\n", cmp->callInfo.C_afs_mkdir);
4513     printf("\t%10d afs_rmdir\n", cmp->callInfo.C_afs_rmdir);
4514     printf("\t%10d afs_readdir\n", cmp->callInfo.C_afs_readdir);
4515     printf("\t%10d afs_read1dir\n", cmp->callInfo.C_afs_read1dir);
4516     printf("\t%10d afs_readdir_move\n", cmp->callInfo.C_afs_readdir_move);
4517     printf("\t%10d afs_readdir_iter\n", cmp->callInfo.C_afs_readdir_iter);
4518     printf("\t%10d afs_symlink\n", cmp->callInfo.C_afs_symlink);
4519     printf("\t%10d afs_HandleLink\n", cmp->callInfo.C_afs_HandleLink);
4520     printf("\t%10d afs_MemHandleLink\n", cmp->callInfo.C_afs_MemHandleLink);
4521     printf("\t%10d afs_UFSHandleLink\n", cmp->callInfo.C_afs_UFSHandleLink);
4522     printf("\t%10d HandleFlock\n", cmp->callInfo.C_HandleFlock);
4523     printf("\t%10d afs_readlink\n", cmp->callInfo.C_afs_readlink);
4524     printf("\t%10d afs_fsync\n", cmp->callInfo.C_afs_fsync);
4525     printf("\t%10d afs_inactive\n", cmp->callInfo.C_afs_inactive);
4526     printf("\t%10d afs_ustrategy\n", cmp->callInfo.C_afs_ustrategy);
4527     printf("\t%10d afs_strategy\n", cmp->callInfo.C_afs_strategy);
4528     printf("\t%10d afs_bread\n", cmp->callInfo.C_afs_bread);
4529     printf("\t%10d afs_brelse\n", cmp->callInfo.C_afs_brelse);
4530     printf("\t%10d afs_bmap\n", cmp->callInfo.C_afs_bmap);
4531     printf("\t%10d afs_fid\n", cmp->callInfo.C_afs_fid);
4532     printf("\t%10d afs_FakeOpen\n", cmp->callInfo.C_afs_FakeOpen);
4533     printf("\t%10d afs_FakeClose\n", cmp->callInfo.C_afs_FakeClose);
4534     printf("\t%10d afs_StoreOnLastReference\n",
4535            cmp->callInfo.C_afs_StoreOnLastReference);
4536     printf("\t%10d afs_AccessOK\n", cmp->callInfo.C_afs_AccessOK);
4537     printf("\t%10d afs_GetAccessBits\n", cmp->callInfo.C_afs_GetAccessBits);
4538     printf("\t%10d afsio_copy\n", cmp->callInfo.C_afsio_copy);
4539     printf("\t%10d afsio_trim\n", cmp->callInfo.C_afsio_trim);
4540     printf("\t%10d afsio_skip\n", cmp->callInfo.C_afsio_skip);
4541     printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
4542     printf("\t%10d afs_page_write\n", cmp->callInfo.C_afs_page_write);
4543     printf("\t%10d afs_page_read\n", cmp->callInfo.C_afs_page_read);
4544     printf("\t%10d afs_get_groups_from_pag\n",
4545            cmp->callInfo.C_afs_get_groups_from_pag);
4546     printf("\t%10d afs_get_pag_from_groups\n",
4547            cmp->callInfo.C_afs_get_pag_from_groups);
4548     printf("\t%10d AddPag\n", cmp->callInfo.C_AddPag);
4549     printf("\t%10d PagInCred\n", cmp->callInfo.C_PagInCred);
4550     printf("\t%10d afs_getgroups\n", cmp->callInfo.C_afs_getgroups);
4551     printf("\t%10d afs_page_in\n", cmp->callInfo.C_afs_page_in);
4552     printf("\t%10d afs_page_out\n", cmp->callInfo.C_afs_page_out);
4553     printf("\t%10d afs_AdvanceFD\n", cmp->callInfo.C_afs_AdvanceFD);
4554     printf("\t%10d afs_lockf\n", cmp->callInfo.C_afs_lockf);
4555     printf("\t%10d afs_xsetgroups\n", cmp->callInfo.C_afs_xsetgroups);
4556     printf("\t%10d afs_nlinks\n", cmp->callInfo.C_afs_nlinks);
4557     printf("\t%10d afs_lockctl\n", cmp->callInfo.C_afs_lockctl);
4558     printf("\t%10d afs_xflock\n", cmp->callInfo.C_afs_xflock);
4559     printf("\t%10d PGetCPrefs\n", cmp->callInfo.C_PGetCPrefs);
4560     printf("\t%10d PSetCPrefs\n", cmp->callInfo.C_PSetCPrefs);
4561 #ifdef  AFS_HPUX_ENV
4562     printf("\t%10d afs_pagein\n", cmp->callInfo.C_afs_pagein);
4563     printf("\t%10d afs_pageout\n", cmp->callInfo.C_afs_pageout);
4564     printf("\t%10d afs_hp_strategy\n", cmp->callInfo.C_afs_hp_strategy);
4565 #endif
4566 }
4567
4568 #endif
4569 #if 0
4570 #define OffsetOf(s,mem) ((long)(&(((s *)0)->mem)))
4571 #define SizeOf(s,mem)   ((long)sizeof(((s *)0)->mem))
4572 #define values(s,mem)   OffsetOf(s,mem), SizeOf(s,mem)
4573
4574 print_struct_vcache_offsets()
4575 {
4576     printf("struct vcache.v              offset = %ld, size = %ld\n",
4577            values(struct vcache, v));
4578     printf("struct vcache.vlruq          offset = %ld, size = %ld\n",
4579            values(struct vcache, vlruq));
4580     printf("struct vcache.nextfree       offset = %ld, size = %ld\n",
4581            values(struct vcache, nextfree));
4582     printf("struct vcache.hnext          offset = %ld, size = %ld\n",
4583            values(struct vcache, hnext));
4584     printf("struct vcache.fid            offset = %ld, size = %ld\n",
4585            values(struct vcache, fid));
4586     printf("struct vcache.m              offset = %ld, size = %ld\n",
4587            values(struct vcache, m));
4588     printf("struct vcache.lock           offset = %ld, size = %ld\n",
4589            values(struct vcache, lock));
4590     printf("struct vcache.parentVnode    offset = %ld, size = %ld\n",
4591            values(struct vcache, parentVnode));
4592     printf("struct vcache.parentUnique   offset = %ld, size = %ld\n",
4593            values(struct vcache, parentUnique));
4594     printf("struct vcache.mvid           offset = %ld, size = %ld\n",
4595            values(struct vcache, mvid));
4596     printf("struct vcache.linkData       offset = %ld, size = %ld\n",
4597            values(struct vcache, linkData));
4598     printf("struct vcache.flushDV        offset = %ld, size = %ld\n",
4599            values(struct vcache, flushDV));
4600     printf("struct vcache.mapDV          offset = %ld, size = %ld\n",
4601            values(struct vcache, mapDV));
4602     printf("struct vcache.truncPos       offset = %ld, size = %ld\n",
4603            values(struct vcache, truncPos));
4604     printf("struct vcache.callback       offset = %ld, size = %ld\n",
4605            values(struct vcache, callback));
4606     printf("struct vcache.cbExpires      offset = %ld, size = %ld\n",
4607            values(struct vcache, cbExpires));
4608     printf("struct vcache.callsort       offset = %ld, size = %ld\n",
4609            values(struct vcache, callsort));
4610     printf("struct vcache.Access         offset = %ld, size = %ld\n",
4611            values(struct vcache, Access));
4612     printf("struct vcache.anyAccess      offset = %ld, size = %ld\n",
4613            values(struct vcache, anyAccess));
4614     printf("struct vcache.last_looker    offset = %ld, size = %ld\n",
4615            values(struct vcache, last_looker));
4616     printf("struct vcache.activeV        offset = %ld, size = %ld\n",
4617            values(struct vcache, activeV));
4618     printf("struct vcache.slocks         offset = %ld, size = %ld\n",
4619            values(struct vcache, slocks));
4620     printf("struct vcache.opens          offset = %ld, size = %ld\n",
4621            values(struct vcache, opens));
4622     printf("struct vcache.execsOrWriters offset = %ld, size = %ld\n",
4623            values(struct vcache, execsOrWriters));
4624     printf("struct vcache.flockCount     offset = %ld, size = %ld\n",
4625            values(struct vcache, flockCount));
4626     printf("struct vcache.mvstat         offset = %ld, size = %ld\n",
4627            values(struct vcache, mvstat));
4628     printf("struct vcache.states         offset = %ld, size = %ld\n",
4629            values(struct vcache, states));
4630     printf("struct vcache.quick          offset = %ld, size = %ld\n",
4631            values(struct vcache, quick));
4632     printf("struct vcache.symhintstamp   offset = %ld, size = %ld\n",
4633            values(struct vcache, symhintstamp));
4634     printf("struct vcache.h1             offset = %ld, size = %ld\n",
4635            values(struct vcache, h1));
4636     printf("struct vcache.lastr          offset = %ld, size = %ld\n",
4637            values(struct vcache, lastr));
4638     printf("struct vcache.vc_rwlockid    offset = %ld, size = %ld\n",
4639            values(struct vcache, vc_rwlockid));
4640     printf("struct vcache.vc_locktrips   offset = %ld, size = %ld\n",
4641            values(struct vcache, vc_locktrips));
4642     printf("struct vcache.vc_rwlock      offset = %ld, size = %ld\n",
4643            values(struct vcache, vc_rwlock));
4644     printf("struct vcache.mapcnt         offset = %ld, size = %ld\n",
4645            values(struct vcache, mapcnt));
4646     printf("struct vcache.cred           offset = %ld, size = %ld\n",
4647            values(struct vcache, cred));
4648     printf("struct vcache.vc_bhv_desc    offset = %ld, size = %ld\n",
4649            values(struct vcache, vc_bhv_desc));
4650     printf("struct vcache.vc_error       offset = %ld, size = %ld\n",
4651            values(struct vcache, vc_error));
4652     printf("struct vcache.xlatordv       offset = %ld, size = %ld\n",
4653            values(struct vcache, xlatordv));
4654     printf("struct vcache.uncred         offset = %ld, size = %ld\n",
4655            values(struct vcache, uncred));
4656     printf("struct vcache.asynchrony     offset = %ld, size = %ld\n",
4657            values(struct vcache, asynchrony));
4658 }
4659
4660 print_struct_vnode_offsets()
4661 {
4662     printf("struct vnode.v_list           offset = %ld, size = %ld\n",
4663            values(struct vnode, v_list));
4664     printf("struct vnode.v_flag           offset = %ld, size = %ld\n",
4665            values(struct vnode, v_flag));
4666     printf("struct vnode.v_count          offset = %ld, size = %ld\n",
4667            values(struct vnode, v_count));
4668     printf("struct vnode.v_listid         offset = %ld, size = %ld\n",
4669            values(struct vnode, v_listid));
4670     printf("struct vnode.v_intpcount      offset = %ld, size = %ld\n",
4671            values(struct vnode, v_intpcount));
4672     printf("struct vnode.v_type           offset = %ld, size = %ld\n",
4673            values(struct vnode, v_type));
4674     printf("struct vnode.v_rdev           offset = %ld, size = %ld\n",
4675            values(struct vnode, v_rdev));
4676     printf("struct vnode.v_vfsmountedhere offset = %ld, size = %ld\n",
4677            values(struct vnode, v_vfsmountedhere));
4678     printf("struct vnode.v_vfsp           offset = %ld, size = %ld\n",
4679            values(struct vnode, v_vfsp));
4680     printf("struct vnode.v_stream         offset = %ld, size = %ld\n",
4681            values(struct vnode, v_stream));
4682     printf("struct vnode.v_filocks        offset = %ld, size = %ld\n",
4683            values(struct vnode, v_filocks));
4684     printf("struct vnode.v_filocksem      offset = %ld, size = %ld\n",
4685            values(struct vnode, v_filocksem));
4686     printf("struct vnode.v_number         offset = %ld, size = %ld\n",
4687            values(struct vnode, v_number));
4688     printf("struct vnode.v_bh             offset = %ld, size = %ld\n",
4689            values(struct vnode, v_bh));
4690     printf("struct vnode.v_namecap        offset = %ld, size = %ld\n",
4691            values(struct vnode, v_namecap));
4692     printf("struct vnode.v_hashp          offset = %ld, size = %ld\n",
4693            values(struct vnode, v_hashp));
4694     printf("struct vnode.v_hashn          offset = %ld, size = %ld\n",
4695            values(struct vnode, v_hashn));
4696     printf("struct vnode.v_mreg           offset = %ld, size = %ld\n",
4697            values(struct vnode, v_mreg));
4698     printf("struct vnode.v_mregb          offset = %ld, size = %ld\n",
4699            values(struct vnode, v_mregb));
4700     printf("struct vnode.v_pgcnt          offset = %ld, size = %ld\n",
4701            values(struct vnode, v_pgcnt));
4702     printf("struct vnode.v_dpages         offset = %ld, size = %ld\n",
4703            values(struct vnode, v_dpages));
4704     printf("struct vnode.v_dpages_gen     offset = %ld, size = %ld\n",
4705            values(struct vnode, v_dpages_gen));
4706     printf("struct vnode.v_dbuf           offset = %ld, size = %ld\n",
4707            values(struct vnode, v_dbuf));
4708     printf("struct vnode.v_buf            offset = %ld, size = %ld\n",
4709            values(struct vnode, v_buf));
4710     printf("struct vnode.v_bufgen         offset = %ld, size = %ld\n",
4711            values(struct vnode, v_bufgen));
4712     printf("struct vnode.v_traceix        offset = %ld, size = %ld\n",
4713            values(struct vnode, v_traceix));
4714     printf("struct vnode.v_buf_lock       offset = %ld, size = %ld\n",
4715            values(struct vnode, v_buf_lock));
4716     printf("struct vnode.v_pc             offset = %ld, size = %ld\n",
4717            values(struct vnode, v_pc));
4718 #ifdef VNODE_TRACING
4719     printf("struct vnode.v_trace          offset = %ld, size = %ld\n",
4720            values(struct vnode, v_trace));
4721 #endif
4722 #ifdef CKPT
4723     printf("struct vnode.v_ckpt           offset = %ld, size = %ld\n",
4724            values(struct vnode, v_ckpt));
4725 #endif
4726 }
4727 #endif