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