2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
17 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
19 #ifdef AFS_LINUX24_ENV
21 #include <linux/string.h>
23 #define _SYS_STATFS_H 1
24 #define _BITS_SIGCONTEXT_H 1
28 #ifdef AFS_LINUX26_ENV
29 /* For some reason, this doesn't get defined in linux/types.h
30 if __KERNEL_STRICT_NAMES is defined. But the definition of
34 #define pgoff_t unsigned long
47 #define __LINUX_UFS_FS_SB_H
49 #define _LINUX_CODA_FS_I
50 #define _LINUX_NTFS_FS_SB_H
51 #define _LINUX_NTFS_FS_I_H
61 struct nfs_inode_info {
63 struct sysv_inode_info {
65 struct coda_inode_info {
67 struct affs_inode_info {
69 struct nfs_lock_info {
73 struct ntfs_inode_info {
77 #include <linux/types.h>
78 #define u32 unsigned int
80 #define u16 unsigned short
82 #if __GLIBC_MINOR__ >= 2
83 #define _SYS_TYPES_H 1
88 /* This tells afs.h to pick up afs_args from the dest tree. */
92 * Need to include <netdb.h> before _KERNEL is defined since on IRIX 6.5
93 * <netdb.h> includes <netinet/in.h>, which in turn declares inet_addr()
94 * if _KERNEL is defined. This declaration conflicts with that in
97 #if ! defined(AFS_AIX_ENV)
101 /* For AFS_SGI61_ENV and a 64 bit OS, _KMEMUSER should be defined on the
102 * compile line for kdump.o in the Makefile. This lets us pick up
103 * app32_ptr_t from types.h when included from afs/param.h.
109 #ifndef AFS_LINUX20_ENV
117 #include <afs/stds.h>
119 #if defined(AFS_OSF_ENV)
126 #include <kern/lock.h>
127 #include <sys/vnode.h>
128 #include <arch/alpha/pmap.h>
131 * beginning with DUX 4.0A, the system header files define the macros
137 * to be calls to the kernel functions
143 * when _KERNEL is defined, and expressions otherwise. Since need
144 * to define _KERNEL, we redefine these kernel functions as macros
145 * for the expressions that we would have gotten if _KERNEL had not
146 * been defined. Yes, this duplicates code from the header files, but
147 * there's no simple way around it.
150 #define kseg_to_phys(addr) ((vm_offset_t)(addr) - UNITY_BASE)
151 #define is_kseg_va(x) (((unsigned long)(x) & SEG1_BASE) == UNITY_BASE)
152 #define is_seg1_va(x) (((unsigned long)(x) & SEG1_BASE) == SEG1_BASE)
158 #ifdef AFS_SUN5_ENV /*XXXXX*/
159 #include <sys/t_lock.h>
165 #include <sys/sema.h>
166 #ifndef AFS_SGI62_ENV
172 #include <sys/fcntl.h>
178 #include <sys/param.h>
180 #ifndef AFS_SGI64_ENV
181 #include <sys/user.h>
184 #ifndef AFS_LINUX26_ENV
185 #include <sys/file.h>
189 * On SGIs, when _KERNEL is defined, <netinet/in.h> declares inet_addr()
190 * in a way that conflicts with the declaration in <arpa/inet.h>.
192 * Here we bring in <netinet/in.h> without _KERNEL defined and restore
193 * _KERNEL afterwards if needed.
195 * A better solution might be to straighten out which #includes are
196 * sensitive to _KERNEL on SGIs....
198 #if defined(AFS_SGI_ENV) && defined(_KERNEL)
200 # include <netinet/in.h> /* struct in_addr */
203 # include <netinet/in.h> /* struct in_addr */
206 #if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
208 #include <sys/vnode.h>
209 #endif /* AFS_SGI_ENV */
211 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
212 #include <sys/vnode.h>
213 #include <sys/mount.h>
214 #include <ufs/ufs/quota.h>
215 #include <ufs/ufs/inode.h>
216 #include <ufs/ffs/fs.h>
219 #ifdef AFS_LINUX20_ENV
221 #define UIO_MAXIOV 1 /* don't care */
223 #if __GLIBC_MINOR__ == 0
227 /*#define _SYS_UIO_H */
228 #define _LINUX_SOCKET_H
233 #define _LINUX_TIME_H
234 #ifndef AFS_LINUX26_ENV
235 #define _LINUX_FCNTL_H
237 #ifdef AFS_IA64_LINUX24_ENV
238 #define flock64 flock
239 #endif /* AFS_IA64_LINUX24_ENV */
240 #ifdef AFS_S390_LINUX20_ENV
241 #define _S390_STATFS_H
243 #ifdef AFS_SPARC64_LINUX20_ENV
244 #define _SPARC64_STATFS_H
245 #define _SPARC_STATFS_H
247 #ifdef AFS_SPARC_LINUX20_ENV
248 #define _SPARC_STATFS_H
250 #ifdef AFS_ALPHA_LINUX20_ENV
251 #define _ALPHA_STATFS_H
253 #define _I386_STATFS_H
254 #endif /* AFS_ALPHA_LINUX20_ENV */
255 #endif /* AFS_SPARC_LINUX20_ENV */
256 #endif /* AFS_SPARC64_LINUX20_ENV */
257 #endif /* AFS_S390_LINUX20_ENV */
261 #if 0 /*ndef AFS_ALPHA_LINUX20_ENV */
262 typedef struct timeval {
265 } timeval_t; /* Needed here since KERNEL defined. */
266 #endif /*AFS_ALPHA_LINUX20_ENV */
267 #if defined(WORDS_BIGENDIAN)
268 #define _LINUX_BYTEORDER_BIG_ENDIAN_H
270 #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
272 /* Avoid problems with timer_t redefinition */
274 #define timer_t ktimer_t
275 #define timer_t_redefined
277 #ifdef AFS_LINUX26_ENV
278 /* For some reason, this doesn't get defined in linux/types.h
279 if __KERNEL_STRICT_NAMES is defined. But the definition of
280 struct inode uses it.
282 #ifndef HAVE_SECTOR_T
283 /* got it from linux/types.h */
284 typedef unsigned long sector_t;
285 #endif /* HAVE_SECTOR_T */
286 #endif /* AFS_LINUX26_ENV */
287 #include <linux/version.h>
288 #include <linux/fs.h>
290 #ifdef timer_t_redefined
292 #undef timer_t_redefined
294 #else /* AFS_LINUX20_ENV */
295 #ifdef AFS_HPUX110_ENV
298 /* Declare following so sys/vnode.h will compile with KERNEL defined */
300 typedef enum _spustate { /* FROM /etc/conf/h/_types.h */
301 SPUSTATE_NONE = 0, /* must be 0 for proper initialization */
302 SPUSTATE_IDLE, /* spu is idle */
303 SPUSTATE_USER, /* spu is in user mode */
304 SPUSTATE_SYSTEM, /* spu is in system mode */
305 SPUSTATE_UNKNOWN, /* utility code for NEW_INTERVAL() */
306 SPUSTATE_NOCHANGE /* utility code for NEW_INTERVAL() */
308 #define k_off_t off_t
309 #include "sys/vnode.h"
312 #else /* AFS_HPUX110_ENV */
313 #include "sys/vnode.h"
314 #endif /* else AFS_HPUX110_ENV */
315 #endif /* else AFS_LINUX20_ENV */
317 #include "sys/inode.h"
321 #include "sys/fs/ufs_inode.h"
323 #ifndef AFS_LINUX20_ENV
324 #include "ufs/inode.h"
334 /* This definition is in rx_machdep.h, currently only for AIX 41 */
335 #define RX_ENABLE_LOCKS
336 /* The following two defines are from rx_machdep.h and are used in rx_
339 #define afs_kmutex_t int
340 #define afs_kcondvar_t int
341 #endif /* AFS_AIX41_ENV */
346 #define RX_ENABLE_LOCKS
349 * Removed redefinitions of afs_kmutex_t and afs_kcondvar_t and included
350 * the system header files in which they are defined
352 #include <sys/mutex.h>
353 #include <sys/condvar.h>
354 typedef kmutex_t afs_kmutex_t;
355 typedef kcondvar_t afs_kcondvar_t;
356 #endif /* AFS_SUN5_ENV */
359 #define RX_ENABLE_LOCKS
364 typedef int afs_kcondvar_t;
365 #endif /* AFS_DUX40_ENV */
367 #ifdef AFS_HPUX110_ENV
368 #define RX_ENABLE_LOCKS
381 typedef char *afs_kcondvar_t;
382 #endif /* AFS_HPUX110_ENV */
385 #define RX_ENABLE_LOCKS 1
387 __psunsigned_t opaque1;
391 __psunsigned_t opaque;
393 #endif /* AFS_SGI65_ENV */
395 #ifdef AFS_LINUX20_ENV
396 #include <asm/atomic.h>
397 #include <asm/semaphore.h>
398 #define RX_ENABLE_LOCKS 1
400 struct semaphore opaque1;
403 typedef void *afs_kcondvar_t;
404 #endif /* AFS_LINUX20_ENV */
406 #include <afs/exporter.h>
407 /*#include "afs/osi.h"*/
412 } osi_timeval_t; /* Needed here since KERNEL defined. */
414 /*#include "afs/volerrors.h"*/
415 #ifdef AFS_LINUX20_ENV
419 #include <afs/afsint.h>
420 #include "vlserver/vldbint.h"
421 #include "afs/lock.h"
435 extern off64_t lseek64();
436 #define KDUMP_SIZE_T size_t
437 #else /* AFS_SGI61_ENV */
438 #define KDUMP_SIZE_T int
439 #endif /* AFS_SGI61_ENV */
441 #include "afs/afs.h" /* XXXX Getting it from the obj tree XXX */
442 #include "afs/afs_axscache.h" /* XXXX Getting it from the obj tree XXX */
443 #include <afs/afs_stats.h>
444 #include <afs/nfsclient.h>
452 #if defined(AFS_OSF_ENV) && !defined(v_count)
453 #define v_count v_usecount
457 #define KERNELBASE 0x80000000
458 #define coreadj(x) ((int)x - KERNELBASE)
461 #if defined(AFS_SGI_ENV)
464 #if defined(AFS_HPUX100_ENV)
465 #define UNIX "/stand/vmunix"
468 #define UNIX "/hp-ux"
471 #define UNIX "/dev/ksyms"
473 #define UNIX "/vmunix"
475 #endif /* AFS_HPUX_ENV */
476 #endif /* AFS_HPUX100_ENV */
477 #endif /* AFS_SGI_ENV */
479 #if defined(AFS_SUN5_ENV)
480 #define CORE "/dev/mem"
482 #define CORE "/dev/kmem"
485 /* Forward declarations */
488 void print_DindexTimes();
489 void print_DdvnextTbl();
490 void print_DdcnextTbl();
491 void print_DindexFlags();
492 void print_buffers();
494 void kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len);
495 void print_exporter();
496 void print_nfsclient();
497 void print_unixuser();
503 void print_venusfid();
510 void print_callout();
512 void print_global_locks();
513 void print_global_afs_resource();
514 void print_global_afs_cache();
515 void print_rxstats();
517 void print_services();
519 void print_peertable_lock();
520 void print_conntable_lock();
521 void print_calltable_lock();
523 void print_peertable();
524 void print_conntable();
525 void print_calltable();
526 void print_eventtable();
527 void print_upDownStats();
528 void print_cmperfstats();
529 void print_cmstats();
536 #if defined(AFS_HPUX_ENV) && defined(__LP64__)
537 #define afs_nlist nlist64
538 #define AFSNLIST(N, C) nlist64((N), (C))
539 #else /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
541 #ifdef AFS_32BIT_KERNEL_ENV
542 #define afs_nlist nlist
543 #define AFSNLIST(N, C) nlist((N), (C))
545 #define afs_nlist nlist64
546 #define AFSNLIST(N, C) nlist64((N), (C))
547 #endif /* AFS_32BIT_KERNEL_ENV */
548 #else /* AFS_SGI61_ENV */
549 #ifdef AFS_LINUX20_ENV
552 unsigned long n_value;
554 #else /* AFS_LINUX20_ENV */
555 #define afs_nlist nlist
556 #endif /* AFS_LINUX20_ENV */
557 #define AFSNLIST(N, C) nlist((N), (C))
558 #endif /* AFS_SGI61_ENV */
559 #endif /* defined(AFS_HPUX_ENV) && defined(__LP64__) */
561 char *obj = UNIX, *core = CORE;
564 int Dcells = 0, Dusers = 0, Dservers = 0, Dconns = 0, Dvols = 0, Ddvols =
566 int Dvstats = 0, Ddstats = 0, Dnfs = 0, Dglobals = 0, Dstats = 0, Dlocks =
568 int Dindextimes = 0, Dindexflags = 0, Dvnodes = 0, Dbuffers = 0, DCallbacks =
569 0, Dallocs = 0, UserLevel = 0;
570 int DdvnextTbl = 0, DdcnextTbl = 0;
571 int Nconns = 0, Drxstats = 0, Drx = 0, Dbkg = 0, Dvlru = 0, Ddlru =
576 #if defined(AFS_SUN5_ENV)
578 #include <sys/types.h>
579 #include <sys/signal.h>
582 #include <sys/elf_M32.h>
583 #include <sys/proc.h>
584 #include <sys/file.h>
585 #define _NLIST_H /* XXXXXXXXXXXXX */
588 #endif /* defined(AFS_SUN5_ENV) */
590 /* Pretty Printers - print real IP addresses and the like if running
596 PrintIPAddr(int addr)
599 struct in_addr in_addr;
603 strcpy(str, "local");
605 in_addr.s_addr = addr;
606 (void)strcpy(str, inet_ntoa(in_addr));
609 (void)sprintf(str, "%x", addr);
614 #ifdef AFS_LINUX20_ENV
615 /* Find symbols in a live kernel. */
617 #ifdef AFS_LINUX26_ENV
618 #define KSYMS "/proc/kallsyms"
620 #define KSYMS "/proc/ksyms"
623 /* symlist_t contains all the kernel symbols. Forcing a 64 byte array is
624 * a bit wasteful, but simple.
626 #define MAXNAMELEN 64
627 typedef struct symlist {
628 char s_name[MAXNAMELEN];
629 #ifdef AFS_LINUX_64BIT_KERNEL
630 unsigned long s_value;
633 #endif /* AFS_LINUX_64BIT_KERNEL */
636 #define KSYM_ALLOC_STEP 128
637 #define KSYM_ALLOC_BASE 1024
638 symlist_t *ksyms = NULL;
645 compare_strings(const void *a, const void *b)
647 symlist_t *syma = (symlist_t *) a;
648 symlist_t *symb = (symlist_t *) b;
649 return strcmp(syma->s_name, symb->s_name);
652 /* Read in all the kernel symbols */
663 fp = fopen(KSYMS, "r");
665 printf("Can't open %s, exiting.\n", KSYMS);
669 availksyms = KSYM_ALLOC_BASE;
670 ksyms = (symlist_t *) malloc(availksyms * sizeof(symlist_t));
672 printf("Can't malloc %d elements for symbol list.\n", availksyms);
676 /* proc is organized as <addr> <name> <module> */
677 while (fgets(line, MAXLINE, fp)) {
678 if (nksyms >= availksyms) {
679 availksyms += KSYM_ALLOC_STEP;
680 ksyms = realloc(ksyms, availksyms * sizeof(symlist_t));
682 printf("Failed to realloc %d symbols.\n", availksyms);
686 #ifdef AFS_LINUX_64BIT_KERNEL
687 ksyms[nksyms].s_value = (unsigned long)strtoul(line, &p, 16);
689 ksyms[nksyms].s_value = (int)strtoul(line, &p, 16);
690 #endif /* AFS_LINUX_64BIT_KERNEL */
692 #ifdef AFS_LINUX26_ENV
693 /* Linux 2.6 /proc/kallsyms has a one-char symbol type
694 between address and name, so step over it and the following
702 if (strlen(p) >= MAXLINE) {
703 printf("Symbol '%s' too long, ignoring it.\n", p);
706 (void)strcpy(ksyms[nksyms].s_name, p);
710 /* Sort them in lexical order */
711 qsort(ksyms, nksyms, sizeof(symlist_t), compare_strings);
716 /* find_symbol returns 0 if not found, otherwise value for symbol */
717 #ifdef AFS_LINUX_64BIT_KERNEL
721 #endif /* AFS_LINUX_64BIT_KERNEL */
722 find_symbol(char *name)
730 (void)strcpy(entry.s_name, name);
732 (symlist_t *) bsearch(&entry, ksyms, nksyms, sizeof(symlist_t),
735 return tmp ? tmp->s_value : 0;
738 /* nlist fills in values in list until a null name is found. */
740 nlist(void *notused, struct afs_nlist *nlp)
742 for (; nlp->n_name && *nlp->n_name; nlp++)
743 nlp->n_value = find_symbol(nlp->n_name);
750 #if defined(AFS_SUN5_ENV)
754 Elf32_Sym *tbl; /* symbol tbl */
756 char *tblp; /* ptr to symbol tbl */
775 for (sp = tbl; sp < &tbl[scnt]; sp++) {
777 type = ELF64_ST_TYPE(sp->st_info);
779 type = ELF32_ST_TYPE(sp->st_info);
781 if (((type == STB_LOCAL) || (type == STB_GLOBAL)
782 || (type == STB_WEAK))
783 && ((afs_uint32) sp->st_value >= 0x10000)) {
784 name = tblp + sp->st_name;
785 if (!strcmp(name, s))
792 #endif /*defined(AFS_SUN5_ENV) */
794 #endif /*!defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV) */
796 #ifndef AFS_KDUMP_LIB
798 cmdproc(struct cmd_syndesc *as, void *arock)
802 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
803 if (as->parms[0].items) { /* -kobj */
804 obj = as->parms[0].items->data;
806 if (as->parms[1].items) { /* -kcore */
807 core = as->parms[1].items->data;
809 if (as->parms[2].items) { /* -cells */
810 Dcells = 1, Dall = 0;
812 if (as->parms[3].items) { /* -users */
813 Dusers = 1, Dall = 0;
815 if (as->parms[4].items) { /* -servers */
816 Dservers = 1, Dall = 0;
818 if (as->parms[5].items) { /* -conns */
819 Dconns = 1, Dall = 0;
821 if (as->parms[6].items) { /* -volumes */
824 if (as->parms[7].items) { /* -dvolumes */
825 Ddvols = 1, Dall = 0;
827 if (as->parms[8].items) { /* -vstats */
828 Dvstats = 1, Dall = 0;
830 if (as->parms[9].items) { /* -dstats */
831 Ddstats = 1, Dall = 0;
833 if (as->parms[10].items) { /* -nfstats */
836 if (as->parms[11].items) { /* -globals */
837 Dglobals = 1, Dall = 0;
839 if (as->parms[12].items) { /* -stats */
840 Dstats = 1, Dall = 0;
842 if (as->parms[13].items) { /* -locks */
843 Dlocks = 1, Dall = 0;
845 if (as->parms[14].items) { /* -mem */
848 if (as->parms[15].items) { /* -rxstats */
849 Drxstats = 1, Dall = 0;
851 if (as->parms[16].items) { /* -rx */
854 if (as->parms[17].items) { /* -timestable */
855 Dindextimes = 1, Dall = 0;
857 if (as->parms[18].items) { /* -flagstable */
858 Dindexflags = 1, Dall = 0;
860 if (as->parms[19].items) { /* -cbhash */
861 DCallbacks = 1, Dall = 0;
863 if (as->parms[20].items) { /* -vnodes */
864 Dvnodes = 1, Dall = 0;
866 if (as->parms[21].items) { /* -buffers */
867 Dbuffers = 1, Dall = 0;
869 if (as->parms[22].items) { /* -allocedmem */
870 Dallocs = 1, Dall = 0;
872 if (as->parms[23].items) { /* -user */
875 if (as->parms[24].items) { /* -bkg */
878 if (as->parms[25].items) { /* -vlru */
881 if (as->parms[26].items) { /* -callout */
882 Dcallout = 1, Dall = 0;
884 if (as->parms[27].items) { /* -dnlc */
887 if (as->parms[28].items) { /* -dlru */
891 if (as->parms[29].items) { /* -raw */
895 if (as->parms[30].items) { /* -gcpags */
896 Dgcpags = 1, Dall = 0;
899 if (as->parms[31].items) { /* -dhash */
900 DdvnextTbl = 1, DdcnextTbl = 1, Dall = 0;
908 #include "AFS_component_version_number.c"
911 main(int argc, char **argv)
913 struct cmd_syndesc *ts;
917 struct sigaction nsa;
919 sigemptyset(&nsa.sa_mask);
920 nsa.sa_handler = SIG_DFL;
921 nsa.sa_flags = SA_FULLDUMP;
922 sigaction(SIGSEGV, &nsa, NULL);
925 ts = cmd_CreateSyntax(NULL, cmdproc, NULL,
926 "Read internal cache manager structs");
927 cmd_AddParm(ts, "-kobj", CMD_SINGLE, CMD_OPTIONAL,
928 "kernel object (default /vmunix)");
929 cmd_AddParm(ts, "-kcore", CMD_SINGLE, CMD_OPTIONAL,
930 "kernel core image (default /dev/kmem)");
931 cmd_AddParm(ts, "-cells", CMD_FLAG, CMD_OPTIONAL, "cell state");
932 cmd_AddParm(ts, "-users", CMD_FLAG, CMD_OPTIONAL, "users state");
933 cmd_AddParm(ts, "-servers", CMD_FLAG, CMD_OPTIONAL, "servers state");
934 cmd_AddParm(ts, "-conns", CMD_FLAG, CMD_OPTIONAL, "conns state");
935 cmd_AddParm(ts, "-volumes", CMD_FLAG, CMD_OPTIONAL,
936 "incore volume state");
937 cmd_AddParm(ts, "-dvolumes", CMD_FLAG, CMD_OPTIONAL, "disk volume state");
938 cmd_AddParm(ts, "-vstats", CMD_FLAG, CMD_OPTIONAL, "stat file state");
939 cmd_AddParm(ts, "-dstats", CMD_FLAG, CMD_OPTIONAL, "file data state");
940 cmd_AddParm(ts, "-nfstats", CMD_FLAG, CMD_OPTIONAL,
941 "nfs translator state");
942 cmd_AddParm(ts, "-globals", CMD_FLAG, CMD_OPTIONAL,
943 "general global state");
944 cmd_AddParm(ts, "-stats", CMD_FLAG, CMD_OPTIONAL,
945 "general cm performance state");
946 cmd_AddParm(ts, "-locks", CMD_FLAG, CMD_OPTIONAL,
947 "global cm related locks state");
948 cmd_AddParm(ts, "-mem", CMD_FLAG, CMD_OPTIONAL,
949 "core represents the physical mem (i.e. /dev/mem) and not virtual");
950 cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL,
951 "general rx statistics");
952 cmd_AddParm(ts, "-rx", CMD_FLAG, CMD_OPTIONAL, "all info about rx");
953 cmd_AddParm(ts, "-timestable", CMD_FLAG, CMD_OPTIONAL,
954 "dcache LRU info table");
955 cmd_AddParm(ts, "-flagstable", CMD_FLAG, CMD_OPTIONAL,
956 "dcache flags info table");
957 cmd_AddParm(ts, "-cbhash", CMD_FLAG, CMD_OPTIONAL,
958 "vcache hashed by cbExpires");
959 cmd_AddParm(ts, "-vnodes", CMD_FLAG, CMD_OPTIONAL, "afs vnodes");
960 cmd_AddParm(ts, "-buffers", CMD_FLAG, CMD_OPTIONAL,
961 "afs dir buffer cache");
962 cmd_AddParm(ts, "-allocedmem", CMD_FLAG, CMD_OPTIONAL,
964 cmd_AddParm(ts, "-user", CMD_FLAG, CMD_OPTIONAL,
965 "core is from a user-level program");
966 cmd_AddParm(ts, "-bkg", CMD_FLAG, CMD_OPTIONAL, "background daemon info");
967 cmd_AddParm(ts, "-vlru", CMD_FLAG, CMD_OPTIONAL, "vcache lru list");
968 cmd_AddParm(ts, "-callout", CMD_FLAG, CMD_OPTIONAL,
969 "callout info (aix only)");
970 cmd_AddParm(ts, "-dnlc", CMD_FLAG, CMD_OPTIONAL,
971 "DNLC table,freelist,trace");
972 cmd_AddParm(ts, "-dlru", CMD_FLAG, CMD_OPTIONAL, "dcache lru list");
975 cmd_AddParm(ts, "-raw", CMD_FLAG, CMD_OPTIONAL, "show raw values");
976 cmd_AddParm(ts, "-gcpags", CMD_FLAG, CMD_OPTIONAL,
977 "PAG garbage collection info");
978 cmd_AddParm(ts, "-dhash", CMD_FLAG, CMD_OPTIONAL,
979 "show dcache hash chains");
981 code = cmd_Dispatch(argc, argv);
984 #endif /* !AFS_KDUMP_LIB */
987 #ifndef AFS_KDUMP_LIB
989 Knlist(struct afs_nlist *sp, int cnt, int size)
994 code = nlist(obj, sp);
996 code = knlist(sp, cnt, size);
999 #endif /*AFS_KDUMP_LIB */
1002 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
1004 findsym(char *sname, off_t * offset)
1006 #if defined(AFS_SUN5_ENV)
1012 ss_ans = symsrch(sname);
1014 printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
1019 *offset = ss_ans->st_value;
1021 #else /* defined(AFS_SUN5_ENV) */
1022 #if defined(AFS_AIX_ENV)
1024 struct afs_nlist nl;
1026 if (Knlist(&nl, 1, sizeof nl) == -1) {
1027 printf("(WARNING) knlist: couldn't find %s. Proceeding...",
1032 *offset = nl.n_value;
1035 #endif /* defined(AFS_AIX_ENV) */
1037 struct afs_nlist request[2];
1039 memset(request, 0, sizeof request);
1040 request[0].n_name = sname;
1041 if (AFSNLIST(obj, request) < 0) {
1042 fprintf(stderr, "nlist(%s, %s) failure: %d (%s)\n", obj, sname,
1043 errno, strerror(errno));
1046 #if defined(AFS_OSF_ENV)
1050 X = coreadj(request[0].n_value);
1051 request[0].n_value = X;
1053 #endif /* defined(AFS_OSF_ENV) */
1055 *offset = request[0].n_value;
1056 if (!request[0].n_value) {
1057 printf("(WARNING) Couldn't find %s in %s. Proceeding..\n", sname,
1063 #endif /* defined(AFS_SUN5_ENV) */
1067 #define CBHTSIZE 128
1072 #if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
1073 printf("Kdump not supported\n");
1075 int cell, cnt, cnt1;
1076 #ifndef AFS_KDUMP_LIB
1078 kmem = opencore(core);
1080 #endif /* AFS_KDUMP_LIB */
1082 #ifdef KDUMP_RX_LOCK
1083 /* Test to see if kernel is using RX_ENABLE_LOCKS in rx structs. */
1084 #ifdef AFS_SGI53_ENV
1085 #ifdef AFS_SGI64_ENV
1086 use_rx_lock = 1; /* Always using fine gain locking. */
1088 use_rx_lock = (sysmp(MP_NPROCS) > 1) ? 1 : 0;
1090 #endif /* AFS_SGI53_ENV */
1091 #endif /* KDUMP_RX_LOCK */
1093 if (Dcells || Dall) {
1094 print_cells(1); /* Handle the afs_cells structures */
1095 print_cellaliases(1);
1099 if (Dusers || Dall) {
1100 print_users(1); /* Handle the afs_users structs */
1103 if (Dservers || Dall) {
1104 print_servers(1); /* Handle the afs_servers structs */
1108 print_Conns(1); /* Handle the afs_servers structs */
1111 if (Dvols || Dall) {
1112 print_volumes(1); /* Handle the afs_volumes structs */
1115 if (Ddvols || Dall) {
1117 ("\n\nIGNORE reading the 'volumeinfo' file for now (NOT IMPORTANT)!\n");
1120 if (DCallbacks || Dall) {
1121 print_cbHash(1); /* Handle the cbHashT table of queued vcaches */
1124 if (Dvstats || Dall || Dvnodes) {
1125 print_vcaches(1); /* Handle the afs_vcaches structs */
1128 if (Ddstats || Dall) {
1132 if (Dindextimes || Dall) {
1133 print_DindexTimes(1);
1136 if (Dindexflags || Dall) {
1137 print_DindexFlags(1);
1140 if (DdvnextTbl || Dall) {
1141 print_DdvnextTbl(1);
1144 if (DdcnextTbl || Dall) {
1145 print_DdcnextTbl(1);
1148 if (Dbuffers || Dall) {
1156 if (Dstats || Dall) {
1158 struct afs_CMStats afs_cmstats;
1159 struct afs_stats_CMPerf afs_cmperfstats;
1161 printf("\n\nPrinting count references to cm-related functions..\n\n");
1162 findsym("afs_cmstats", &symoff);
1163 kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1164 print_cmstats(&afs_cmstats);
1165 printf("\n\nPrinting some cm struct performance stats..\n\n");
1166 findsym("afs_stats_cmperf", &symoff);
1167 kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1168 print_cmperfstats(&afs_cmperfstats);
1171 if (Dlocks || Dall) {
1172 print_global_locks(kmem);
1174 if (Dglobals || Dall) {
1175 printf("\n\nPrinting Misc afs globals...\n");
1176 print_global_afs_resource(kmem);
1177 print_global_afs_cache(kmem);
1182 if (Dvlru || Dall) {
1185 if (Ddlru || Dall) {
1188 if (Drxstats || Dall) {
1189 print_rxstats(kmem);
1194 #ifndef AFS_KDUMP_LIB
1195 if (Dallocs || Dall) {
1199 if (Dcallout || Dall) {
1200 print_callout(kmem);
1202 if (Ddnlc || Dall) {
1205 if (Dgcpags || Dall) {
1212 #if !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
1213 int Sum_cellnames = 0, Sum_userstp = 0, Sum_volnames = 0, Sum_exps =
1214 0, Sum_nfssysnames = 0;
1215 int Sum_vcachemvids = 0, Sum_vcachelinkData = 0, Sum_vcacheacc =
1216 0, Sum_vcachelocks = 0;
1217 int Sum_cellaliases = 0, Sum_cellname_names = 0;
1220 print_cells(int pnt)
1223 struct cell *cells, cle, *clentry = &cle, *clep;
1225 struct afs_q CellLRU, lru, *vu = &lru, *tq, *uq;
1229 printf("\n\nPrinting Cells' LRU list...\n");
1230 findsym("CellLRU", &symoff);
1231 kread(kmem, symoff, (char *)&CellLRU, sizeof CellLRU);
1232 lru_addr = (u_long) symoff;
1233 for (tq = CellLRU.next; (u_long) tq != lru_addr; tq = uq) {
1235 kread(kmem, (off_t) tq, (char *)vu, sizeof CellLRU);
1237 kread(kmem, (off_t) clep, (char *)clentry, sizeof *clentry);
1238 print_cell(kmem, clentry, clep, pnt);
1242 printf("... found %d 'afs_cells' entries\n", j);
1248 print_cellaliases(int pnt)
1251 struct cell_alias *ca, cae;
1255 printf("\n\nPrinting cell_alias list...\n");
1256 findsym("afs_cellalias_head", &symoff);
1257 kread(kmem, symoff, (char *)&ca, sizeof ca);
1259 char alias[100], cell[100];
1261 kread(kmem, (off_t) ca, (char *)&cae, sizeof cae);
1262 kread(kmem, (off_t) cae.alias, alias, (KDUMP_SIZE_T) 40);
1264 Sum_cellaliases += strlen(alias) + 1;
1265 kread(kmem, (off_t) cae.cell, cell, (KDUMP_SIZE_T) 40);
1267 Sum_cellaliases += strlen(cell) + 1;
1269 printf("%x: alias=%s cell=%s index=%d\n", ca, alias, cell,
1275 printf("... found %d 'cell_alias' entries\n", j);
1281 print_cellnames(int pnt)
1284 struct cell_name *cn, cne;
1288 printf("\n\nPrinting cell_name list...\n");
1289 findsym("afs_cellname_head", &symoff);
1290 kread(kmem, symoff, (char *)&cn, sizeof cn);
1294 kread(kmem, (off_t) cn, (char *)&cne, sizeof cne);
1295 kread(kmem, (off_t) cne.cellname, cellname, (KDUMP_SIZE_T) 40);
1296 cellname[40] = '\0';
1297 Sum_cellname_names += strlen(cellname) + 1;
1299 printf("%x: cellnum=%d cellname=%s used=%d\n", cn, cne.cellnum,
1300 cellname, cne.used);
1305 printf("... found %d 'cell_name' entries\n", j);
1311 print_users(int pnt)
1314 struct unixuser *afs_users[NUSERS], ue, *uentry = &ue, *uep;
1318 printf("\n\nPrinting 'afs_users' structures...\n");
1319 findsym("afs_users", &symoff);
1320 kread(kmem, symoff, (char *)afs_users, sizeof afs_users);
1321 for (i = 0, j = 0; i < NUSERS; i++) {
1322 for (uep = afs_users[i]; uep; uep = uentry->next, j++) {
1323 kread(kmem, (off_t) uep, (char *)uentry, sizeof *uentry);
1324 print_unixuser(kmem, uentry, uep, pnt);
1328 printf("... found %d 'afs_users' entries\n", j);
1332 struct server **serversFound = NULL;
1333 afs_int32 NserversFound = 0;
1334 #define SF_ALLOCATION_STEP 500
1337 add_found_server(struct server *sep)
1339 static afs_int32 NserversAllocated = 0;
1340 static afs_int32 failed = 0;
1345 if (NserversFound >= NserversAllocated) {
1346 NserversAllocated += SF_ALLOCATION_STEP;
1347 if (!serversFound) {
1349 (struct server **)malloc(NserversAllocated *
1350 sizeof(struct server *));
1352 serversFound = realloc(serversFound,
1354 sizeof(struct server *));
1356 if (!serversFound) {
1357 printf("Can't allocate %lu bytes for list of found servers.\n",
1358 NserversAllocated * sizeof(struct server *));
1364 serversFound[NserversFound++] = sep;
1369 find_server(struct server *sep)
1373 for (i = 0; i < NserversFound; i++) {
1374 if (sep == serversFound[i])
1381 print_servers(int pnt)
1384 struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1385 struct srvAddr *afs_srvAddrs[NSERVERS], sa, *sap;
1386 afs_int32 i, nServers, nSrvAddrs, nSrvAddrStructs;
1387 afs_int32 afs_totalServers, afs_totalSrvAddrs;
1389 int chainCount[NSERVERS];
1392 memset(chainCount, 0, sizeof(chainCount));
1393 printf("\n\nPrinting 'afs_servers' structures...\n");
1395 findsym("afs_servers", &symoff);
1396 kread(kmem, symoff, (char *)afs_servers, NSERVERS * sizeof(long));
1397 for (i = 0, nServers = 0; i < NSERVERS; i++) {
1399 printf(" --- Chain %d ---\n", i);
1400 for (sep = afs_servers[i]; sep; sep = sentry->next, nServers++) {
1401 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1402 if (pnt && !failed) {
1403 if (add_found_server(sep) < 0)
1408 if (Dconns || Dall || !pnt)
1409 print_server(kmem, sentry, sep, 1, pnt);
1411 print_server(kmem, sentry, sep, 0, pnt);
1416 printf("... found %d 'afs_servers' entries (total conns = %d)\n",
1419 printf("... found %d 'afs_servers' entries\n", nServers);
1420 printf("Chain lengths:\n");
1421 for (i = 0; i < NSERVERS; i++) {
1422 printf("%2d: %5d\n", i, chainCount[i]);
1428 /* Verify against afs_totalServers. */
1430 memset(chainCount, 0, sizeof(chainCount));
1431 if (findsym("afs_totalServers", &symoff)) {
1432 kread(kmem, symoff, (char *)&afs_totalServers, sizeof(afs_int32));
1433 if (afs_totalServers != nServers) {
1435 ("ERROR: afs_totalServers = %d, differs from # of servers in hash table.\n",
1438 printf("afs_totalServers = %d, matches hash chain count.\n",
1443 printf("\n\nPrinting 'afs_srvAddr' structures...\n");
1444 if (findsym("afs_srvAddrs", &symoff)) {
1445 kread(kmem, symoff, (char *)afs_srvAddrs,
1446 NSERVERS * sizeof(long));
1447 nSrvAddrStructs = 0;
1448 for (i = 0, nSrvAddrs = 0; i < NSERVERS; i++) {
1449 printf(" --- Chain %d ---\n", i);
1450 for (sap = afs_srvAddrs[i]; sap; sap = sa.next_bkt) {
1451 kread(kmem, (off_t) sap, (char *)&sa, sizeof(sa));
1453 ("%lx: sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx\n",
1454 sap, PrintIPAddr(sa.sa_ip), sa.sa_portal,
1455 sa.sa_iprank, sa.sa_flags, sa.conns, sa.server,
1457 if (sap != (struct srvAddr *)sa.server) {
1458 /* only count ones not in a server struct. */
1464 if (!find_server(sa.server)) {
1465 kread(kmem, (off_t) sa.server, (char *)sentry,
1468 ("ERROR: Server missing from hash chain: server=%lx, server->next=%lx\n",
1469 sa.server, sentry->next);
1470 print_server(kmem, sentry, sa.server, 1, pnt);
1472 ("----------------------------------------------------\n");
1479 ("... found %d 'afs_srvAddr' entries, %d alloc'd (not in server struct)\n",
1480 nSrvAddrs, nSrvAddrStructs);
1481 printf("Chain lengths:\n");
1482 for (i = 0; i < NSERVERS; i++) {
1483 printf("%2d: %5d\n", i, chainCount[i]);
1485 if (findsym("afs_totalSrvAddrs", &symoff)) {
1486 kread(kmem, symoff, (char *)&afs_totalSrvAddrs,
1488 if (afs_totalSrvAddrs != nSrvAddrStructs) {
1490 ("ERROR: afs_totalSrvAddrs = %d, differs from number of alloc'd srvAddrs in hash table.\n",
1494 ("afs_totalSrvAddrs = %d, matches alloc'd srvAddrs in hash chain count.\n",
1505 print_Conns(int pnt)
1508 struct server *afs_servers[NSERVERS], se, *sentry = &se, *sep;
1512 printf("\n\nPrinting all 'afs_conns' to the servers...\n");
1513 findsym("afs_servers", &symoff);
1514 kread(kmem, symoff, (char *)afs_servers, sizeof afs_servers);
1515 for (i = 0, j = 0; i < NSERVERS; i++) {
1516 for (sep = afs_servers[i]; sep; sep = sentry->next, j++) {
1517 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
1518 print_server(kmem, sentry, sep, 2, pnt);
1522 printf("... found %d 'afs_conns' entries\n", Nconns);
1527 print_volumes(int pnt)
1530 struct volume *afs_volumes[NVOLS], ve, *ventry = &ve, *vep;
1534 printf("\n\nPrinting 'afs_volumes' structures...\n");
1535 findsym("afs_volumes", &symoff);
1536 kread(kmem, symoff, (char *)afs_volumes, NVOLS * sizeof(long));
1537 for (i = 0, j = 0; i < NVOLS; i++) {
1538 for (vep = afs_volumes[i]; vep; vep = ventry->next, j++) {
1539 kread(kmem, (off_t) vep, (char *)ventry, sizeof *ventry);
1540 print_volume(kmem, ventry, vep, pnt);
1544 printf("... found %d 'afs_volumes' entries\n", j);
1549 print_cbHash(int pnt)
1552 struct afs_q cbHashT[CBHTSIZE];
1556 printf("\n\nPrinting 'cbHashT' table...\n");
1557 findsym("cbHashT", &symoff);
1558 kread(kmem, symoff, (char *)cbHashT, sizeof cbHashT);
1559 for (i = 0; i < CBHTSIZE; i++) {
1561 printf("%lx: %x %x\n", (long)symoff + 8 * i, cbHashT[i].prev,
1565 printf("... that should be %d callback hash entries\n", i);
1569 print_vcaches(int pnt)
1572 struct vcache *afs_vhashTable[VCSIZE], Ve, *Ventry = &Ve, *Vep;
1576 printf("\n\nPrinting afs_vcaches structures...\n");
1578 printf("print_vcaches: sizeof(struct vcache) = %ld\n",
1579 (long)sizeof(struct vcache));
1580 findsym("afs_vhashT", &symoff);
1581 kread(kmem, symoff, (char *)afs_vhashTable, sizeof afs_vhashTable);
1582 for (i = 0, j = 0; i < VCSIZE; i++) {
1584 printf("Printing hash chain %d...\n", i);
1585 for (Vep = afs_vhashTable[i]; Vep; Vep = Ventry->hnext, j++) {
1586 kread(kmem, (off_t) Vep, (char *)Ventry, sizeof *Ventry);
1587 if (Dvstats || Dall || !pnt)
1588 print_vcache(kmem, Ventry, Vep, pnt);
1589 if (Dvnodes || Dall)
1590 print_vnode(kmem, Ventry, Vep, pnt);
1594 printf("... found %d 'afs_vcaches' entries\n", j);
1599 print_dcaches(int pnt)
1603 struct dcache dc, *dcp = &dc, *dp;
1604 afs_int32 i, j, count;
1607 /* Handle the afs_dcaches structs */
1609 printf("\n\nPrinting afs_dcache related structures...\n");
1610 findsym("afs_cacheFiles", &symoff);
1611 kread(kmem, symoff, (char *)&count, sizeof count);
1612 findsym("afs_indexTable", &symoff);
1613 kread(kmem, symoff, (char *)&table, sizeof(long));
1614 ptr = (long *)malloc(count * sizeof(long));
1615 kread(kmem, table, (char *)ptr, count * sizeof(long));
1616 for (i = 0, j = 0; i < count; i++) {
1617 if (dp = (struct dcache *)ptr[i]) {
1619 printf("afs_indexTable[%d] %x: ", i, dp);
1620 kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1621 print_dcache(kmem, dcp, dp, pnt);
1626 printf("... found %d 'dcache' entries\n", j);
1627 findsym("afs_DLRU", &symoff);
1628 kread(kmem, symoff, (char *)&dlru, sizeof(struct afs_q));
1630 printf("DLRU next=0x%x, prev=0x%x\n", dlru.next, dlru.prev);
1638 print_DindexTimes(int pnt)
1643 afs_int32 temp, *indexTime = &temp;
1644 afs_int32 i, j, count;
1646 /* Handle the afs_indexTimes array */
1648 printf("\n\nPrinting afs_indexTimes[]...\n");
1649 findsym("afs_cacheFiles", &symoff);
1650 kread(kmem, symoff, (char *)&count, sizeof count);
1651 findsym("afs_indexTimes", &symoff);
1652 kread(kmem, symoff, (char *)&table, sizeof(long));
1653 ptr = (afs_hyper_t *) malloc(count * sizeof(afs_hyper_t));
1654 kread(kmem, table, (char *)ptr, count * sizeof(afs_hyper_t));
1655 for (i = 0, j = 0; i < count; i++) {
1657 printf("afs_indexTimes[%d]\t%10d.%d\n", i, ptr[i].high,
1659 /* if (dp = (struct dcache *)ptr[i]) {
1660 printf("afs_indexTable[%d] %lx: ", i, dp);
1661 kread(kmem, (off_t) dp, (char *)dcp, sizeof *dcp);
1662 print_dcache(kmem, dcp, dp);
1668 printf("afs_indexTimes has %d entries\n", j);
1674 print_DdvnextTbl(int pnt)
1679 afs_int32 temp, *indexTime = &temp;
1680 afs_int32 i, j, count;
1682 /* Handle the afs_dvnextTbl arrays */
1684 printf("\n\nPrinting afs_dvnextTbl[]...\n");
1685 findsym("afs_cacheFiles", &symoff);
1686 kread(kmem, symoff, (char *)&count, sizeof count);
1687 findsym("afs_dvnextTbl", &symoff);
1688 kread(kmem, symoff, (char *)&table, sizeof(long));
1689 ptr = (afs_int32 *) malloc(count * sizeof(afs_int32));
1690 kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1691 for (i = 0, j = 0; i < count; i++) {
1693 printf("afs_dvnextTbl[%d]\t%d\n", i, ptr[i]);
1697 printf("afs_dvnextTbl has %d entries\n", j);
1703 print_DdcnextTbl(int pnt)
1708 afs_int32 temp, *indexTime = &temp;
1709 afs_int32 i, j, count;
1711 /* Handle the afs_dcnextTbl arrays */
1713 printf("\n\nPrinting afs_dcnextTbl[]...\n");
1714 findsym("afs_cacheFiles", &symoff);
1715 kread(kmem, symoff, (char *)&count, sizeof count);
1716 findsym("afs_dcnextTbl", &symoff);
1717 kread(kmem, symoff, (char *)&table, sizeof(long));
1718 ptr = (afs_int32 *) malloc(count * sizeof(afs_int32));
1719 kread(kmem, table, (char *)ptr, count * sizeof(afs_int32));
1720 for (i = 0, j = 0; i < count; i++) {
1722 printf("afs_dcnextTbl[%d]\t%d\n", i, ptr[i]);
1726 printf("afs_dcnextTbl has %d entries\n", j);
1732 print_DindexFlags(int pnt)
1737 unsigned char *flags;
1738 afs_int32 temp, *indexTime = &temp;
1741 /* Handle the afs_indexFlags array */
1743 printf("\n\nPrinting afs_indexFlags[]...\n");
1744 findsym("afs_cacheFiles", &symoff);
1745 kread(kmem, symoff, (char *)&count, sizeof count);
1746 findsym("afs_indexFlags", &symoff);
1747 kread(kmem, symoff, (char *)&table, sizeof(long));
1748 flags = (unsigned char *)malloc(count * sizeof(char));
1749 kread(kmem, table, flags, count * sizeof(char));
1750 for (i = 0, j = 0; i < count; i++) {
1752 printf("afs_indexFlags[%d]\t%4u\n", i, flags[i]);
1756 printf("afs_indexFlags has %d entries\n", j);
1762 print_buffers(int pnt)
1767 unsigned char *buffers;
1772 printf("\n\nPrinting 'buffers' table...\n");
1773 findsym("Buffers", &symoff);
1774 kread(kmem, symoff, (char *)&table, sizeof(long));
1775 findsym("nbuffers", &symoff);
1776 kread(kmem, symoff, (char *)&count, sizeof(int));
1777 buffers = (unsigned char *)malloc(count * sizeof(struct buffer));
1778 kread(kmem, table, buffers, count * sizeof(struct buffer));
1779 bp = (struct buffer *)buffers;
1780 for (i = 0, j = 0; i < count; i++, bp++) {
1781 #ifdef AFS_SGI62_ENV
1784 ("Buffer #%d:\tfid=%llu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1785 i, bp->fid[0], bp->page, bp->accesstime, bp->hashNext,
1786 bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1790 ("Buffer #%d:\tfid=%lu page=%d, accTime=%d,\n\tHash=%x, data=%x, lockers=%x, dirty=%d, hashI=%d\n",
1791 i, bp->fid, bp->page, bp->accesstime, bp->hashNext,
1792 bp->data, bp->lockers, bp->dirty, bp->hashIndex);
1797 printf("\n\t ... that should be %d buffer entries\n", i);
1805 struct afs_exporter *exp_entry, ex, *exp = &ex, *exp1;
1806 struct nfsclientpag *afs_nfspags[NNFSCLIENTS], e, *entry = &e, *ep;
1809 /* Handle the afs_exporter structures */
1811 printf("\n\nPrinting 'afs_exporters' link list...\n");
1812 findsym("root_exported", &symoff);
1813 kread(kmem, symoff, (char *)&cell, sizeof(long));
1814 for (exp1 = (struct afs_exporter *)cell, j = 0; exp1;
1815 exp1 = exp->exp_next, j++) {
1816 kread(kmem, (off_t) exp1, (char *)exp, sizeof *exp);
1818 printf("AFS_EXPORTER(%x): \n", exp1);
1819 print_exporter(kmem, exp, exp1, pnt);
1823 printf("... found %d 'afs_exporters' entries\n", j);
1825 /* Handle the afs_nfsclientpags structs */
1827 printf("\n\nPrinting 'afs_nfsclientpags' structures...\n");
1828 if (!findsym("afs_nfspags", &symoff))
1830 kread(kmem, symoff, (char *)afs_nfspags, sizeof afs_nfspags);
1831 for (i = 0, j = 0; i < NNFSCLIENTS; i++) {
1832 for (ep = afs_nfspags[i]; ep; ep = entry->next, j++) {
1833 kread(kmem, (off_t) ep, (char *)entry, sizeof *entry);
1834 print_nfsclient(kmem, entry, ep, pnt);
1838 printf("... found %d 'afs_nfsclientpags' entries\n", j);
1842 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
1843 typedef struct event {
1844 struct event *next; /* next in hash chain */
1845 char *event; /* lwp event: an address */
1846 int refcount; /* Is it in use? */
1847 kcondvar_t cond; /* Currently associated condition variable */
1848 int seq; /* Sequence number: this is incremented
1849 * by wakeup calls; wait will not return until
1855 #ifdef AFS_LINUX22_ENV
1856 /* This is replicated from LINUX/osi_alloc.c */
1857 #define MEM_SPACE sizeof(int)
1861 struct osi_linux_mem {
1862 int mem_next; /* types are or'd into low bits of next */
1865 #define MEMTYPE(A) ((A) & 0x3)
1866 #define MEMADDR(A) ((struct osi_linux_mem*)((A) & (~0x3)))
1867 #define PR_MEMTYPE(A) ((MEMTYPE(A) == KM_TYPE) ? "phys" : "virt")
1869 print_alloced_memlist(void)
1872 struct osi_linux_mem *memp, memlist, next;
1877 findsym("afs_linux_memlist_size", &symoff);
1878 kread(kmem, symoff, (char *)&count, sizeof count);
1879 findsym("afs_linux_memlist", &symoff);
1880 kread(kmem, symoff, (char *)&memp, sizeof memp);
1882 #ifdef AFS_LINUX_64BIT_KERNEL
1883 kread(kmem, (unsigned long)memp, (char *)&next, sizeof next);
1885 kread(kmem, (int)memp, (char *)&next, sizeof next);
1886 #endif /* AFS_LINUX_64BIT_KERNEL */
1888 memset(&next, 0, sizeof next);
1890 printf("Allocated memory list: %d elements\n", count);
1891 printf("%20s %4s %10s\n", "Address", "Type", "Next");
1892 printf("%20lx %4s %10x\n", (long)((char *)memp) + MEM_SPACE,
1893 PR_MEMTYPE(next.mem_next), next.mem_next);
1895 while (next_addr = (off_t) MEMADDR(next.mem_next)) {
1898 kread(kmem, next_addr, (char *)&next, sizeof next);
1899 printf("%20lx %4s %10x\n", (long)next_addr + MEM_SPACE,
1900 PR_MEMTYPE(next.mem_next), next.mem_next);
1902 printf("Found %d elements in allocated memory list, expected %d\n", n,
1908 print_allocs(int pnt)
1911 long count, i, j, k, l, m, n, T = 0, tvs;
1912 struct afs_CMStats afs_cmstats;
1913 struct afs_stats_CMPerf afs_cmperfstats;
1915 findsym("afs_cmstats", &symoff);
1916 kread(kmem, symoff, (char *)&afs_cmstats, sizeof afs_cmstats);
1917 findsym("afs_stats_cmperf", &symoff);
1918 kread(kmem, symoff, (char *)&afs_cmperfstats, sizeof afs_cmperfstats);
1921 printf("\n\n%20s:\t%8d bytes\n", "Sysname area", MAXSYSNAME);
1925 j = (i * sizeof(struct cell)) + Sum_cellnames;
1928 ("%20s:\t%8d bytes\t[%d cells/%d bytes each + %d bytes for cell names]\n",
1929 "Cell package", j, i, sizeof(struct cell), Sum_cellnames);
1931 Sum_cellaliases = 0;
1932 i = print_cellaliases(0);
1933 j = (i * sizeof(struct cell_alias)) + Sum_cellaliases;
1936 ("%20s:\t%8d bytes\t[%d cell_aliases/%d bytes each + %d bytes for cell names]\n",
1937 "Cell package", j, i, sizeof(struct cell_alias), Sum_cellaliases);
1939 Sum_cellname_names = 0;
1940 i = print_cellnames(0);
1941 j = (i * sizeof(struct cell_name)) + Sum_cellname_names;
1944 ("%20s:\t%8d bytes\t[%d cell_names/%d bytes each + %d bytes for cell name strings]\n",
1945 "Cell package", j, i, sizeof(struct cell_name), Sum_cellname_names);
1949 j = (i * sizeof(struct unixuser)) + Sum_userstp;
1952 ("%20s:\t%8d bytes\t[%d users/%d bytes each + %d bytes for secret tokens]\n",
1953 "User package", j, i, sizeof(struct unixuser), Sum_userstp);
1955 i = print_servers(0);
1956 j = (i * sizeof(struct server));
1958 printf("%20s:\t%8d bytes\t[%d servers/%d bytes each]\n", "Server package",
1959 j, i, sizeof(struct server));
1960 j = (Nconns * sizeof(struct afs_conn));
1962 printf("%20s:\t%8d bytes\t[%d conns/%d bytes each]\n",
1963 "Connection package", j, Nconns, sizeof(struct afs_conn));
1965 i = (AFS_NCBRS * sizeof(struct afs_cbr)) * (j =
1970 printf("%20s:\t%8d bytes\t[%d cbs/%d bytes each]\n",
1971 "Server CB free pool", i, (j * AFS_NCBRS),
1972 sizeof(struct afs_cbr));
1975 i = print_volumes(0);
1976 j = (MAXVOLS * sizeof(struct volume)) + Sum_volnames;
1979 ("%20s:\t%8d bytes\t[%d volumes/%d bytes each + %d bytes for volnames - %d active entries]\n",
1980 "Volume package", j, MAXVOLS, sizeof(struct volume), Sum_volnames,
1983 Sum_vcachemvids = Sum_vcachelinkData = Sum_vcacheacc = Sum_vcachelocks =
1985 tvs = i = print_vcaches(0);
1986 j = (i * sizeof(struct vcache));
1988 /* printf("%20s:\t%d bytes\t[%d vcaches/%d bytes each]\n", "Vcache package", j, i, sizeof(struct vcache));*/
1989 #ifdef AFS_AIX32_ENV
1990 i = (tvs + Sum_vcachemvids + Sum_vcachelinkData +
1991 Sum_vcachelocks) * AFS_SMALLOCSIZ;
1993 ("%20s:\t%8d bytes\t[%d act gnodes, %d mount pnts, %d symbolic links, %d unix locks]\n",
1994 "[VC use of sml fp]*", i, tvs, Sum_vcachemvids, Sum_vcachelinkData,
1997 i = (Sum_vcachemvids + Sum_vcachelinkData +
1998 Sum_vcachelocks) * AFS_SMALLOCSIZ;
2000 ("%20s:\t8%d bytes\t[%d mount pnts, %d symbolic links, %d unix locks]\n",
2001 "[VC use of sml fp]*", i, Sum_vcachemvids, Sum_vcachelinkData,
2005 #define NAXSs (1000 / sizeof(struct axscache))
2007 i = (NAXSs * sizeof(struct axscache));
2009 printf("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each]\n",
2010 "ACL List free pool", i, Sum_vcacheacc, sizeof(struct axscache));
2013 struct axscache *xp, xpe, *nxp = &xpe;
2015 findsym("afs_xaxscnt", &symoff);
2016 kread(kmem, symoff, (char *)&i, sizeof i);
2017 j = i * (NAXSs * sizeof(struct axscache));
2020 ("%20s:\t%8d bytes\t[%d access used by vcaches/%d bytes each - %d blocks of %d]\n",
2021 "ACL List free pool", j, Sum_vcacheacc, sizeof(struct axscache),
2022 i, (NAXSs * sizeof(struct axscache)));
2027 i = print_dcaches(0);
2028 j = (i * sizeof(struct dcache));
2031 ("%20s:\t%8d bytes\t[%d dcaches/%d bytes each - ONLY USED COUNTED]\n",
2032 "Dcache package", j, i, sizeof(struct dcache));
2034 findsym("afs_dcentries", &symoff);
2035 kread(kmem, symoff, (char *)&i, sizeof i);
2036 j = (i * sizeof(struct dcache));
2038 printf("%20s:\t%8d bytes\t[%d dcaches/%d bytes each]\n", "Dcache package",
2039 j, i, sizeof(struct dcache));
2041 findsym("afs_cacheFiles", &symoff);
2042 kread(kmem, symoff, (char *)&i, sizeof i);
2043 findsym("afs_cacheStats", &symoff);
2044 kread(kmem, symoff, (char *)&j, sizeof j);
2046 k = (j * sizeof(struct vcache));
2048 ("%20s:\t%8d bytes\t[%d free vcaches/%d bytes each - %d active entries]\n",
2049 "Vcache free list", k, j, sizeof(struct vcache), tvs);
2050 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2051 "Dcache Index Table", i * 4, i, 4);
2053 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2054 "Dcache Index Times", i * 8, i, 8);
2056 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2057 "Dcache Index Times", i * 4, i, 4);
2059 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2060 "Dcache Index Flags", i, i, 1);
2061 /* printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Dcache free list", i, i, 1);*/
2063 T += k + (i * 4) + (i * 8) + i;
2065 T += k + (i * 4) + (i * 4) + i;
2068 i = (j = afs_cmperfstats.bufAlloced) * sizeof(struct buffer);
2070 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n", "Buffer package",
2071 i, j, sizeof(struct buffer));
2072 #define AFS_BUFFER_PAGESIZE 2048
2073 i = j * AFS_BUFFER_PAGESIZE;
2075 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2076 "Xtra Buffer pkg area", i, j, AFS_BUFFER_PAGESIZE);
2079 Sum_nfssysnames = 0;
2081 k = Sum_exps * sizeof(struct afs_exporter);
2084 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2085 "Xlator Exporter list", k, Sum_exps,
2086 sizeof(struct afs_exporter));
2088 j = (i * sizeof(struct nfsclientpag)) + Sum_nfssysnames;
2092 ("%20s:\t%8d bytes\t[%d entries/%d bytes each + %d for remote sysnames]\n",
2093 "Xlator Nfs clnt pkg", j, i, sizeof(struct nfsclientpag),
2096 i = (j = afs_cmperfstats.LargeBlocksAlloced) * AFS_LRALLOCSIZ;
2099 ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2100 "Large Free Pool", i, j, AFS_LRALLOCSIZ,
2101 afs_cmperfstats.LargeBlocksActive);
2103 i = (j = afs_cmperfstats.SmallBlocksAlloced) * AFS_SMALLOCSIZ;
2106 ("%20s:\t%8d bytes\t[%d entries/%d bytes each - %d active entries]\n",
2107 "Small Free Pool", i, j, AFS_SMALLOCSIZ,
2108 afs_cmperfstats.SmallBlocksActive);
2110 #if defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV)
2111 findsym("afs_evhashcnt", &symoff);
2112 kread(kmem, symoff, (char *)&j, sizeof j);
2113 i = (j * sizeof(event_t));
2115 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2116 "afs glock Event Pool", i, j, sizeof(event_t));
2117 /* printf("XXXXXXX Count event queue allocs!!!! XXXXXX\n");*/
2121 if (findsym("rxevent_nFree", &symoff))
2122 kread(kmem, symoff, (char *)&j, sizeof j);
2123 if (findsym("rxevent_nPosted", &symoff))
2124 kread(kmem, symoff, (char *)&i, sizeof i);
2125 k = (i + j) * sizeof(struct rxevent);
2128 printf("%20s:\t%8d bytes\t[%d free, %d posted/%d bytes each]\n",
2129 "Rx event pkg", k, j, i, sizeof(struct rxevent));
2131 T += (k = 20 * sizeof(struct rxevent));
2133 ("%20s:\t%8d bytes\t[%d entries/%d bytes each - THIS IS MIN ALLOC/NOT ACTUAL]\n",
2134 "Rx event pkg", k, 20, sizeof(struct rxevent));
2137 findsym("rx_nFreePackets", &symoff);
2138 kread(kmem, symoff, (char *)&count, sizeof count);
2140 findsym("rx_initSendWindow", &symoff);
2141 kread(kmem, symoff, (char *) &i, sizeof i);
2144 findsym("rx_nPackets", &symoff);
2145 kread(kmem, symoff, (char *)&j, sizeof j);
2146 k = (j + i + 2) * sizeof(struct rx_packet);
2148 printf("%20s:\t%8d bytes\t[%d free packets/%d bytes each]\n",
2149 "Rx packet freelist", k, count, sizeof(struct rx_packet));
2150 #define rx_hashTableSize 256 /* XXX */
2151 i = (rx_hashTableSize * sizeof(struct rx_connection *));
2152 j = (rx_hashTableSize * sizeof(struct rx_peer *));
2155 printf("%20s:\t%8d bytes\t[%d entries/%d bytes each]\n",
2156 "Rx conn/peer tables", k, rx_hashTableSize,
2157 sizeof(struct rx_connection *));
2159 findsym("rxi_Alloccnt", &symoff);
2160 kread(kmem, symoff, (char *)&j, sizeof j);
2161 findsym("rxi_Allocsize", &symoff);
2162 kread(kmem, symoff, (char *)&i, sizeof i);
2164 printf("%20s:\t%8d bytes\t[%d outstanding allocs]\n", "RX misc allocs", i,
2168 j = afs_cmperfstats.OutStandingMemUsage;
2169 printf("\n\n%20s:\t%8d bytes\n", "Mem used by afs", j);
2170 printf("%20s:\t%8d bytes\n", "Accounted-for mem", T);
2171 printf("%20s:\t%8d bytes\n", "Non acc'd-for mem", j - T);
2174 ("\n\nNOTE:\n\tAll [...]* entries above aren't counted towards the total mem since they're redundant\n");
2176 #ifdef AFS_LINUX22_ENV
2178 print_alloced_memlist();
2182 #if defined(sparc) && !defined(__linux__)
2184 readmem(kmem, buf, vad, len)
2190 #endif /** AFS_SUN5_ENV **/
2194 if ((newlen = kvm_kread(kd, vad, buf, len)) != len) {
2195 printf("Couldn't process dumpfile with supplied namelist %s\n", obj);
2203 read_addr(int fd, unsigned long addr, unsigned long *val)
2205 if (lseek(fd, addr, SEEK_SET) == -1)
2207 if (read(fd, val, sizeof(long)) != sizeof(long))
2212 static pt_entry_t *ptes = NULL;
2214 addr_to_offset(unsigned long addr, unsigned long *ret, int fd)
2217 pt_entry_t pte, *val;
2220 if (IS_SEG1_VA(addr)) {
2223 unsigned long loc1, loc2[2];
2224 findsym("kernel_pmap", &symoff);
2225 loc1 = coreadj(symoff);
2226 /*printf("ptes=%lx -> %lx\n", symoff, loc1); */
2227 if (lseek(fd, loc1, L_SET /*0 */ ) != loc1) {
2231 if ((i = read(fd, (char *)&loc1, sizeof(long))) != sizeof(long)) {
2232 printf("Read of kerne_map failed\n");
2233 return; /*exit(1); */
2236 /*printf("loc1 %lx -> %lx\n", loc1, loc); */
2237 if (lseek(fd, loc, L_SET /*0 */ ) != loc) {
2242 read(fd, (char *)loc2,
2243 2 * sizeof(long))) != 2 * sizeof(long)) {
2244 printf("Read of kerne_map failed\n");
2245 return; /*exit(1); */
2247 ptes = (pt_entry_t *) loc2[1];
2248 /*printf("ptes=%lx\n", ptes); */
2252 ((unsigned long)(ptes + LEVEL1_PT_OFFSET(addr)),
2253 (unsigned long *)&val, fd))
2255 if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2257 val = ((pt_entry_t *) PTETOPHYS(&pte)) + LEVEL2_PT_OFFSET(addr);
2258 if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2260 val = ((pt_entry_t *) PTETOPHYS(&pte)) + LEVEL3_PT_OFFSET(addr);
2261 if (!read_addr(fd, (unsigned long)val, (unsigned long *)&pte))
2263 *ret = PTETOPHYS(&pte) + (addr & ((1 << PGSHIFT) - 1));
2265 } else if (IS_KSEG_VA(addr)) {
2266 *ret = KSEG_TO_PHYS(addr);
2274 #ifndef AFS_KDUMP_LIB
2276 kread(int kmem, off_t loc, void *buf, KDUMP_SIZE_T len)
2280 memset(buf, 0, len);
2285 i = addr_to_offset(loc, &ret, kmem);
2290 loc1 = coreadj(loc);
2295 #if defined(sparc) && !defined(__linux__)
2296 #ifndef AFS_SUN5_ENV
2299 readmem(kmem, buf, (off_t) loc, len);
2301 #ifndef AFS_SUN5_ENV
2306 #if ! defined(AFS_SUN5_ENV)
2307 #if defined(AFS_SGI61_ENV) && !defined(AFS_32BIT_KERNEL_ENV)
2308 if (lseek64(kmem, loc, L_SET /*0 */ ) != loc)
2310 if (lseek(kmem, loc, L_SET /*0 */ ) != loc)
2317 printf("WARNING: Read failed: loc=0\n");
2319 if ((i = read(kmem, buf, len)) != len) {
2320 printf("WARNING: Read failed: ");
2321 if (sizeof(loc) > sizeof(long)) {
2322 printf("loc=%llx", loc);
2324 printf("loc=%lx", (long)loc);
2326 printf(", buf=%lx, len=%ld, i=%d, errno=%d\n", (long)buf,
2327 (long)len, i, errno);
2328 return; /*exit(1); */
2332 #endif /* AFS_KDUMP_LIB */
2337 * When examining the dump of a 64 bit kernel, we use this function to
2338 * read symbols. The function opencore() calls this or rdsymbols() using
2339 * the macro RDSYMBOLS
2351 Elf64_Sym *stbl, *p1, *p2;
2352 Elf64_Shdr *(*elf_getshdr) (Elf_Scn *) = elf64_getshdr;
2355 Elf32_Sym *stbl, *p1, *p2;
2356 Elf32_Shdr *(*elf_getshdr) (Elf_Scn *) = elf32_getshdr;
2358 Elf_Data *dp = NULL, *sdp = NULL;
2362 if (!(fp = fopen(obj, "r"))) {
2363 printf("Can't open %s (%d)\n", core, errno);
2369 if ((efd = elf_begin(fd, ELF_C_READ, 0)) == NULL) {
2370 printf("Can't elf begin (%d)\n", errno);
2373 while (cn = elf_nextscn(efd, cn)) {
2374 if ((shdr = elf_getshdr(cn)) == NULL) {
2376 printf("Can't read section header (%d)\n", errno);
2379 if (shdr->sh_type == SHT_SYMTAB)
2382 dp = elf_getdata(cn, dp);
2383 p1 = stbl = (void *)dp->d_buf;
2384 nsyms = dp->d_size / sizeof(*stbl);
2385 cn = elf_getscn(efd, shdr->sh_link);
2386 sdp = elf_getdata(cn, sdp);
2387 tblp = malloc(sdp->d_size);
2388 memcpy(tblp, sdp->d_buf, sdp->d_size);
2389 p2 = tbl = malloc(nsyms * sizeof(*stbl));
2390 for (i = 0, scnt = 0; i < nsyms; i++, p1++, p2++) {
2391 p2->st_name = p1->st_name;
2392 p2->st_value = p1->st_value;
2393 p2->st_size = p1->st_size;
2394 p2->st_info = p1->st_info;
2395 p2->st_shndx = p1->st_shndx;
2402 #endif /** AFS_SUN5_ENV **/
2406 opencore(char *core)
2408 #ifdef AFS_KDUMP_LIB
2410 #else /* AFS_KDUMP_LIB */
2413 #if defined(sparc) && !defined(__linux__)
2414 #ifndef AFS_SUN5_ENV
2418 if ((kd = kvm_open(obj, core, NULL, O_RDONLY, "crash")) == NULL) {
2419 printf("Can't open kvm - core file %s\n", core);
2422 #ifndef AFS_SUN5_ENV
2431 if ((fd = open(core, O_RDONLY)) < 0) {
2437 #endif /* AFS_KDUMP_LIB */
2442 print_exporter(int kmem, struct afs_exporter *exporter,
2443 struct afs_exporter *ptr, int pnt)
2446 printf("\tstates=%x, type=%x, *data=%lx\n", exporter->exp_states,
2447 exporter->exp_type, exporter->exp_data);
2449 ("\texp_stats (calls=%d, rejectedcalls=%d, nopag=%d, invalidpag=%d)\n",
2450 exporter->exp_stats.calls, exporter->exp_stats.rejectedcalls,
2451 exporter->exp_stats.nopag, exporter->exp_stats.invalidpag);
2457 print_nfsclient(int kmem, struct nfsclientpag *ep,
2458 struct nfsclientpag *ptr, int pnt)
2464 printf("%lx: uid=%d, host=%x, pag=%x, lastt=%d, ref=%d count=%d\n",
2465 ptr, ep->uid, ep->host, ep->pag,
2466 ep->lastcall, ep->refCount, ep->sysnamecount);
2468 for(count = 0; count < ep->sysnamecount; count++){
2469 kread(kmem, (off_t) ep->sysname[count], sysname, (KDUMP_SIZE_T) 30);
2470 printf(" %lx: @sys[%d]=%s\n",
2471 ep->sysname[count], count, sysname);
2472 Sum_nfssysnames += MAXSYSNAME;
2477 #if defined(AFS_SUN5_ENV)
2479 pmutex(char *sp, kmutex_t *mp)
2486 print_unixuser(int kmem, struct unixuser *uep,
2487 struct unixuser *ptr, int pnt)
2489 Sum_userstp += uep->stLen;
2492 ("%lx: uid=x%x, cell=%x, vid=%d, refc=%d, states=%x, tokTime=%d, tikLen=%d\n",
2493 ptr, uep->uid, uep->cell, uep->vid, uep->refCount, uep->states,
2494 uep->tokenTime, uep->stLen);
2496 ("\tstp=%lx, clearTok[Han=x%x, x<%x,%x,%x,%x,%x,%x,%x,%x>, vid=%d, Bt=%d, Et=%d], exporter=%lx\n",
2497 uep->stp, uep->ct.AuthHandle, uep->ct.HandShakeKey[0],
2498 uep->ct.HandShakeKey[1], uep->ct.HandShakeKey[2],
2499 uep->ct.HandShakeKey[3], uep->ct.HandShakeKey[4],
2500 uep->ct.HandShakeKey[5], uep->ct.HandShakeKey[6],
2501 uep->ct.HandShakeKey[7], uep->ct.ViceId, uep->ct.BeginTimestamp,
2502 uep->ct.EndTimestamp, uep->exporter);
2507 print_cell(int kmem, struct cell *clep, struct cell *ptr, int pnt)
2514 kread(kmem, (off_t) clep->cellName, cellName, (KDUMP_SIZE_T) 40);
2516 Sum_cellnames += strlen(cellName) + 1;
2519 ("%lx: cellname=%s, states=%x, cnum=%d, cindex=%d fsport=%d vlport=%d timeout=%d cnamep=%x\n",
2520 ptr, cellName, clep->states, clep->cellNum, clep->cellIndex,
2521 clep->fsport, clep->vlport, clep->timeout, clep->cnamep);
2524 printf("\tlinked cellp %lx\n", clep->lcellp);
2526 printf("\tCell's servers: ");
2527 for (i = 0; i < AFS_MAXCELLHOSTS; i++) {
2528 if (pretty && (clep->cellHosts[i] == 0))
2530 printf("[%lx] ", clep->cellHosts[i]);
2538 print_server(int kmem, struct server *sep, struct server *ptr, int conns,
2541 struct srvAddr sa, *sap = &sa, *sap1;
2544 if (conns != 2 && pnt) {
2546 ("%lx: cell=%lx, addr=%lx, flags=0x%x, actTime=%x, lastDownS=%x, numDownIn=%d, sumofDownt=%d\n",
2547 ptr, sep->cell, sep->addr, sep->flags, sep->activationTime,
2548 sep->lastDowntimeStart, sep->numDowntimeIncidents,
2549 sep->sumOfDowntimes);
2550 if (sep->flags & SRVR_MULTIHOMED) {
2553 ("\tuuid=[%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x] addr_uniquifier=%x\n",
2554 sep->sr_uuid.time_low, sep->sr_uuid.time_mid,
2555 sep->sr_uuid.time_hi_and_version,
2556 sep->sr_uuid.clock_seq_hi_and_reserved,
2557 sep->sr_uuid.clock_seq_low, sep->sr_uuid.node[0],
2558 sep->sr_uuid.node[1], sep->sr_uuid.node[2],
2559 sep->sr_uuid.node[3], sep->sr_uuid.node[4],
2560 sep->sr_uuid.node[5], sep->sr_addr_uniquifier);
2564 for (j = 0, cnt = 1, sap1 = sep->addr; sap1;
2565 sap1 = sap->next_sa, j++, cnt++) {
2566 kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2570 ("\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",
2571 cnt, sap1, PrintIPAddr(sap->sa_ip), sap->sa_portal,
2572 sap->sa_iprank, sap->sa_flags, sap->conns,
2573 sap->server, sap->next_bkt);
2576 ("\t[sa_ip=%s, sa_port=%d, sa_iprank=%d, sa_flags=%x, conns=%lx, server=%lx, nexth=%lx]\n",
2577 PrintIPAddr(sap->sa_ip), sap->sa_portal,
2578 sap->sa_iprank, sap->sa_flags, sap->conns,
2579 sap->server, sap->next_bkt);
2584 if (sep->cbrs && pnt) {
2585 struct afs_cbr cba, *cbsap = &cba, *cbsap1;
2587 printf(" Callbacks to be returned:\n");
2588 for (j = 0, cbsap1 = sep->cbrs; cbsap1; cbsap1 = cbsap->next, j++) {
2589 kread(kmem, (off_t) cbsap1, (char *)cbsap, sizeof(*cbsap));
2590 printf(" #%2d) %lx [v=%d, n=%d, u=%d]\n", j, cbsap1,
2591 cbsap->fid.Volume, cbsap->fid.Vnode, cbsap->fid.Unique);
2595 for (j = 0, sap1 = sep->addr; sap1; sap1 = sap->next_sa, j++) {
2596 kread(kmem, (off_t) sap1, (char *)sap, sizeof(*sap));
2597 print_conns(kmem, sap1, sap->conns, conns, pnt);
2605 print_conns(int kmem, struct srvAddr *srv, struct afs_conn *conns, int Con,
2608 struct afs_conn *cep, ce, *centry = &ce;
2611 cep = (struct afs_conn *)conns;
2612 if (pnt && Con != 2) {
2614 printf("\tRPC connections for server %lx:\n", srv);
2616 printf("\tNO RPC connections for server %x\n", srv);
2618 for (; cep; cep = centry->next, Nconns++, i++) {
2619 if (pnt && Con != 2)
2620 printf("\t #%d> ", i);
2621 kread(kmem, (off_t) cep, (char *)centry, sizeof *centry);
2622 print_conn(kmem, centry, cep, pnt);
2628 print_conn(int kmem, struct afs_conn *conns, struct afs_conn *ptr, int pnt)
2632 printf("%lx: user=%lx, rx=%lx, srvr=%lx, ref=%d, port=%d, forceC=%d\n",
2633 ptr, conns->user, conns->id, conns->srvr, conns->refCount,
2634 conns->port, conns->forceConnectFS);
2640 print_volume(int kmem, struct volume *vep, struct volume *ptr, int pnt)
2648 loc = (afs_int32 *) & vep->lock;
2650 kread(kmem, (off_t) vep->name, Volname, (KDUMP_SIZE_T) 40);
2651 Sum_volnames += strlen(Volname) + 1;
2655 printf("%lx: cell=%x, vol=%d, name=%s, roVol=%d, backVol=%d\n", ptr,
2656 vep->cell, vep->volume, (vep->name ? Volname : "nil"), vep->roVol,
2660 ("\trwVol=%d, AcTime=%d, copyDate=%d, expTime=%d, vtix=%d, refC=%d, states=%x\n",
2661 vep->rwVol, vep->accessTime, vep->copyDate, vep->expireTime,
2662 vep->vtix, vep->refCount, vep->states);
2665 ("\trwVol=%d, AcTime=%d, copyDate=%d, vtix=%d, refC=%d, states=%x\n",
2666 vep->rwVol, vep->accessTime, vep->copyDate, vep->vtix, vep->refCount,
2669 printf("\tVolume's statuses: ");
2670 for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
2671 printf("[%d] ", vep->status[i]);
2674 printf("\tVolume's servers: ");
2675 for (i = 0; i < AFS_MAXHOSTS && vep->serverHost[i]; i++)
2676 printf("[%lx] ", vep->serverHost[i]);
2679 print_venusfid("\tdotdot", &vep->dotdot);
2682 print_venusfid("\tmtpnt", &vep->mtpoint);
2687 printf("\trootVnode = %d, rootUnique = %d\n", vep->rootVnode,
2690 printf("\tlock=0x%x\n", *loc);
2695 print_venusfid(char *string, struct VenusFid *vid)
2697 printf("%s(c=%x, v=%d, n=%d, u=%d)", string, vid->Cell, vid->Fid.Volume,
2698 vid->Fid.Vnode, vid->Fid.Unique);
2703 print_vnode(int kmem, struct vnode *vep, struct vnode *ptr, int pnt)
2707 struct gnode *save_gnode;
2708 #endif /* AFS_AIX_ENV */
2714 save_gnode = vep->v_gnode;
2715 kread(kmem, (off_t) save_gnode, (char *)&gnode, sizeof(struct gnode));
2716 vep->v_gnode = &gnode;
2717 #endif /* AFS_AIX_ENV */
2720 printf("%x: v_type=%d, v_flag=%d, v_count=%d, \n", ptr, vep->v_type,
2721 vep->v_flag, vep->v_count);
2723 ("\tv_v_stream=%x, v_pages=0x%x, v_mountdhere=%d, v_rdev=%d, v_vfsp=0x%x, v_filocks=0x%x\n",
2724 vep->v_stream, vep->v_pages, vep->v_vfsmountedhere, vep->v_rdev,
2725 vep->v_vfsp, vep->v_filocks);
2726 pmutex("\tVnode", &vep->v_lock);
2727 printf("\tCond v: 0x%x\n", vep->v_cv);
2730 vep->v_gnode = save_gnode;
2731 #endif /* AFS_AIX_ENV */
2732 #ifdef AFS_SGI65_ENV
2733 #if defined(AFS_32BIT_KERNEL_ENV)
2734 printf("%lx: v_mreg=0x%lx", ptr, vep->v_mreg);
2736 printf("%llx: v_mreg=0x%llx", ptr, vep->v_mreg);
2738 printf(", v_mregb=0x%lx\n", vep->v_mregb);
2740 #ifdef AFS_LINUX22_ENV
2741 /* Print out the stat cache and other inode info. */
2743 ("\ti_ino=%d, i_mode=%x, i_nlink=%d, i_uid=%d, i_gid=%d, i_size=%d\n",
2744 vep->i_ino, vep->i_mode, vep->i_nlink, vep->i_uid, vep->i_gid,
2746 #ifdef AFS_LINUX24_ENV
2748 ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2749 vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2750 vep->i_data.nrpages);
2753 ("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n",
2754 vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version,
2757 #ifdef AFS_LINUX26_ENV
2758 printf("\ti_op=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2759 vep->i_rdev, vep->i_sb);
2760 #else /* AFS_LINUX26_ENV */
2761 printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op,
2762 vep->i_dev, vep->i_rdev, vep->i_sb);
2763 #endif /* AFS_LINUX26_ENV */
2764 #ifdef AFS_LINUX24_ENV
2765 #ifdef AFS_PARISC_LINUX24_ENV
2766 printf("\ti_sem: count=%d, wait=0x%x\n", vep->i_sem.count,
2769 printf("\ti_sem: count=%d, sleepers=%d, wait=0x%x\n", vep->i_sem.count,
2770 vep->i_sem.sleepers, vep->i_sem.wait);
2773 printf("\ti_sem: count=%d, waking=%d, wait=0x%x\n", vep->i_sem.count,
2774 vep->i_sem.waking, vep->i_sem.wait);
2776 #ifdef AFS_LINUX26_ENV
2777 printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2778 vep->i_hash.pprev, vep->i_hash.next, vep->i_list.prev,
2779 vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2780 #else /* AFS_LINUX26_ENV */
2781 printf("\ti_hash=0x%x:0x%x, i_list=0x%x:0x%x, i_dentry=0x%x:0x%x\n",
2782 vep->i_hash.prev, vep->i_hash.next, vep->i_list.prev,
2783 vep->i_list.next, vep->i_dentry.prev, vep->i_dentry.next);
2784 #endif /* AFS_LINUX26_ENV */
2785 #endif /* AFS_LINUX22_ENV */
2789 print_vcache(int kmem, struct vcache *vep, struct vcache *ptr, int pnt)
2793 struct VenusFid vid;
2794 struct axscache acc, *accp = &acc, *acp;
2795 struct SimpleLocks sl, *slcp = &sl, *slp;
2799 kread(kmem, (off_t) vep->mvid, (char *)&vid, sizeof(struct VenusFid));
2803 Sum_vcachelinkData++;
2804 loc = (long *)&vep->lock;
2810 printf("%lx: refC=%d, pv=%d, pu=%d, flushDv=%d.%d, mapDV=%d.%d, ",
2811 ptr, VREFCOUNT(vep), vep->parentVnode, vep->parentUnique,
2812 vep->flushDV.high, vep->flushDV.low, vep->mapDV.high,
2814 #ifdef AFS_64BIT_CLIENT
2816 ("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2817 (int)(vep->truncPos >> 32), (int)(vep->truncPos & 0xffffffff),
2818 vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters);
2819 #else /* AFS_64BIT_CLIENT */
2820 printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ",
2821 vep->truncPos, vep->callback, vep->cbExpires, vep->opens,
2822 vep->execsOrWriters);
2823 #endif /* AFS_64BIT_CLIENT */
2824 printf("flcnt=%d, mvstat=%d\n", vep->flockCount, vep->mvstat);
2825 printf("\tstates=x%x, ", vep->states);
2827 printf("vstates=x%x, ", vep->vstates);
2828 #endif /* AFS_SUN5_ENV */
2829 printf("dchint=%x, anyA=0x%x\n", vep->dchint, vep->anyAccess);
2830 #ifdef AFS_64BIT_CLIENT
2832 ("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2833 (int)(vep->m.Length >> 32), (int)(vep->m.Length & 0xffffffff),
2834 vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date,
2835 vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2836 #else /* AFS_64BIT_CLIENT */
2837 printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=%d]\n",
2838 vep->quick.dc, vep->quick.stamp, vep->quick.f,
2839 vep->quick.minLoc, vep->quick.len);
2841 ("\tmstat[len=%d, DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n",
2842 vep->m.Length, vep->m.DataVersion.high, vep->m.DataVersion.low,
2843 vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode,
2845 #endif /* AFS_64BIT_CLIENT */
2848 ("%x: refC=%d, pv=%d, pu=%d, flushDv=%d, mapDV=%d, truncPos=%d\n",
2849 ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique,
2850 vep->flushDV, vep->mapDV, vep->truncPos);
2851 printf("\tcallb=x%x, cbE=%d, opens=%d, XoW=%d, flcnt=%d, mvstat=%d\n",
2852 vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters,
2853 vep->flockCount, vep->mvstat);
2854 printf("\tstates=x%x, dchint=%x, anyA=0x%x\n", vep->states,
2855 vep->h1.dchint, vep->anyAccess);
2857 ("\tmstat[len=%d, DV=%d, Date=%d, Owner=%d, Group=%d, Mode=%d, linkc=%d]\n",
2858 vep->m.Length, vep->m.DataVersion, vep->m.Date, vep->m.Owner,
2859 vep->m.Group, vep->m.Mode, vep->m.LinkCount);
2861 #ifdef AFS_AIX32_ENV
2862 loc = (afs_int32 *) & vep->pvmlock;
2863 printf("\tpvmlock=x%x, segid=%X, credp=%lx\n", *loc, vep->segid,
2867 ("\tlock [wait=%x excl=%x readers=%x #waiting=%x last_reader=%d writer=%d src=%d]\n",
2868 vep->lock.wait_states, vep->lock.excl_locked,
2869 vep->lock.readers_reading, vep->lock.num_waiting,
2870 vep->lock.pid_last_reader, vep->lock.pid_writer,
2871 vep->lock.src_indicator);
2872 print_venusfid("\tfid", &vep->fid);
2875 print_venusfid("mvid", &vid);
2881 printf("\tAccess Link list: %x\n", vep->Access);
2882 for (j = 0, acp = vep->Access; acp; acp = accp->next, j++) {
2883 kread(kmem, (off_t) acp, (char *)accp, sizeof(*accp));
2886 printf("\t %lx: %d) uid=0x%x, access=0x%x, next=%lx\n", acp,
2887 j, accp->uid, accp->axess, accp->next);
2892 printf("\tLocking Link list: %lx\n", vep->slocks);
2896 printf("\tCallbacks queue prev= %lx next= %lx\n", vep->callsort.prev,
2897 vep->callsort.next);
2899 printf("\tvlruq.prev=%lx, vlruq.next=%lx\n", vep->vlruq.prev,
2902 /* For defect 7733 - Print linkData field for symlinks */
2904 if (vep->linkData) {
2905 cloc = (char *)vep->linkData;
2906 printf("\tSymlink information = '");
2908 kread(kmem, (off_t) cloc, &linkchar, (KDUMP_SIZE_T) 1);
2910 if (linkchar == '\0') {
2914 printf("%c", linkchar);
2919 #ifdef AFS_LINUX22_ENV
2920 printf("\tmapcnt=%d\n", vep->mapcnt);
2926 print_dcache(int kmem, struct dcache *dcp, struct dcache *dp, int pnt)
2930 printf("%lx: ", dp);
2931 print_venusfid(" fid", &dcp->f.fid);
2932 printf("refcnt=%d, dflags=%x, mflags=%x, validPos=%d\n", dcp->refCount,
2933 dcp->dflags, dcp->mflags, dcp->validPos);
2936 printf("\tf.modtime=%d, f.versNo=%d.%d\n", dcp->f.modTime,
2937 dcp->f.versionNo.high, dcp->f.versionNo.low);
2939 printf("\tf.hvn=%d, f.hcn=%d, f.modtime=%d, f.versNo=%d\n",
2940 dcp->f.hvNextp, dcp->f.hcNextp, dcp->f.modTime, dcp->f.versionNo);
2942 #ifdef AFS_SGI62_ENV
2944 ("\tf.chunk=%d, f.inode=%" AFS_INT64_FMT ", f.chunkBytes=%d, f.states=%x",
2945 dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
2948 ("\tf.chunk=%d, f.inode=%d, f.chunkBytes=%d, f.states=%x\n",
2949 dcp->f.chunk, dcp->f.inode, dcp->f.chunkBytes, dcp->f.states);
2951 printf("\tlruq.prev=%lx, lruq.next=%lx, index=%d\n",
2952 dcp->lruq.prev, dcp->lruq.next, dcp->index);
2959 struct brequest afs_brs[NBRS], ue, *uentry = &ue, *uep;
2960 afs_int32 count, i, j;
2963 printf("\n\nPrinting some background daemon info...\n\n");
2964 findsym("afs_brsWaiters", &symoff);
2965 kread(kmem, symoff, (char *)&scount, sizeof scount);
2966 printf("Number of processes waiting for bkg daemon %d\n", scount);
2967 findsym("afs_brsDaemons", &symoff);
2968 kread(kmem, symoff, (char *)&scount, sizeof scount);
2969 printf("Number of free bkg daemons %d\n", scount);
2970 findsym("afs_brs", &symoff);
2971 kread(kmem, symoff, (char *)afs_brs, sizeof afs_brs);
2972 printf("Print the current bkg process table\n");
2973 for (i = 0, j = 0; i < NBRS; i++, j++) {
2974 /* kread(kmem, (off_t) afs_brs[i], (char *)uentry, sizeof *uentry);*/
2975 uentry = &afs_brs[i];
2976 if (uentry->refCount == 0)
2979 ("[%d] vcache=0x%lx, cred=0x%lx, code=%d, refCount=%d, opcode=%d, flags=%x [%lx, %lx, %lx, %lx]\n",
2980 i, uentry->vc, uentry->cred, uentry->code, uentry->refCount,
2981 uentry->opcode, uentry->flags, uentry->size_parm[0],
2982 uentry->size_parm[1], uentry->ptr_parm[0], uentry->ptr_parm[1]);
2985 printf("... found %d active 'afs_brs' entries\n", j);
2989 print_vlru(int kmem)
2992 struct vcache Ve, *Ventry = &Ve, *Vep, *tvc;
2993 struct afs_q VLRU, vlru, *vu = &vlru, *tq, *uq;
2994 u_long vlru_addr, l1, l2, l3;
2995 afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
2998 printf("\n\nPrinting vcache VLRU info (oldest first)...\n\n");
2999 findsym("afs_cacheStats", &symoff);
3000 kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
3002 findsym("afs_maxvcount", &symoff);
3003 kread(kmem, symoff, (char *)&maxvcount, sizeof maxvcount);
3004 findsym("afs_vcount", &symoff);
3005 kread(kmem, symoff, (char *)&vcount, sizeof vcount);
3006 findsym("max_vnodes", &symoff);
3007 kread(kmem, symoff, (char *)&nvnode, sizeof nvnode);
3008 printf("max number of vcache entries = %d\n", maxvcount);
3009 printf("number of vcaches in use = %d\n", vcount);
3010 printf("total number of system vnode entries = %d\n", nvnode);
3012 findsym("VLRU", &symoff);
3013 kread(kmem, symoff, (char *)&VLRU, sizeof VLRU);
3014 vlru_addr = (u_long) symoff;
3015 for (tq = VLRU.prev; (u_long) tq != vlru_addr; tq = uq) {
3017 kread(kmem, (off_t) tq, (char *)vu, sizeof VLRU);
3019 kread(kmem, (off_t) tvc, (char *)Ventry, sizeof *Ventry);
3020 print_vcache(kmem, Ventry, tvc, 1);
3023 printf("... found %d active vcache entries in the VLRU\n", j);
3027 print_dlru(int kmem)
3030 struct dcache Ve, *Ventry = &Ve, *Vep, *tdc;
3031 struct afs_q DLRU, dlru, *vu = &dlru, *tq, *uq;
3032 u_long dlru_addr, l1, l2, l3;
3033 afs_int32 count, i, j = 0, maxvcount, vcount, nvnode;
3036 printf("\n\nPrinting vcache DLRU info...\n\n");
3037 findsym("afs_DLRU", &symoff);
3038 kread(kmem, symoff, (char *)&DLRU, sizeof DLRU);
3039 dlru_addr = (u_long) symoff;
3040 for (tq = DLRU.prev; (u_long) tq != dlru_addr; tq = uq) {
3041 tdc = (struct dcache *)tq;
3042 kread(kmem, (off_t) tq, (char *)vu, sizeof DLRU);
3044 kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
3045 print_dcache(kmem, Ventry, tdc, 1);
3048 printf("... found %d active dcache entries in the DLRU\n\n\n", j);
3050 findsym("afs_freeDSList", &symoff);
3051 kread(kmem, symoff, (char *)&dlru_addr, sizeof dlru_addr);
3052 printf("\tfreeDSList link list starts at 0x%x\n", dlru_addr);
3054 for (tdc = (struct dcache *)dlru_addr; tdc;
3055 tdc = (struct dcache *)Ventry->lruq.next) {
3056 kread(kmem, (off_t) tdc, (char *)Ventry, sizeof *Ventry);
3057 print_dcache(kmem, Ventry, tdc, 1);
3059 /* printf("%3d) %x\n", j, tdc);*/
3061 printf("... found %d dcache entries in the freeDSList\n", j);
3065 print_gcpags(int pnt)
3068 afs_int32 afs_gcpags;
3069 afs_int32 afs_gcpags_procsize;
3072 printf("\n\nPrinting GCPAGS structures...\n");
3074 findsym("afs_gcpags", &symoff);
3075 kread(kmem, symoff, (char *)&afs_gcpags, sizeof afs_gcpags);
3077 findsym("afs_gcpags_procsize", &symoff);
3078 kread(kmem, symoff, (char *)&afs_gcpags_procsize,
3079 sizeof afs_gcpags_procsize);
3081 printf("afs_gcpags=%d\n", afs_gcpags);
3082 printf("afs_gcpags_procsize=%d\n", afs_gcpags_procsize);
3089 #include <sys/syspest.h> /* to define the assert and ASSERT macros */
3090 #include <sys/timer.h> /* For the timer related defines */
3091 #include <sys/intr.h> /* for the serialization defines */
3092 #include <sys/malloc.h> /* for the parameters to xmalloc() */
3095 struct tos *toprev; /* previous tos in callout table */
3096 struct tos *tonext; /* next tos in callout table */
3097 struct trb *trb; /* this timer request block */
3103 int ncallo; /* number of callout table elements */
3104 struct tos *head; /* callout table head element */
3109 print_callout(int kmem)
3113 printf("\n\nCallout table doesn't exist for this system\n");
3115 struct callo Co, *Coe = &Co, *Cop;
3116 struct tos To, *Toe = &To, *tos;
3117 struct trb Trb, *Trbe = &Trb, *trb;
3121 printf("\n\nPrinting callout table info...\n\n");
3122 findsym("afs_callo", &symoff);
3123 kread(kmem, symoff, (char *)&Co, sizeof Co);
3124 printf("Number of callouts %d\n", Co.ncallo);
3125 if (Co.ncallo > 0) {
3126 printf("Count\tType\taddr\tfunc\tdata\n");
3127 for (tos = Co.head; tos != NULL; tos = Toe->tonext) {
3129 kread(kmem, (off_t) tos, (char *)&To, sizeof To);
3130 kread(kmem, (off_t) Toe->trb, (char *)&Trb, sizeof Trb);
3131 printf("%d\t%d\t%x\t%x\t%x\n", i, Toe->type, Toe->p1, Trbe->tof,
3139 print_dnlc(int kmem)
3141 struct nc *nameHash[256];
3147 print_global_locks(int kmem)
3171 "afs_xinterface"}, {
3175 printf("\n\nPrinting afs global locks...\n\n");
3176 for (i = 0; locks[i].name; i++) {
3177 findsym(locks[i].name, &symoff);
3178 kread(kmem, symoff, (char *)&count, sizeof count);
3179 printf("%s = 0x%x\n", locks[i].name, count);
3185 print_global_afs_resource(int kmem)
3192 printf("\n\nPrinting some general resource related globals...\n\n");
3193 findsym("afs_setTimeHost", &symoff);
3194 kread(kmem, symoff, (char *)&count, sizeof count);
3195 printf("\tafs_setTimeHost = 0x%x\n", count);
3196 findsym("afs_volCounter", &symoff);
3197 kread(kmem, symoff, (char *)&count, sizeof count);
3198 printf("\tafs_volCounter = 0x%x\n", count);
3199 findsym("afs_cellindex", &symoff);
3200 kread(kmem, symoff, (char *)&count, sizeof count);
3201 printf("\tafs_cellIndex = 0x%x\n", count);
3202 findsym("afs_marinerHost", &symoff);
3203 kread(kmem, symoff, (char *)&count, sizeof count);
3204 printf("\tafs_marinerHost = 0x%x\n", count);
3205 findsym("afs_sysname", &symoff);
3206 kread(kmem, symoff, (char *)&addr, sizeof addr);
3208 printf("\tafs_sysname = %d\n", addr);
3210 kread(kmem, (off_t) addr, sysname, (KDUMP_SIZE_T) 30);
3211 printf("\tafs_sysname = %s\n", sysname);
3213 #ifdef AFS_SGI65_ENV
3214 findsym("afs_ipno", &symoff);
3215 kread(kmem, symoff, (char *)&count, sizeof count);
3216 printf("\tCPU BOARD = IP%d\n", count);
3222 print_global_afs_cache(int kmem)
3227 #ifdef AFS_SGI62_ENV
3234 printf("\n\nPrinting some general cache related globals...\n\n");
3235 findsym("afs_mariner", &symoff);
3236 kread(kmem, symoff, (char *)&count, sizeof count);
3237 printf("\tafs_mariner = 0x%x\n", count);
3239 findsym("freeVCList", &symoff);
3240 kread(kmem, symoff, (char *)&count, sizeof count);
3241 printf("\tafs_freeVCList = 0x%x XXX\n", count);
3243 findsym("afs_freeDCList", &symoff);
3244 kread(kmem, symoff, (char *)&count, sizeof count);
3245 printf("\tfreeDCList = 0x%x\n", count);
3246 findsym("afs_freeDCCount", &symoff);
3247 kread(kmem, symoff, (char *)&count, sizeof count);
3248 printf("\tfreeDCCount = 0x%x (%d)\n", count, count);
3249 findsym("afs_discardDCList", &symoff);
3250 kread(kmem, symoff, (char *)&count, sizeof count);
3251 printf("\tdiscardDCList = 0x%x\n", count);
3252 findsym("afs_discardDCCount", &symoff);
3253 kread(kmem, symoff, (char *)&count, sizeof count);
3254 printf("\tdiscardDCCount = 0x%x (%d)\n", count, count);
3255 findsym("afs_freeDSList", &symoff);
3256 kread(kmem, symoff, (char *)&count, sizeof count);
3257 printf("\tfreeDSList= 0x%x XXXX\n", count);
3258 #ifdef AFS_SGI62_ENV
3259 findsym("cacheInode", &symoff);
3260 kread(kmem, symoff, (char *)&inode, sizeof inode);
3261 printf("\tcacheInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
3262 findsym("volumeInode", &symoff);
3263 kread(kmem, symoff, (char *)&inode, sizeof inode);
3264 printf("\tvolumeInode = 0x%llx (%" AFS_INT64_FMT ")\n", inode, inode);
3266 findsym("cacheInode", &symoff);
3267 kread(kmem, symoff, (char *)&count, sizeof count);
3268 printf("\tcacheInode = 0x%x (%d)\n", count, count);
3269 findsym("volumeInode", &symoff);
3270 kread(kmem, symoff, (char *)&count, sizeof count);
3271 printf("\tvolumeInode = 0x%x (%d)\n", count, count);
3273 findsym("cacheDiskType", &symoff);
3274 kread(kmem, symoff, (char *)&count, sizeof count);
3275 printf("\tcacheDiskType = 0x%x (%d)\n", count, count);
3277 findsym("afs_indexCounter", &symoff);
3278 kread(kmem, symoff, (char *)&h, sizeof(struct afs_hyper_t));
3279 printf("\tafs_indexCounter = 0x%X.%X (%d.%d)\n", h.high, h.low, h.high,
3282 findsym("afs_cacheFiles", &symoff);
3283 kread(kmem, symoff, (char *)&count, sizeof count);
3284 printf("\tafs_cacheFiles = 0x%x (%d)\n", count, count);
3285 findsym("afs_cacheBlocks", &symoff);
3286 kread(kmem, symoff, (char *)&count, sizeof count);
3287 printf("\tafs_cacheBlocks = 0x%x (%d)\n", count, count);
3288 findsym("afs_cacheStats", &symoff);
3289 kread(kmem, symoff, (char *)&count, sizeof count);
3290 printf("\tafs_cacheStats = 0x%x (%d)\n", count, count);
3291 findsym("afs_blocksUsed", &symoff);
3292 kread(kmem, symoff, (char *)&count, sizeof count);
3293 printf("\tafs_blocksUsed = 0x%x (%d)\n", count, count);
3294 findsym("afs_blocksDiscarded", &symoff);
3295 kread(kmem, symoff, (char *)&count, sizeof count);
3296 printf("\tafs_blocksDiscarded = 0x%x (%d)\n", count, count);
3297 findsym("afs_fsfragsize", &symoff);
3298 kread(kmem, symoff, (char *)&count, sizeof count);
3299 printf("\tafs_fsfragsize = 0x%x\n", count);
3300 findsym("afs_WaitForCacheDrain", &symoff);
3301 kread(kmem, symoff, (char *)&count, sizeof count);
3302 printf("\tafs_WaitForCacheDrain = 0x%x (%d)\n", count, count);
3303 findsym("afs_CacheTooFull", &symoff);
3304 kread(kmem, symoff, (char *)&count, sizeof count);
3305 printf("\tafs_CacheTooFull = 0x%x (%d)\n", count, count);
3308 if (findsym("pagCounter", &symoff)) {
3309 kread(kmem, symoff, (char *)&count, sizeof count);
3310 printf("\tpagCounter = 0x%x (%d)\n", count, count);
3312 printf("Ignoring pagCounter\n");
3318 print_rxstats(int kmem)
3323 struct rx_statistics rx_stats;
3325 printf("\n\nPrinting some general RX stats...\n\n");
3326 findsym("rx_stats", &symoff);
3327 kread(kmem, symoff, (char *)&rx_stats, sizeof rx_stats);
3328 printf("\t\tpacketRequests = %d\n", rx_stats.packetRequests);
3329 printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECEIVE,
3330 rx_stats.receivePktAllocFailures);
3331 printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND,
3332 rx_stats.sendPktAllocFailures);
3333 printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SPECIAL,
3334 rx_stats.specialPktAllocFailures);
3335 printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_RECV_CBUF,
3336 rx_stats.receiveCbufPktAllocFailures);
3337 printf("\t\tnoPackets[%d] = %d\n", RX_PACKET_CLASS_SEND_CBUF,
3338 rx_stats.sendCbufPktAllocFailures);
3339 printf("\t\tsocketGreedy = %d\n", rx_stats.socketGreedy);
3340 printf("\t\tbogusPacketOnRead = %d\n", rx_stats.bogusPacketOnRead);
3341 printf("\t\tbogusHost = %d\n", rx_stats.bogusHost);
3342 printf("\t\tnoPacketOnRead = %d\n", rx_stats.noPacketOnRead);
3343 printf("\t\tnoPacketBuffersOnRead = %d\n",
3344 rx_stats.noPacketBuffersOnRead);
3345 printf("\t\tselects = %d\n", rx_stats.selects);
3346 printf("\t\tsendSelects = %d\n", rx_stats.sendSelects);
3347 for (i = 0; i < RX_N_PACKET_TYPES; i++)
3348 printf("\t\tpacketsRead[%d] = %d\n", i, rx_stats.packetsRead[i]);
3349 printf("\t\tdataPacketsRead = %d\n", rx_stats.dataPacketsRead);
3350 printf("\t\tackPacketsRead = %d\n", rx_stats.ackPacketsRead);
3351 printf("\t\tdupPacketsRead = %d\n", rx_stats.dupPacketsRead);
3352 printf("\t\tspuriousPacketsRead = %d\n", rx_stats.spuriousPacketsRead);
3353 for (i = 0; i < RX_N_PACKET_TYPES; i++)
3354 printf("\t\tpacketsSent[%d] = %d\n", i, rx_stats.packetsSent[i]);
3355 printf("\t\tackPacketsSent = %d\n", rx_stats.ackPacketsSent);
3356 printf("\t\tpingPacketsSent = %d\n", rx_stats.pingPacketsSent);
3357 printf("\t\tabortPacketsSent = %d\n", rx_stats.abortPacketsSent);
3358 printf("\t\tbusyPacketsSent = %d\n", rx_stats.busyPacketsSent);
3359 printf("\t\tdataPacketsSent = %d\n", rx_stats.dataPacketsSent);
3360 printf("\t\tdataPacketsReSent = %d\n", rx_stats.dataPacketsReSent);
3361 printf("\t\tdataPacketsPushed = %d\n", rx_stats.dataPacketsPushed);
3362 printf("\t\tignoreAckedPacket = %d\n", rx_stats.ignoreAckedPacket);
3363 printf("\t\ttotalRtt = %d sec, %d usec\n", rx_stats.totalRtt.sec,
3364 rx_stats.totalRtt.usec);
3365 printf("\t\tminRtt = %d sec, %d usec\n", rx_stats.minRtt.sec,
3366 rx_stats.minRtt.usec);
3367 printf("\t\tmaxRtt = %d sec, %d usec\n", rx_stats.maxRtt.sec,
3368 rx_stats.maxRtt.usec);
3369 printf("\t\tnRttSamples = %d\n", rx_stats.nRttSamples);
3370 printf("\t\tnServerConns = %d\n", rx_stats.nServerConns);
3371 printf("\t\tnClientConns = %d\n", rx_stats.nClientConns);
3372 printf("\t\tnPeerStructs = %d\n", rx_stats.nPeerStructs);
3373 printf("\t\tnCallStructs = %d\n", rx_stats.nCallStructs);
3374 printf("\t\tnFreeCallStructs = %d\n", rx_stats.nFreeCallStructs);
3375 printf("\t\tnetSendFailures = %d\n", rx_stats.netSendFailures);
3376 printf("\t\tfatalErrors = %d\n", rx_stats.fatalErrors);
3384 char sysname[100], c;
3385 afs_int32 count, i, ar[100];
3387 struct rx_statistics rx_stats;
3389 printf("\n\nPrinting some RX globals...\n\n");
3390 findsym("rx_extraQuota", &symoff);
3391 kread(kmem, symoff, (char *)&count, sizeof count);
3392 printf("\trx_extraQuota = %d\n", count);
3393 findsym("rx_extraPackets", &symoff);
3394 kread(kmem, symoff, (char *)&count, sizeof count);
3395 printf("\trx_extraPackets = %d\n", count);
3396 findsym("rx_stackSize", &symoff);
3397 kread(kmem, symoff, (char *)&count, sizeof count);
3398 printf("\trx_stackSize = %d\n", count);
3399 findsym("rx_connDeadTime", &symoff);
3400 kread(kmem, symoff, (char *)&count, sizeof count);
3402 printf("\trx_connDeadTime = %d\n", count);
3403 findsym("rx_idleConnectionTime", &symoff);
3404 kread(kmem, symoff, (char *)&count, sizeof count);
3406 printf("\trx_idleConnectionTime = %d\n", count);
3408 findsym("rx_idlePeerTime", &symoff);
3409 kread(kmem, symoff, (char *)&count, sizeof count);
3410 printf("\trx_idlePeerTime = %d\n", count);
3412 findsym("rx_initSendWindow", &symoff);
3413 kread(kmem, symoff, (char *)&count, sizeof count);
3414 printf("\trx_initSendWindow = %d\n", count);
3416 findsym("rxi_nSendFrags", &symoff);
3417 kread(kmem, symoff, (char *)&count, sizeof count);
3418 printf("\trxi_nSendFrags = %d\n", count);
3420 findsym("rx_nPackets", &symoff);
3421 kread(kmem, symoff, (char *)&count, sizeof count);
3423 printf("\trx_nPackets = %d\n", count);
3424 findsym("rx_nFreePackets", &symoff);
3425 kread(kmem, symoff, (char *)&count, sizeof count);
3427 printf("\trx_nFreePackets = %d\n", count);
3428 findsym("rx_socket", &symoff);
3429 kread(kmem, symoff, (char *)&count, sizeof count);
3431 printf("\trx_socket = 0x%x\n", count);
3432 findsym("rx_port", &symoff);
3433 kread(kmem, symoff, (char *)&sm, sizeof sm);
3435 printf("\trx_Port = %d\n", sm);
3436 findsym("rx_packetQuota", &symoff);
3437 kread(kmem, symoff, (char *)ar, sizeof ar);
3439 for (i = 0; i < RX_N_PACKET_CLASSES; i++)
3440 printf("\trx_packetQuota[%d] = %d\n", i, ar[i]);
3441 findsym("rx_nextCid", &symoff);
3442 kread(kmem, symoff, (char *)&count, sizeof count);
3444 printf("\trx_nextCid = 0x%x\n", count);
3445 findsym("rx_epoch", &symoff);
3446 kread(kmem, symoff, (char *)&count, sizeof count);
3448 printf("\trx_epoch = 0u%u\n", count);
3449 findsym("rx_waitingForPackets", &symoff);
3450 kread(kmem, symoff, (char *)&c, sizeof(c));
3452 printf("\trx_waitingForPackets = %x\n", (int)c);
3453 findsym("rxi_nCalls", &symoff);
3454 kread(kmem, symoff, (char *)&count, sizeof count);
3456 printf("\trxi_nCalls = %d\n", count);
3457 findsym("rxi_dataQuota", &symoff);
3458 kread(kmem, symoff, (char *)&count, sizeof count);
3460 printf("\trxi_dataQuota = %d\n", count);
3462 if (findsym("rxi_Alloccnt", &symoff)) {
3463 kread(kmem, symoff, (char *)&count, sizeof count);
3464 printf("\trxi_Alloccnt = %d\n", count);
3467 if (findsym("rxi_Allocsize", &symoff)) {
3468 kread(kmem, symoff, (char *)&count, sizeof count);
3469 printf("\trxi_Allocsize = %d\n", count);
3472 findsym("rxi_availProcs", &symoff);
3473 kread(kmem, symoff, (char *)&count, sizeof count);
3475 printf("\trxi_availProcs = %d\n", count);
3476 findsym("rxi_totalMin", &symoff);
3477 kread(kmem, symoff, (char *)&count, sizeof count);
3479 printf("\trxi_totalMin = %d\n", count);
3480 findsym("rxi_minDeficit", &symoff);
3481 kread(kmem, symoff, (char *)&count, sizeof count);
3483 printf("\trxi_minDeficit = %d\n", count);
3484 print_services(kmem);
3485 #ifdef KDUMP_RX_LOCK
3487 print_peertable_lock(kmem);
3488 print_conntable_lock(kmem);
3489 print_calltable_lock(kmem);
3491 print_peertable(kmem);
3492 print_conntable(kmem);
3493 print_calltable(kmem);
3496 print_peertable(kmem);
3497 print_conntable(kmem);
3498 print_calltable(kmem);
3500 print_eventtable(kmem);
3501 print_rxstats(kmem);
3506 print_services(afs_int32 kmem)
3509 struct rx_service *rx_services[RX_MAX_SERVICES], se, *sentry = &se, *sep;
3511 afs_int32 count, i, j;
3513 findsym("rx_services", &symoff);
3514 kread(kmem, symoff, (char *)rx_services, RX_MAX_SERVICES * sizeof(long));
3516 printf("\n\nPrinting all 'rx_services' structures...\n");
3517 for (i = 0, j = 0; i < RX_MAX_SERVICES; i++) {
3518 if (rx_services[i]) {
3520 kread(kmem, (off_t) rx_services[i], (char *)sentry,
3522 kread(kmem, (off_t) sentry->serviceName, sysname,
3525 ("\t%lx: serviceId=%d, port=%d, serviceName=%s, socket=0x%x\n",
3526 rx_services[i], sentry->serviceId, sentry->servicePort,
3527 sysname, sentry->socket);
3529 ("\t\tnSecObj=%d, nReqRunning=%d, maxProcs=%d, minProcs=%d, connDeadTime=%d, idleDeadTime=%d\n",
3530 sentry->nSecurityObjects, sentry->nRequestsRunning,
3531 sentry->maxProcs, sentry->minProcs, sentry->connDeadTime,
3532 sentry->idleDeadTime);
3535 printf("... found %d 'rx_services' entries in the table\n", j);
3539 #ifdef KDUMP_RX_LOCK
3541 print_peertable_lock(afs_int32 kmem)
3544 struct rx_peer_rx_lock *rx_peerTable[256], se, *sentry = &se, *sep;
3547 findsym("rx_peerHashTable", &symoff);
3548 kread(kmem, symoff, (char *)&count, sizeof(long));
3550 printf("No 'rx_peer' structures found.\n");
3554 kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3555 printf("\n\nPrinting all 'rx_peer' structures...\n");
3556 for (i = 0, j = 0; i < 256; i++) {
3557 for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3558 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3559 printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3561 printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3562 sentry->natMTU, sentry->maxMTU);
3563 printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3564 sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3565 sentry->timeout.usec, sentry->nSent, sentry->reSends);
3566 printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3567 sentry->refCount, sentry->port, sentry->idleWhen);
3569 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3570 sentry->congestionQueue.prev, sentry->congestionQueue.next,
3571 sentry->inPacketSkew, sentry->outPacketSkew);
3572 printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3575 printf("... found %d 'rx_peer' entries in the table\n", j);
3578 #endif /* KDUMP_RX_LOCK */
3580 print_peertable(afs_int32 kmem)
3583 struct rx_peer *rx_peerTable[256], se, *sentry = &se, *sep;
3586 findsym("rx_peerHashTable", &symoff);
3587 kread(kmem, symoff, (char *)&count, sizeof(long));
3589 kread(kmem, count, (char *)rx_peerTable, 256 * sizeof(long));
3590 printf("\n\nPrinting all 'rx_peer' structures...\n");
3591 for (i = 0, j = 0; i < 256; i++) {
3592 for (sep = rx_peerTable[i]; sep; sep = sentry->next, j++) {
3593 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3594 printf("\t%lx: next=0x%lx, host=0x%x, ", sep, sentry->next,
3596 printf("ifMTU=%d, natMTU=%d, maxMTU=%d\n", sentry->ifMTU,
3597 sentry->natMTU, sentry->maxMTU);
3598 printf("\t\trtt=%d:%d, timeout(%d:%d), nSent=%d, reSends=%d\n",
3599 sentry->rtt, sentry->rtt_dev, sentry->timeout.sec,
3600 sentry->timeout.usec, sentry->nSent, sentry->reSends);
3601 printf("\t\trefCount=%d, port=%d, idleWhen=0x%x\n",
3602 sentry->refCount, sentry->port, sentry->idleWhen);
3604 ("\t\tCongestionQueue (0x%x:0x%x), inPacketSkew=0x%x, outPacketSkew=0x%x\n",
3605 sentry->congestionQueue.prev, sentry->congestionQueue.next,
3606 sentry->inPacketSkew, sentry->outPacketSkew);
3607 #ifdef RX_ENABLE_LOCKS
3608 printf("\t\tpeer_lock=%d\n", sentry->peer_lock);
3609 #endif /* RX_ENABLE_LOCKS */
3612 printf("... found %d 'rx_peer' entries in the table\n", j);
3616 #ifdef KDUMP_RX_LOCK
3618 print_conntable_lock(afs_int32 kmem)
3621 struct rx_connection_rx_lock *rx_connTable[256], se, *sentry = &se;
3622 struct rx_connection_rx_lock *sep;
3625 findsym("rx_connHashTable", &symoff);
3626 kread(kmem, symoff, (char *)&count, sizeof(long));
3628 printf("No 'rx_connection' structures found.\n");
3632 kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3633 printf("\n\nPrinting all 'rx_connection' structures...\n");
3634 for (i = 0, j = 0; i < 256; i++) {
3635 for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3636 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3638 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3639 sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3640 printf("\t\tcall[%lx=%d, %lx=%d, %lx=%d, %lx=%d]\n", se.call[0],
3641 se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3642 se.callNumber[2], se.call[3], se.callNumber[3]);
3644 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3645 se.timeout, se.flags, se.type, se.serviceId, se.service,
3648 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3649 se.serial, se.lastSerial, se.secondsUntilDead,
3650 se.secondsUntilPing, se.securityIndex);
3652 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3653 se.error, se.securityObject, se.securityData,
3654 se.securityHeaderSize, se.securityMaxTrailerSize);
3656 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3657 se.challengeEvent, se.lastSendTime, se.maxSerial,
3659 if (se.flags & RX_CONN_MAKECALL_WAITING)
3661 ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3663 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3664 se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3668 printf("... found %d 'rx_connection' entries in the table\n", j);
3670 #endif /* KDUMP_RX_LOCK */
3673 print_conntable(afs_int32 kmem)
3676 struct rx_connection *rx_connTable[256], se, *sentry = &se, *sep;
3679 findsym("rx_connHashTable", &symoff);
3680 kread(kmem, symoff, (char *)&count, sizeof(long));
3682 kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3683 printf("\n\nPrinting all 'rx_connection' structures...\n");
3684 for (i = 0, j = 0; i < 256; i++) {
3685 for (sep = rx_connTable[i]; sep; sep = sentry->next, j++) {
3686 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3688 ("\t%lx: next=0x%lx, peer=0x%lx, epoch=0x%x, cid=0x%x, ackRate=%d\n",
3689 sep, se.next, se.peer, se.epoch, se.cid, se.ackRate);
3690 printf("\t\tcall[%x=%d, %x=%d, %x=%d, %x=%d]\n", se.call[0],
3691 se.callNumber[0], se.call[1], se.callNumber[1], se.call[2],
3692 se.callNumber[2], se.call[3], se.callNumber[3]);
3694 ("\t\ttimeout=%d, flags=0x%x, type=0x%x, serviceId=%d, service=0x%lx, refCount=%d\n",
3695 se.timeout, se.flags, se.type, se.serviceId, se.service,
3698 ("\t\tserial=%d, lastSerial=%d, secsUntilDead=%d, secsUntilPing=%d, secIndex=%d\n",
3699 se.serial, se.lastSerial, se.secondsUntilDead,
3700 se.secondsUntilPing, se.securityIndex);
3702 ("\t\terror=%d, secObject=0x%lx, secData=0x%lx, secHeaderSize=%d, secmaxTrailerSize=%d\n",
3703 se.error, se.securityObject, se.securityData,
3704 se.securityHeaderSize, se.securityMaxTrailerSize);
3706 ("\t\tchallEvent=0x%lx, lastSendTime=0x%x, maxSerial=%d, hardDeadTime=%d\n",
3707 se.challengeEvent, se.lastSendTime, se.maxSerial,
3709 if (se.flags & RX_CONN_MAKECALL_WAITING)
3711 ("\t\t***** Conn in RX_CONN_MAKECALL_WAITING state *****\n");
3712 #ifdef RX_ENABLE_LOCKS
3714 ("\t\tcall_lock=%d, call_cv=%d, data_lock=%d, refCount=%d\n",
3715 se.conn_call_lock, se.conn_call_cv, se.conn_data_lock,
3717 #endif /* RX_ENABLE_LOCKS */
3720 printf("... found %d 'rx_connection' entries in the table\n", j);
3724 #ifdef KDUMP_RX_LOCK
3726 print_calltable_lock(afs_int32 kmem)
3729 struct rx_connection_rx_lock *rx_connTable[256], se;
3730 struct rx_connection_rx_lock *sentry = &se;
3731 struct rx_connection_rx_lock *sep;
3732 long count, i, j, k;
3734 findsym("rx_connHashTable", &symoff);
3735 kread(kmem, symoff, (char *)&count, sizeof(long));
3737 printf("No 'rx_call' structures found.\n");
3741 kread(kmem, count, (char *)rx_connTable, 256 * sizeof(long));
3742 printf("\n\nPrinting all active 'rx_call' structures...\n");
3743 for (i = 0, j = 0; i < 256; i++) {
3744 for (sep = rx_connTable[i]; sep; sep = se.next) {
3745 kread(kmem, (off_t) sep, (char *)sentry, sizeof *sentry);
3746 for (k = 0; k < RX_MAXCALLS; k++) {
3747 struct rx_call_rx_lock ce, *centry = &ce;
3748 struct rx_call_rx_lock *call = se.call[k];
3751 kread(kmem, (off_t) call, (char *)centry, sizeof *centry);
3753 ("\t%lx: conn=0x%lx, qiheader(0x%lx:0x%lx), tq(0x%lx:0x%lx), rq(0x%lx:0x%lx)\n",
3754 call, centry->conn, centry->queue_item_header.prev,
3755 centry->queue_item_header.next, centry->tq.prev,
3756 centry->tq.next, centry->rq.prev, centry->rq.next);
3758 ("\t\t: curvec=%d, curpos=%d, nLeft=%d, nFree=%d, currPacket=0x%lx, callNumber=0x%x\n",
3759 centry->curvec, centry->curpos, centry->nLeft,
3760 centry->nFree, centry->currentPacket,
3761 centry->callNumber);
3763 ("\t\t: channel=%d, state=0x%x, mode=0x%x, flags=0x%x, localStatus=0x%x, remStatus=0x%x\n",
3764 centry->channel, centry->state, centry->mode,
3765 centry->flags, centry->localStatus,
3766 centry->remoteStatus);
3768 ("\t\t: error=%d, timeout=0x%x, rnext=0x%x, rprev=0x%x, rwind=0x%x, tfirst=0x%x, tnext=0x%x\n",
3769 centry->error, centry->timeout, centry->rnext,
3770 centry->rprev, centry->rwind, centry->tfirst,
3773 ("\t\t: twind=%d, resendEvent=0x%lx, timeoutEvent=0x%lx, keepAliveEvent=0x%lx, delayedAckEvent=0x%lx\n",
3774 centry->twind, centry->resendEvent,
3775 centry->timeoutEvent, centry->keepAliveEvent,
3776 centry->delayedAckEvent);
3778 ("\t\t: lastSendTime=0x%x, lastReceiveTime=0x%x, lastAcked=0x%x, startTime=0x%x, startWait=0x%x\n",
3779 centry->lastSendTime, centry->lastReceiveTime,
3780 centry->lastAcked, centry->startTime,
3782 if (centry->flags & RX_CALL_WAIT_PROC)
3784 ("\t\t******** Call in RX_CALL_WAIT_PROC state **********\n");
3785 if (centry->flags & RX_CALL_WAIT_WINDOW_ALLOC)
3787 ("\t\t******** Call in RX_CALL_WAIT_WINDOW_ALLOC state **********\n");
3788 if (centry->flags & RX_CALL_READER_WAIT)
3790 ("\t\t******** Conn in RX_CALL_READER_WAIT state **********\n");
3791 if (centry->flags & RX_CALL_WAIT_PACKETS)
3793 ("\t\t******** Conn in RX_CALL_WAIT_PACKETS state **********\n");
3795 ("\t\t: lock=0x%x, cv_twind=0x%x, cv_rq=0x%x, refCount=%d\n",
3796 centry->lock, centry->cv_twind, centry->cv_rq,
3798 printf("\t\t: MTU=%d\n", centry->MTU);
3803 printf("... found %d 'rx_call' entries in the table\n", j);
3805 #endif /* KDUMP_RX_LOCK */
3808 print_calltable(afs_int32 kmem)