コード例 #1
0
ファイル: ptm.c プロジェクト: drscream/illumos-joyent
static int
ptms_walk_init(mdb_walk_state_t *wsp)
{
	size_t nslots;

	if (wsp->walk_addr != NULL) {
		mdb_warn("ptms supports only global walks");
		return (WALK_ERR);
	}

	if (mdb_readvar(&wsp->walk_addr, "ptms_slots") == -1) {
		mdb_warn("failed to read 'ptms_slots'");
		return (WALK_ERR);
	}

	if (mdb_readvar(&nslots, "ptms_nslots") == -1) {
		mdb_warn("failed to read 'ptms_nslots'");
		return (WALK_ERR);
	}

	/*
	 * We remember the pointer value at the end of the array.  When
	 * the walk gets there, we're done.
	 */
	wsp->walk_arg = (((struct pt_ttys **)wsp->walk_addr) + (nslots - 1));
	wsp->walk_data = mdb_alloc(sizeof (struct pt_ttys), UM_SLEEP);

	return (WALK_NEXT);
}
コード例 #2
0
ファイル: sv.c プロジェクト: AlainODea/illumos-gate
static int
sv_dev_winit(mdb_walk_state_t *wsp)
{
	struct sv_dev_winfo *winfo;
	sv_dev_t *sv_devs;
	int sv_max_devices;

	winfo = mdb_zalloc(sizeof (struct sv_dev_winfo), UM_SLEEP);

	if (mdb_readvar(&sv_devs, "sv_devs") == -1) {
		mdb_warn("failed to read 'sv_devs'");
		mdb_free(winfo,  sizeof (struct sv_dev_winfo));
		return (WALK_ERR);
	}

	if (mdb_readvar(&sv_max_devices, "sv_max_devices") == -1) {
		mdb_warn("failed to read 'sv_max_devices'");
		mdb_free(winfo, sizeof (struct sv_dev_winfo));
		return (WALK_ERR);
	}

	winfo->start = (uintptr_t)sv_devs;
	winfo->end = (uintptr_t)(sv_devs + sv_max_devices);

	if (wsp->walk_addr == NULL)
		wsp->walk_addr = winfo->start;

	wsp->walk_data = winfo;
	return (WALK_NEXT);
}
コード例 #3
0
ファイル: nca.c プロジェクト: andreiw/polaris
/*
 * Initialize a walk for the NCA node fanout tables.  Note that local
 * walks are not supported since they're more trouble than they're
 * worth.
 */
static int
nca_nodef_walk_init(mdb_walk_state_t *wsp)
{
	char		varname[256];
	uint32_t	size;

	if (wsp->walk_addr != 0) {
		mdb_warn("nca_nodef_walk does not support local walks\n");
		return (WALK_DONE);
	}

	if (mdb_readvar(&wsp->walk_addr, wsp->walk_arg) == -1) {
		mdb_warn("cannot read symbol %s", wsp->walk_arg);
		return (WALK_ERR);
	}

	mdb_snprintf(varname, sizeof (varname), "%s_sz", wsp->walk_arg);

	if (mdb_readvar(&size, varname) == -1) {
		mdb_warn("cannot read symbol %s", varname);
		return (WALK_ERR);
	}

	wsp->walk_data = (void *)(uintptr_t)size;

	return (WALK_NEXT);
}
コード例 #4
0
ファイル: sgenv.c プロジェクト: AlainODea/illumos-gate
/*ARGSUSED*/
static int
sgenv_parameters(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	int	mbox_wait_time;
	int	debug_flag;

	int	err;

	if ((flags & DCMD_ADDRSPEC) || argc != 0)
		return (DCMD_USAGE);

	mdb_printf("SGENV tunable parameters:\n");
	mdb_printf("=========================\n");

	err = mdb_readvar(&mbox_wait_time, "sgenv_max_mbox_wait_time");
	if (err != -1) {
		mdb_printf("sgenv_max_mbox_wait_time    = %d seconds\n",
			mbox_wait_time);
	}

	err = mdb_readvar(&debug_flag, "sgenv_debug");
	if (err != -1) {
		mdb_printf("sgenv_debug                 = 0x%x\n", debug_flag);
	}

	return (DCMD_OK);
}
コード例 #5
0
ファイル: configd.c プロジェクト: AlainODea/illumos-gate
/*ARGSUSED*/
static int
configd_status(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	int num_servers;
	int num_started;

	if (argc != 0)
		return (DCMD_USAGE);

	if (mdb_readvar(&num_servers, "num_servers") == -1) {
		mdb_warn("unable to read num_servers");
		return (DCMD_ERR);
	}
	if (mdb_readvar(&num_started, "num_started") == -1) {
		mdb_warn("unable to read num_started");
		return (DCMD_ERR);
	}
	mdb_printf(
	    "\nserver threads:\t%d running, %d starting\n\n", num_servers,
	    num_started - num_servers);

	if (mdb_walk_dcmd("configd_threads", "configd_thread", argc,
	    argv) == -1) {
		mdb_warn("can't walk 'configd_threads'");
		return (DCMD_ERR);
	}
	return (DCMD_OK);
}
コード例 #6
0
ファイル: example1.c プロジェクト: AlainODea/illumos-gate
/*ARGSUSED*/
static int
vminfo(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	vminfo_t vm;

	if ((flags & DCMD_ADDRSPEC) || argc != 0)
		return (DCMD_USAGE);

	if (mdb_readvar(&vm, "vminfo") == -1) {
		/*
		 * If the mdb_warn string does not end in a \n, mdb will
		 * automatically append the reason for the failure.
		 */
		mdb_warn("failed to read vminfo structure");
		return (DCMD_ERR);
	}

	mdb_printf("Cumulative memory statistics:\n");
	mdb_printf("%8llu pages of free memory\n", vm.freemem);
	mdb_printf("%8llu pages of reserved swap\n", vm.swap_resv);
	mdb_printf("%8llu pages of allocated swap\n", vm.swap_alloc);
	mdb_printf("%8llu pages of unreserved swap\n", vm.swap_avail);
	mdb_printf("%8llu pages of unallocated swap\n", vm.swap_free);

	return (DCMD_OK);
}
コード例 #7
0
ファイル: fmd_mdb.c プロジェクト: AlainODea/illumos-gate
static int
case_walk_init(mdb_walk_state_t *wsp)
{
	fmd_module_t mod;
	fmd_case_hash_t ch;
	fmd_t F;

	if (wsp->walk_addr != NULL) {
		if (mdb_vread(&mod, sizeof (mod), wsp->walk_addr) == -1) {
			mdb_warn("failed to read module at %p", wsp->walk_addr);
			return (WALK_ERR);
		}

		wsp->walk_addr = (uintptr_t)mod.mod_cases.l_next;
		return (WALK_NEXT);
	}

	if (mdb_readvar(&F, "fmd") != sizeof (F) ||
	    mdb_vread(&ch, sizeof (ch), (uintptr_t)F.d_cases) != sizeof (ch)) {
		mdb_warn("failed to read fmd meta-data");
		return (WALK_ERR);
	}

	return (hash_walk_init(wsp, (uintptr_t)ch.ch_hash, ch.ch_hashlen,
	    "fmd_case", sizeof (fmd_case_impl_t),
	    OFFSETOF(fmd_case_impl_t, ci_next)));
}
コード例 #8
0
ファイル: mmd.c プロジェクト: mikess/illumos-gate
/* ARGSUSED */
static int
pdesc_slab_print(uintptr_t addr, q_walk_t *qwp, mmd_data_t *data)
{
    pdesc_slab_t *slab;
    uint_t pdslab_sz, slab_sz;

    /* Figure out how many descriptors in a slab */
    mdb_readvar(&pdslab_sz, "pdslab_sz");

    /* This shouldn't be true, unless something awful has happened */
    if (pdslab_sz < 1) {
        mdb_warn("incorrect pdslab_sz (0)");
        pdslab_sz = 1;
    }

    /* Read in the entire slab chunk; may be of use one day */
    slab_sz = PDESC_SLAB_SIZE(pdslab_sz);
    slab = mdb_alloc(slab_sz, UM_SLEEP);

    if (mdb_vread(slab, slab_sz, addr) == -1) {
        mdb_free(slab, slab_sz);
        mdb_warn("failed to read pdesc_slab_t at %p", addr);
        return (WALK_ERR);
    }

    if (!qwp->qw_step)
        mdb_printf("\n%<b>%<u>%-?s %7s %7s%</u>%</b>\n",
                   "PDESC SLAB ADDR", "SIZE", "CLAIMED");

    mdb_printf("%016p %7d %7d\n", addr, slab->pds_sz, slab->pds_used);

    mdb_free(slab, slab_sz);

    return (WALK_NEXT);
}
コード例 #9
0
ファイル: hotplug.c プロジェクト: AlainODea/illumos-gate
int
hotplug(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	devinfo_cb_data_t data;
	uintptr_t devinfo_root;		/* Address of root of devinfo tree */
	ddi_hp_cn_handle_t	hdl;
	char			cn_type[15];
	char			cn_name[15];
	int status;

	data.di_flags = 0;
	if (mdb_getopts(argc, argv,
	    'p', MDB_OPT_SETBITS, DEVINFO_HP_PHYSICAL, &data.di_flags, NULL)
	    != argc)
		return (DCMD_USAGE);

	if (DCMD_HDRSPEC(flags)) {
		mdb_printf("%<u>%?s %?s %-12s %-15s %-15s%</u>\n",
		    "PARENT_DEVINFO", "HANDLE", "STATE", "TYPE", "CN_NAME");
	}

	if ((flags & DCMD_ADDRSPEC) == 0) {
		data.di_flags |= DEVINFO_PARENT | DEVINFO_CHILD;

		if (mdb_readvar(&devinfo_root, "top_devinfo") == -1) {
			mdb_warn("failed to read 'top_devinfo'");
			return (NULL);
		}

		data.di_base = devinfo_root;
		status = mdb_pwalk("devinfo", (mdb_walk_cb_t)hotplug_print,
		    &data, devinfo_root);
		if (status == -1) {
			mdb_warn("couldn't walk devinfo tree");
			return (DCMD_ERR);
		}
		return (DCMD_OK);
	}

	if (mdb_vread(&hdl, sizeof (ddi_hp_cn_handle_t), (uintptr_t)addr)
	    == -1) {
		mdb_warn("Failed to read hdlp!\n");
		return (DCMD_ERR);
	}
	if (mdb_readstr(cn_type, sizeof (cn_type),
	    (uintptr_t)hdl.cn_info.cn_type_str) == -1) {
		mdb_warn("Failed to read cn_type!\n");
		return (DCMD_ERR);
	}
	if (mdb_readstr(cn_name, sizeof (cn_name),
	    (uintptr_t)hdl.cn_info.cn_name) == -1) {
		mdb_warn("Failed to read cn_name!\n");
		return (DCMD_ERR);
	}
	mdb_printf("%?p %?p %-12s %-15s %-15s\n", hdl.cn_dip, addr,
	    ddihp_get_cn_state(hdl.cn_info.cn_state), cn_type, cn_name);

	return (DCMD_OK);
}
コード例 #10
0
ファイル: sv.c プロジェクト: AlainODea/illumos-gate
/* ARGSUSED */
static int
sv(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	clock_t clock;
	int maj, min, mic, baseline, i;

	if (argc != 0)
		return (DCMD_USAGE);

	if (mdb_readvar(&maj, "sv_major_rev") == -1) {
		mdb_warn("unable to read 'sv_major_rev'");
		return (DCMD_ERR);
	}

	if (mdb_readvar(&min, "sv_minor_rev") == -1) {
		mdb_warn("unable to read 'sv_minor_rev'");
		return (DCMD_ERR);
	}

	if (mdb_readvar(&mic, "sv_micro_rev") == -1) {
		mdb_warn("unable to read 'sv_micro_rev'");
		return (DCMD_ERR);
	}

	if (mdb_readvar(&baseline, "sv_baseline_rev") == -1) {
		mdb_warn("unable to read 'sv_baseline_rev'");
		return (DCMD_ERR);
	}

	mdb_printf("SV module version: kernel %d.%d.%d.%d; mdb %d.%d.%d.%d\n",
	    maj, min, mic, baseline,
	    ISS_VERSION_MAJ, ISS_VERSION_MIN, ISS_VERSION_MIC, ISS_VERSION_NUM);
	mdb_inc_indent(4);

	sv_get_print(sv_config_time, "last config time", "0x%lx", clock);
	sv_get_print(sv_stats_on, "stats on", "%d", i);
	sv_get_print(sv_debug, "debug", "%d", i);
	sv_get_print(sv_max_devices, "max sv devices", "%d", i);

	mdb_dec_indent(4);
	return (DCMD_OK);
}
コード例 #11
0
ファイル: unix.c プロジェクト: drscream/illumos-joyent
/*ARGSUSED*/
static int
x86_featureset_cmd(uintptr_t addr, uint_t flags, int argc,
    const mdb_arg_t *argv)
{
	void *fset;
	GElf_Sym sym;
	uintptr_t nptr;
	char name[128];
	int ii;

	size_t sz = sizeof (uchar_t) * BT_SIZEOFMAP(NUM_X86_FEATURES);

	if (argc != 0)
		return (DCMD_USAGE);

	if (mdb_lookup_by_name("x86_feature_names", &sym) == -1) {
		mdb_warn("couldn't find x86_feature_names");
		return (DCMD_ERR);
	}

	fset = mdb_zalloc(sz, UM_NOSLEEP);
	if (fset == NULL) {
		mdb_warn("failed to allocate memory for x86_featureset");
		return (DCMD_ERR);
	}

	if (mdb_readvar(fset, "x86_featureset") != sz) {
		mdb_warn("failed to read x86_featureset");
		mdb_free(fset, sz);
		return (DCMD_ERR);
	}

	for (ii = 0; ii < NUM_X86_FEATURES; ii++) {
		if (!BT_TEST((ulong_t *)fset, ii))
			continue;

		if (mdb_vread(&nptr, sizeof (char *), sym.st_value +
		    sizeof (void *) * ii) != sizeof (char *)) {
			mdb_warn("failed to read feature array %d", ii);
			mdb_free(fset, sz);
			return (DCMD_ERR);
		}

		if (mdb_readstr(name, sizeof (name), nptr) == -1) {
			mdb_warn("failed to read feature %d", ii);
			mdb_free(fset, sz);
			return (DCMD_ERR);
		}
		mdb_printf("%s\n", name);
	}

	mdb_free(fset, sz);
	return (DCMD_OK);
}
コード例 #12
0
ファイル: stmf_sbd.c プロジェクト: mikess/illumos-gate
static int
stmf_sbd_lu_walk_init(mdb_walk_state_t *wsp)
{
    if (wsp->walk_addr == NULL) {
        if (mdb_readvar(&wsp->walk_addr, "sbd_lu_list") == -1) {
            mdb_warn("failed to read sbd_lu_list\n");
            return (WALK_ERR);
        }
    }
    return (WALK_NEXT);
}
コード例 #13
0
ファイル: sysevent.c プロジェクト: AlainODea/illumos-gate
int
sysevent_sent_walk_init(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr == NULL) {
		if (mdb_readvar(&wsp->walk_addr, "log_eventq_sent") == -1) {
			mdb_warn("failed to read 'log_eventq_sent'");
			return (WALK_ERR);
		}
	}
	wsp->walk_data = mdb_alloc(sizeof (log_eventq_t), UM_SLEEP);
	return (WALK_NEXT);
}
コード例 #14
0
ファイル: fcp.c プロジェクト: AlainODea/illumos-gate
static int
fcp_walk_i(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr == NULL &&
	    mdb_readvar(&wsp->walk_addr, "fcp_port_head") == -1) {
		mdb_warn("failed to read 'fcp_port_head'");
		return (WALK_ERR);
	}

	wsp->walk_data = mdb_alloc(sizeof (struct fcp_port), UM_SLEEP);
	return (WALK_NEXT);
}
コード例 #15
0
ファイル: vfs.c プロジェクト: andreiw/polaris
int
vfs_walk_init(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr == NULL &&
	    mdb_readvar(&wsp->walk_addr, "rootvfs") == -1) {
		mdb_warn("failed to read 'rootvfs'");
		return (WALK_ERR);
	}

	wsp->walk_data = (void *)wsp->walk_addr;
	return (WALK_NEXT);
}
コード例 #16
0
ファイル: nca.c プロジェクト: andreiw/polaris
/*
 * Convert from ticks to milliseconds.
 */
static uint64_t
tick2msec(uint64_t tick)
{
	static int tick_per_msec;
	static int msec_per_tick;
	static int once;

	if (once == 0) {
		if (mdb_readvar(&tick_per_msec, "tick_per_msec") == -1) {
			mdb_warn("cannot read symbol tick_per_msec");
			return (0);
		}
		if (mdb_readvar(&msec_per_tick, "msec_per_tick") == -1) {
			mdb_warn("cannot read symbol msec_per_tick");
			return (0);
		}
		once++;
	}

	return (tick_per_msec ? tick / tick_per_msec : tick * msec_per_tick);
}
コード例 #17
0
ファイル: sv.c プロジェクト: AlainODea/illumos-gate
static int
sv_gclient_winit(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr == NULL &&
	    mdb_readvar(&wsp->walk_addr, "sv_gclients") == -1) {
		mdb_warn("unable to read 'sv_gclients'");
		return (WALK_ERR);
	}

	wsp->walk_data = mdb_zalloc(sizeof (sv_gclient_t), UM_SLEEP);

	return (WALK_NEXT);
}
コード例 #18
0
ファイル: ii.c プロジェクト: jimklimov/illumos-gate
/* ARGSUSED */
static int
ii(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
    int maj, min, mic, baseline, i;

    if (argc != 0)
        return (DCMD_USAGE);

    if (mdb_readvar(&maj, "dsw_major_rev") == -1) {
        mdb_warn("unable to read 'dsw_major_rev'");
        return (DCMD_ERR);
    }

    if (mdb_readvar(&min, "dsw_minor_rev") == -1) {
        mdb_warn("unable to read 'dsw_minor_rev'");
        return (DCMD_ERR);
    }

    if (mdb_readvar(&mic, "dsw_micro_rev") == -1) {
        mdb_warn("unable to read 'dsw_micro_rev'");
        return (DCMD_ERR);
    }

    if (mdb_readvar(&baseline, "dsw_baseline_rev") == -1) {
        mdb_warn("unable to read 'dsw_baseline_rev'");
        return (DCMD_ERR);
    }

    mdb_printf("Point-in-Time Copy module version: kernel %d.%d.%d.%d; "
               "mdb %d.%d.%d.%d\n", maj, min, mic, baseline,
               ISS_VERSION_MAJ, ISS_VERSION_MIN, ISS_VERSION_MIC, ISS_VERSION_NUM);

    mdb_inc_indent(4);
    ii_get_print(ii_debug, "debug", "%d", i);
    ii_get_print(ii_bitmap, "bitmaps", "%d", i);
    mdb_dec_indent(4);

    return (DCMD_OK);
}
コード例 #19
0
ファイル: fmd_mdb.c プロジェクト: AlainODea/illumos-gate
static int
mod_walk_init(mdb_walk_state_t *wsp)
{
	fmd_t F;

	if (mdb_readvar(&F, "fmd") != sizeof (F)) {
		mdb_warn("failed to read fmd meta-data");
		return (WALK_ERR);
	}

	wsp->walk_addr = (uintptr_t)F.d_mod_list.l_next;
	return (WALK_NEXT);
}
コード例 #20
0
ファイル: nca.c プロジェクト: andreiw/polaris
/*
 * Initialize a walk for the NCA CPU table.  Note that local walks
 * are not supported since they're more trouble than they're worth.
 */
static int
nca_cpu_walk_init(mdb_walk_state_t *wsp)
{
	int	ncpus;

	if (wsp->walk_addr != 0) {
		mdb_warn("nca_cpu_walk does not support local walks\n");
		return (WALK_DONE);
	}

	if (mdb_readvar(&wsp->walk_addr, "nca_gv") == -1) {
		mdb_warn("cannot read symbol nca_gv");
		return (WALK_ERR);
	}

	if (mdb_readvar(&ncpus, "ncpus") == -1) {
		mdb_warn("cannot read symbol ncpus");
		return (WALK_ERR);
	}
	wsp->walk_data = (void *)(uintptr_t)ncpus;

	return (WALK_NEXT);
}
コード例 #21
0
ファイル: memory.c プロジェクト: AlainODea/illumos-gate
int
swap_walk_init(mdb_walk_state_t *wsp)
{
	void	*ptr;

	if ((mdb_readvar(&ptr, "swapinfo") == -1) || ptr == NULL) {
		mdb_warn("swapinfo not found or invalid");
		return (WALK_ERR);
	}

	wsp->walk_addr = (uintptr_t)ptr;

	return (WALK_NEXT);
}
コード例 #22
0
ファイル: configd.c プロジェクト: AlainODea/illumos-gate
static int
walk_thread_info_init(mdb_walk_state_t *wsp)
{
	if (mdb_readvar(&wsp->walk_addr, "thread_list") == -1) {
		mdb_warn("unable to read thread_list");
		return (WALK_ERR);
	}

	if (mdb_layered_walk("uu_list_node", wsp) == -1) {
		mdb_warn("couldn't walk 'uu_list_node'");
		return (WALK_ERR);
	}

	return (WALK_NEXT);
}
コード例 #23
0
ファイル: apix.c プロジェクト: drscream/illumos-joyent
const mdb_modinfo_t *
_mdb_init(void)
{
	GElf_Sym	sym;

	if (mdb_lookup_by_name("gld_intr", &sym) != -1)
		if (GELF_ST_TYPE(sym.st_info) == STT_FUNC)
			gld_intr_addr = (uintptr_t)sym.st_value;

	if (mdb_readvar(&apic_pir_vect, "apic_pir_vect") == -1) {
		apic_pir_vect = -1;
	}

	return (&modinfo);
}
コード例 #24
0
ファイル: nca.c プロジェクト: andreiw/polaris
/*
 * Initialize a walk for the NCA connection fanout table.  Note that
 * local walks are not supported since they're more trouble than
 * they're worth.
 */
static int
nca_connf_walk_init(mdb_walk_state_t *wsp)
{
	int	fanout_size;

	if (wsp->walk_addr != 0) {
		mdb_warn("nca_connf_walk does not support local walks\n");
		return (WALK_DONE);
	}

	if (mdb_readvar(&wsp->walk_addr, "nca_conn_fanout") == -1) {
		mdb_warn("cannot read symbol nca_conn_fanout");
		return (WALK_ERR);
	}

	if (mdb_readvar(&fanout_size, "nca_conn_fanout_size") == -1) {
		mdb_warn("cannot read symbol nca_conn_fanout_size");
		return (WALK_ERR);
	}

	wsp->walk_data = (void *)(uintptr_t)fanout_size;

	return (WALK_NEXT);
}
コード例 #25
0
ファイル: sv.c プロジェクト: AlainODea/illumos-gate
static int
sv_maj_winit(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr == NULL) {
		if (mdb_readvar(&sv_majors, "sv_majors") == -1) {
			mdb_warn("failed to read 'sv_majors'");
			return (WALK_ERR);
		}
	} else {
		sv_majors[0] = (sv_maj_t *)wsp->walk_addr;
	}

	wsp->walk_addr = (uintptr_t)&sv_majors[0];
	wsp->walk_data = mdb_zalloc(sizeof (sv_maj_t), UM_SLEEP);

	return (WALK_NEXT);
}
コード例 #26
0
ファイル: i86mmu.c プロジェクト: AlainODea/illumos-gate
/*
 * walk the memseg structures
 */
int
memseg_walk_init(mdb_walk_state_t *wsp)
{
	if (wsp->walk_addr != NULL) {
		mdb_warn("memseg only supports global walks\n");
		return (WALK_ERR);
	}

	if (mdb_readvar(&wsp->walk_addr, "memsegs") == -1) {
		mdb_warn("symbol 'memsegs' not found");
		return (WALK_ERR);
	}

	wsp->walk_data = mdb_alloc(sizeof (struct memseg), UM_SLEEP);
	return (WALK_NEXT);

}
コード例 #27
0
ファイル: libuutil.c プロジェクト: AlainODea/illumos-gate
/*ARGSUSED*/
static int
uutil_status(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	pthread_t uu_panic_thread = 0;

	if ((flags & DCMD_ADDRSPEC) || argc != 0)
		return (DCMD_USAGE);

	if (mdb_readvar(&uu_panic_thread, "uu_panic_thread") == -1) {
		mdb_warn("unable to read uu_panic_thread");
	}

	if (uu_panic_thread != 0) {
		mdb_printf("thread %d uu_panicked\n", uu_panic_thread);
	}

	return (DCMD_OK);
}
コード例 #28
0
ファイル: memory.c プロジェクト: AlainODea/illumos-gate
int
memlist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
	struct memlist	ml;

	if (!(flags & DCMD_ADDRSPEC)) {
		uintptr_t ptr;
		uint_t list = 0;
		int i;
		static const char *lists[] = {
			"phys_install",
			"phys_avail",
			"virt_avail"
		};

		if (mdb_getopts(argc, argv,
		    'i', MDB_OPT_SETBITS, (1 << 0), &list,
		    'a', MDB_OPT_SETBITS, (1 << 1), &list,
		    'v', MDB_OPT_SETBITS, (1 << 2), &list, NULL) != argc)
			return (DCMD_USAGE);

		if (!list)
			list = 1;

		for (i = 0; list; i++, list >>= 1) {
			if (!(list & 1))
				continue;
			if ((mdb_readvar(&ptr, lists[i]) == -1) ||
			    (ptr == NULL)) {
				mdb_warn("%s not found or invalid", lists[i]);
				return (DCMD_ERR);
			}

			mdb_printf("%s:\n", lists[i]);
			if (mdb_pwalk_dcmd("memlist", "memlist", 0, NULL,
			    ptr) == -1) {
				mdb_warn("can't walk memlist");
				return (DCMD_ERR);
			}
		}
		return (DCMD_OK);
	}
コード例 #29
0
ファイル: s1394.c プロジェクト: AlainODea/illumos-gate
static int
speedmap_walk_init(mdb_walk_state_t *wsp)
{
	s1394_state_t	*statep;
	s1394_state_t	state;

	if (wsp->walk_addr == NULL) {
		if (mdb_readvar(&statep, "s1394_statep") == -1) {
			mdb_warn("failed to find the s1394_statep pointer");
			return (WALK_ERR);
		}
		if (mdb_vread(&state, sizeof (s1394_state_t),
		    (uintptr_t)statep) == -1) {
			mdb_warn("failed to read the s1394_statep structure");
			return (WALK_ERR);
		}
		wsp->walk_addr = (uintptr_t)state.hal_head;
	}

	return (WALK_NEXT);
}
コード例 #30
0
ファイル: fmd_mdb.c プロジェクト: AlainODea/illumos-gate
static int
tmq_walk_init(mdb_walk_state_t *wsp)
{
	fmd_timerq_t tmq;
	fmd_t F;

	if (wsp->walk_addr == NULL && mdb_readvar(&F, "fmd") != sizeof (F)) {
		mdb_warn("failed to read fmd meta-data");
		return (WALK_ERR);
	}

	if (wsp->walk_addr == NULL)
		wsp->walk_addr = (uintptr_t)F.d_timers;

	if (mdb_vread(&tmq, sizeof (tmq), wsp->walk_addr) != sizeof (tmq)) {
		mdb_warn("failed to read timerq at %p", wsp->walk_addr);
		return (WALK_ERR);
	}

	wsp->walk_addr = (uintptr_t)tmq.tmq_list.l_next;
	return (WALK_NEXT);
}