3975 ddi_periodic_add(9F) is entirely rubbish
[illumos-gate.git] / usr / src / cmd / mdb / common / modules / genunix / ddi_periodic.c
blobbeafcb31d8677b7d888a6c7e0df041c06c1f9aa2
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
12 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
15 #include "ddi_periodic.h"
17 #include <mdb/mdb_modapi.h>
18 #include <sys/ddi_periodic.h>
19 #include <sys/sysmacros.h>
20 #include <stdio.h>
22 /*ARGSUSED*/
23 int
24 dprinfo(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
26 char prflags[4];
27 ddi_periodic_impl_t dpr;
28 boolean_t verbose = B_FALSE;
30 if (!(flags & DCMD_ADDRSPEC)) {
31 if (mdb_walk_dcmd("ddi_periodic", "ddi_periodic", argc, argv)
32 == -1) {
33 mdb_warn("cannot walk 'ddi_periodic'");
34 return (DCMD_ERR);
36 return (DCMD_OK);
39 if (mdb_getopts(argc, argv,
40 'v', MDB_OPT_SETBITS, B_TRUE, &verbose, NULL) != argc)
41 return (DCMD_USAGE);
43 if (mdb_vread(&dpr, sizeof (dpr), addr) == -1) {
44 mdb_warn("could not read ddi_periodic_impl_t at %p", addr);
45 return (DCMD_ERR);
48 if (DCMD_HDRSPEC(flags)) {
49 mdb_printf("%16s %4s %3s %5s %5s %12s %s\n", "ADDR", "ID",
50 "LVL", "FLAGS", "MS", "FIRE_COUNT", "HANDLER");
51 if (verbose) {
52 mdb_printf("%16s %16s %16s %s\n", "", "THREAD",
53 "CYCLIC_ID", "ARGUMENT");
57 prflags[0] = dpr.dpr_flags & DPF_DISPATCHED ? 'D' : '-';
58 prflags[1] = dpr.dpr_flags & DPF_EXECUTING ? 'X' : '-';
59 prflags[2] = dpr.dpr_flags & DPF_CANCELLED ? 'C' : '-';
60 prflags[3] = '\0';
62 mdb_printf("%16p %4x %3d %5s %5d %12x %a\n", addr, dpr.dpr_id,
63 dpr.dpr_level, prflags, (int)(dpr.dpr_interval / 1000000),
64 dpr.dpr_fire_count, dpr.dpr_handler);
65 if (verbose) {
66 mdb_printf("%16s %16p %16p %a\n", "", dpr.dpr_thread,
67 dpr.dpr_cyclic_id, dpr.dpr_arg);
70 return (DCMD_OK);