/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/mdb_modapi.h>
#include <limits.h>
#include <fmd_trace.h>
#include <fmd_module.h>
#include <fmd_thread.h>
#include <fmd_ustat.h>
#include <fmd_event.h>
#include <fmd_case.h>
#include <fmd_buf.h>
#include <fmd_asru.h>
#include <fmd_ckpt.h>
#include <fmd_timerq.h>
#include <fmd_xprt.h>
#include <fmd.h>
typedef struct trwalk_state {
typedef struct hashwalk_data {
const char *hw_name;
void *hw_data;
static int
{
fmd_t F;
mdb_warn("fmd_trace only supports global walks\n");
return (WALK_ERR);
}
if (mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
trwalk_state_t *t;
mdb_warn("failed to read thread at %p "
"(some trace data will be unavailable)", addr);
break;
}
continue; /* no trace buffer allocated for thread */
}
mdb_warn("trace record ptr for t%u is corrupt "
"(some data may be unavailable)\n", t->trw_tid);
}
}
return (WALK_NEXT);
}
static fmd_tracerec_t *
{
else
}
static int
{
int status;
continue;
continue; /* buffer has been emptied */
oldest_t = t;
}
}
if (oldest_time == 0)
return (WALK_DONE);
t = oldest_t;
(void) trwalk_nextrec(t);
return (status);
}
static void
{
trwalk_state_t *t, *u;
u = t->trw_next;
mdb_free(t, sizeof (trwalk_state_t));
}
}
/*ARGSUSED*/
static int
{
if (tid == 0)
return (WALK_NEXT);
mdb_printf("%016llx %04x %-5u %s\n",
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
if (tid == 0)
return (WALK_NEXT);
mdb_printf("%016llx %04x %s: %u\n",
return (WALK_NEXT);
}
static void
{
uint8_t i;
mdb_printf("\n");
}
static int
{
return (status);
}
static int
{
return (status);
}
static int
{
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_printf("TID ");
tid = 0;
}
if (opt_c) {
} else {
}
mdb_warn("failed to walk fmd_trace");
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
if (len == 0) {
mdb_warn("failed to walk hash: invalid hash length\n");
return (WALK_ERR);
}
hwp->hw_hashidx = 0;
return (WALK_NEXT);
}
static int
{
int rv;
else
return (WALK_DONE);
}
mdb_warn("failed to read %s at %p",
return (WALK_ERR);
}
return (rv);
}
static void
{
}
static int
{
return (WALK_ERR);
}
return (hash_walk_init(wsp,
}
static int
{
fmd_stat_t s;
else
return (WALK_DONE);
}
return (WALK_ERR);
}
return (wsp->walk_callback(
}
struct fmd_cmd_data {
int argc;
};
/* ARGSUSED */
static int
{
return (WALK_NEXT);
}
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk 'fmd_module'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
return (DCMD_OK);
}
/* ARGSUSED */
static int
{
}
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
fmd_stat_t s;
if (argc != 0)
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags))
mdb_printf("%<u>%-11s %-4s %-32s %s%</u>\n",
"ADDR", "TYPE", "NAME", "VALUE");
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk 'fmd_module'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
switch (s.fmds_type) {
case FMD_TYPE_BOOL:
break;
case FMD_TYPE_INT32:
break;
case FMD_TYPE_UINT32:
break;
case FMD_TYPE_INT64:
break;
case FMD_TYPE_UINT64:
break;
case FMD_TYPE_STRING:
s.fmds_value.str);
}
break;
case FMD_TYPE_TIME:
break;
case FMD_TYPE_SIZE:
break;
default:
break;
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-4s %-5s %-3s %-?s%</u>\n",
"ADDR", "TYPE", "STATE", "REF", "NVPAIR");
}
case FMD_EVT_PROTOCOL:
break;
case FMD_EVT_GC:
break;
case FMD_EVT_CLOSE:
break;
case FMD_EVT_TIMEOUT:
break;
case FMD_EVT_STATS:
break;
case FMD_EVT_PUBLISH:
break;
case FMD_EVT_TOPO:
break;
default:
}
case FMD_EVS_RECEIVED:
break;
case FMD_EVS_ACCEPTED:
break;
case FMD_EVS_DISCARDED:
break;
case FMD_EVS_DIAGNOSED:
break;
default:
}
mdb_printf("%-11p %-4s %-5s %-3u %p\n",
return (DCMD_OK);
}
static int
{
fmd_t F;
if (mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
fmd_thread_t t;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
if (!(flags & DCMD_ADDRSPEC))
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-11s %-8s %-16s%</u>\n",
"ADDR", "MOD", "TID", "FUNC");
}
mdb_printf("%-11p %-11p %-8u %a\n",
return (DCMD_OK);
}
static int
{
fmd_t F;
if (mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
fmd_module_t m;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
if (!(flags & DCMD_ADDRSPEC))
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-16s %-11s %-4s %-?s %-16s%</u>\n",
"ADDR", "OPS", "DATA", "FLAG", "USTAT", "NAME");
}
return (DCMD_OK);
}
static int
{
fmd_t F;
return (WALK_ERR);
}
return (WALK_NEXT);
}
if (mdb_readvar(&F, "fmd") != sizeof (F) ||
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
"fmd_case", sizeof (fmd_case_impl_t),
}
static int
{
return (hash_walk_step(wsp));
return (WALK_DONE);
return (WALK_ERR);
}
}
static void
{
}
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk fmd_case hash");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-5s %-3s %-?s %-36s%</u>\n",
"ADDR", "STATE", "REF", "DATA", "UUID");
}
case FMD_CASE_UNSOLVED:
break;
case FMD_CASE_SOLVED:
break;
case FMD_CASE_CLOSE_WAIT:
break;
case FMD_CASE_CLOSED:
break;
case FMD_CASE_REPAIRED:
break;
case FMD_CASE_RESOLVED:
break;
default:
}
mdb_printf("%-11p %-5s %-3u %-?p %s\n",
return (DCMD_OK);
}
static int
{
return (WALK_ERR);
}
}
/*ARGSUSED*/
static int
{
fmd_buf_t b;
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-32s %-5s %-?s %s%</u>\n",
"ADDR", "NAME", "FLAGS", "DATA", "SIZE");
}
mdb_printf("%-11p %-32s %-#5x %-?p %lu\n",
return (DCMD_OK);
}
static int
{
return (WALK_ERR);
}
"fmd_serd_eng", sizeof (fmd_serd_eng_t),
}
/* ARGSUSED */
static int
{
}
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk 'fmd_module'");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-11s %-32s %-3s F >%-2s %-16s%</u>\n",
"ADDR", "NAME", "CNT", "N", "T");
}
mdb_printf("%-11p %-32s %-3u %c >%-2u %lluns\n",
return (DCMD_OK);
}
static int
{
fmd_t F;
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_ERR);
}
}
static int
{
fmd_asru_t a;
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk fmd_asru hash");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags))
return (DCMD_OK);
}
static int
{
fmd_t F;
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_ERR);
}
al_rsrc_next)));
}
static int
{
if (!(flags & DCMD_ADDRSPEC)) {
argv) != 0) {
mdb_warn("failed to walk fmd_asru_link hash");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags))
a.al_rsrc_name);
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
fcf_hdr_t h;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC))
addr = 0; /* assume base of file in file target */
return (DCMD_ERR);
}
mdb_printf("fcfh_ident.id_magic = 0x%x, %c, %c, %c\n",
switch (h.fcfh_ident[FCF_ID_MODEL]) {
case FCF_MODEL_ILP32:
mdb_printf("fcfh_ident.id_model = ILP32\n");
break;
case FCF_MODEL_LP64:
mdb_printf("fcfh_ident.id_model = LP64\n");
break;
default:
mdb_printf("fcfh_ident.id_model = 0x%x\n",
h.fcfh_ident[FCF_ID_MODEL]);
}
switch (h.fcfh_ident[FCF_ID_ENCODING]) {
case FCF_ENCODE_LSB:
mdb_printf("fcfh_ident.id_encoding = LSB\n");
break;
case FCF_ENCODE_MSB:
mdb_printf("fcfh_ident.id_encoding = MSB\n");
break;
default:
mdb_printf("fcfh_ident.id_encoding = 0x%x\n",
}
mdb_printf("fcfh_ident.id_version = %u\n",
h.fcfh_ident[FCF_ID_VERSION]);
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
static const char *const types[] = {
"none", /* FCF_SECT_NONE */
"strtab", /* FCF_SECT_STRTAB */
"module", /* FCF_SECT_MODULE */
"case", /* FCF_SECT_CASE */
"bufs", /* FCF_SECT_BUFS */
"buffer", /* FCF_SECT_BUFFER */
"serd", /* FCF_SECT_SERD */
"events", /* FCF_SECT_EVENTS */
"nvlists", /* FCF_SECT_NVLISTS */
};
fcf_sec_t s;
if (!(flags & DCMD_ADDRSPEC))
mdb_printf("%<u>%?s %-10s %-5s %-5s %-5s %-6s %-5s%</u>\n",
"ADDR", "TYPE", "ALIGN", "FLAGS", "ENTSZ", "OFF", "SIZE");
}
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk fcf_sec");
return (DCMD_ERR);
}
return (DCMD_OK);
}
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
else
return (DCMD_OK);
}
static int
{
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
if (i >= hp->fcfh_secnum)
return (WALK_DONE);
}
static void
{
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
mdb_printf("fcfe_todsec = %llu (%Y)\n",
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
fmd_t F;
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
fmd_timer_t t;
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk fmd_timerq");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-8s %-20s %-4s %-18s %-8s %s%</u>\n",
"ADDR", "MODULE", "ID", "HRTIME", "ARG", "FUNC");
}
mdb_printf("%-8p %-20s %4d 0x%-16llx %-8p %s\n",
return (DCMD_OK);
}
static int
{
fmd_module_t m;
mdb_warn("transport walker requires fmd_module_t address\n");
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
mdb_warn("failed to read fmd_xprt_class_hash at %p",
return (WALK_ERR);
}
"fmd_xprt_class", sizeof (fmd_xprt_class_t),
}
/*ARGSUSED*/
static int
{
return (WALK_NEXT);
}
static int
{
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("failed to walk fmd_xprt");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%<u>%-8s %-4s %-4s %-5s %s%</u>\n",
"ADDR", "ID", "VERS", "FLAGS", "STATE");
}
mdb_printf("%-8p %-4d %-4u %-5x %a\n",
(void) mdb_inc_indent(4);
mdb_printf("Local subscriptions requested by peer:\n");
(void) mdb_dec_indent(4);
}
(void) mdb_inc_indent(4);
mdb_printf("Remote subscriptions requested of peer:\n");
(void) mdb_dec_indent(4);
}
(void) mdb_inc_indent(4);
mdb_printf("Pending unsubscription acknowledgements:\n");
(void) mdb_dec_indent(4);
}
return (DCMD_OK);
}
static int
{
fmd_t F;
if (mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
fmd_module_t m;
mdb_warn("NULL fmd_module_t passed in");
return (WALK_ERR);
}
return (WALK_ERR);
}
!= sizeof (eq)) {
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
{ NULL }
};
{ "fcf_sec", "walk FCF section header table given header address",
{ "fmd_trace", "walk per-thread trace buffers",
{ "fmd_ustat", "walk per-collection statistics",
{ "fmd_thread", "walk list of all fmd_thread_t's",
{ "fmd_module", "walk list of all fmd_module_t's",
{ "fmd_case", "walk per-module case objects",
{ "fmd_buf", "walk per-buf_hash buffers",
{ "fmd_serd", "walk per-serd_hash engines",
{ "fmd_asru", "walk asru resource hash",
{ "fmd_asru_link", "walk resource hash",
{ "fmd_timerq", "walk timer queue",
{ "fmd_xprt", "walk per-module list of transports",
{ "fmd_xprt_class", "walk hash table of subscription classes",
{ "fmd_topo", "walk fmd's list of topo snapshots",
{ "fmd_mod_queue", "walk per-module event queue",
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}