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