10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
52747Sbustos * Common Development and Distribution License (the "License").
62747Sbustos * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate /*
22*12967Sgavin.maltby@oracle.com * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate */
240Sstevel@tonic-gate
250Sstevel@tonic-gate #include <mdb/mdb_modapi.h>
260Sstevel@tonic-gate
270Sstevel@tonic-gate #include <libuutil.h>
280Sstevel@tonic-gate #include <libuutil_impl.h>
290Sstevel@tonic-gate
300Sstevel@tonic-gate #include <librestart_priv.h> /* instance_data_t */
310Sstevel@tonic-gate #include <startd.h>
320Sstevel@tonic-gate
330Sstevel@tonic-gate
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate * To count the elements of a uu_list_t without knowing its implementation, we
360Sstevel@tonic-gate * must walk & count them.
370Sstevel@tonic-gate */
380Sstevel@tonic-gate /* ARGSUSED */
390Sstevel@tonic-gate static int
inc_sz(uintptr_t addr,const void * unknown,void * data)400Sstevel@tonic-gate inc_sz(uintptr_t addr, const void *unknown, void *data)
410Sstevel@tonic-gate {
420Sstevel@tonic-gate size_t *sz = data;
430Sstevel@tonic-gate
440Sstevel@tonic-gate ++(*sz);
450Sstevel@tonic-gate
460Sstevel@tonic-gate return (WALK_NEXT);
470Sstevel@tonic-gate }
480Sstevel@tonic-gate
490Sstevel@tonic-gate /*ARGSUSED*/
500Sstevel@tonic-gate static int
startd_status(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)510Sstevel@tonic-gate startd_status(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
520Sstevel@tonic-gate {
530Sstevel@tonic-gate uu_list_t *dgraphp;
540Sstevel@tonic-gate restarter_instance_list_t ril;
550Sstevel@tonic-gate u_longlong_t ns_total;
560Sstevel@tonic-gate u_longlong_t lookups;
570Sstevel@tonic-gate u_longlong_t dep_inserts, dep_cycle_ns, dep_insert_ns;
580Sstevel@tonic-gate size_t graph_num, restarter_num;
59*12967Sgavin.maltby@oracle.com uint64_t ct_maint;
60*12967Sgavin.maltby@oracle.com uint64_t ct_hwerr;
61*12967Sgavin.maltby@oracle.com uint64_t ct_service;
62*12967Sgavin.maltby@oracle.com uint64_t ct_global;
63*12967Sgavin.maltby@oracle.com uint64_t ct_noprefs;
64*12967Sgavin.maltby@oracle.com uint64_t ct_from_uninit;
65*12967Sgavin.maltby@oracle.com uint64_t ct_bad_state;
66*12967Sgavin.maltby@oracle.com uint64_t ct_ovr_prefs;
670Sstevel@tonic-gate
680Sstevel@tonic-gate if (mdb_readvar(&lookups, "dictionary_lookups") == -1) {
690Sstevel@tonic-gate mdb_warn("failed to read 'dictionary_lookups' value\n");
700Sstevel@tonic-gate return (DCMD_ERR);
710Sstevel@tonic-gate }
720Sstevel@tonic-gate
730Sstevel@tonic-gate if (mdb_readvar(&ns_total, "dictionary_ns_total") == -1) {
740Sstevel@tonic-gate mdb_warn("failed to read 'dictionary_ns_total' value\n");
750Sstevel@tonic-gate return (DCMD_ERR);
760Sstevel@tonic-gate }
770Sstevel@tonic-gate
780Sstevel@tonic-gate if (mdb_readvar(&dep_inserts, "dep_inserts") == -1) {
790Sstevel@tonic-gate mdb_warn("failed to read 'dep_inserts' value\n");
800Sstevel@tonic-gate return (DCMD_ERR);
810Sstevel@tonic-gate }
820Sstevel@tonic-gate
830Sstevel@tonic-gate if (mdb_readvar(&dep_cycle_ns, "dep_cycle_ns") == -1) {
840Sstevel@tonic-gate mdb_warn("failed to read 'dep_cycle_ns' value\n");
850Sstevel@tonic-gate return (DCMD_ERR);
860Sstevel@tonic-gate }
870Sstevel@tonic-gate
880Sstevel@tonic-gate if (mdb_readvar(&dep_insert_ns, "dep_insert_ns") == -1) {
890Sstevel@tonic-gate mdb_warn("failed to read 'dep_insert_ns' value\n");
900Sstevel@tonic-gate return (DCMD_ERR);
910Sstevel@tonic-gate }
920Sstevel@tonic-gate
930Sstevel@tonic-gate if (mdb_readvar(&dgraphp, "dgraph") == -1) {
940Sstevel@tonic-gate mdb_warn("failed to read 'dgraph' value\n");
950Sstevel@tonic-gate return (DCMD_ERR);
960Sstevel@tonic-gate }
970Sstevel@tonic-gate
980Sstevel@tonic-gate graph_num = 0;
990Sstevel@tonic-gate if (mdb_pwalk("uu_list_node", inc_sz, &graph_num,
1000Sstevel@tonic-gate (uintptr_t)dgraphp) == -1) {
1010Sstevel@tonic-gate mdb_warn("failed to read uu_list\n");
1020Sstevel@tonic-gate return (DCMD_ERR);
1030Sstevel@tonic-gate }
1040Sstevel@tonic-gate
1050Sstevel@tonic-gate if (mdb_readvar(&ril, "instance_list") == -1) {
1060Sstevel@tonic-gate mdb_warn("failed to read 'instance_list' value\n");
1070Sstevel@tonic-gate return (DCMD_ERR);
1080Sstevel@tonic-gate }
1090Sstevel@tonic-gate
1100Sstevel@tonic-gate restarter_num = 0;
1110Sstevel@tonic-gate if (mdb_pwalk("uu_list_node", inc_sz, &restarter_num,
1120Sstevel@tonic-gate (uintptr_t)ril.ril_instance_list) == -1) {
1130Sstevel@tonic-gate mdb_warn("failed to read uu_list\n");
1140Sstevel@tonic-gate return (DCMD_ERR);
1150Sstevel@tonic-gate }
1160Sstevel@tonic-gate
117*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_maint, "stev_ct_maint") == -1) {
118*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_maint'\n");
119*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
120*12967Sgavin.maltby@oracle.com }
121*12967Sgavin.maltby@oracle.com
122*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_hwerr, "stev_ct_hwerr") == -1) {
123*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_hwerr'\n");
124*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
125*12967Sgavin.maltby@oracle.com }
126*12967Sgavin.maltby@oracle.com
127*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_service, "stev_ct_service") == -1) {
128*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_service'\n");
129*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
130*12967Sgavin.maltby@oracle.com }
131*12967Sgavin.maltby@oracle.com
132*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_global, "stev_ct_global") == -1) {
133*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_global'\n");
134*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
135*12967Sgavin.maltby@oracle.com }
136*12967Sgavin.maltby@oracle.com
137*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_noprefs, "stev_ct_noprefs") == -1) {
138*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_noprefs'\n");
139*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
140*12967Sgavin.maltby@oracle.com }
141*12967Sgavin.maltby@oracle.com
142*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_from_uninit, "stev_ct_from_uninit") == -1) {
143*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_from_uninit'\n");
144*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
145*12967Sgavin.maltby@oracle.com }
146*12967Sgavin.maltby@oracle.com
147*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_bad_state, "stev_ct_bad_state") == -1) {
148*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_bad_state'\n");
149*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
150*12967Sgavin.maltby@oracle.com }
151*12967Sgavin.maltby@oracle.com
152*12967Sgavin.maltby@oracle.com if (mdb_readvar(&ct_ovr_prefs, "stev_ct_ovr_prefs") == -1) {
153*12967Sgavin.maltby@oracle.com mdb_warn("failed to read 'stev_ct_ovr_prefs'\n");
154*12967Sgavin.maltby@oracle.com return (DCMD_ERR);
155*12967Sgavin.maltby@oracle.com }
156*12967Sgavin.maltby@oracle.com
1570Sstevel@tonic-gate mdb_printf(
158*12967Sgavin.maltby@oracle.com "General stats\n"
159*12967Sgavin.maltby@oracle.com " dictionary lookups: %llu\n"
160*12967Sgavin.maltby@oracle.com " average lookup time: %llu us\n"
161*12967Sgavin.maltby@oracle.com " graph dependency insertions: %llu\n"
162*12967Sgavin.maltby@oracle.com " average cycle-check time: %llu us\n"
163*12967Sgavin.maltby@oracle.com " avg dependency insert time: %llu us\n"
164*12967Sgavin.maltby@oracle.com " number of nodes in dgraph: %llu\n"
165*12967Sgavin.maltby@oracle.com "number of nodes in instance_list: %llu\n"
166*12967Sgavin.maltby@oracle.com "\nState Transition Events\n"
167*12967Sgavin.maltby@oracle.com " maintenance: %llu\n"
168*12967Sgavin.maltby@oracle.com " hardware error: %llu\n"
169*12967Sgavin.maltby@oracle.com " service specific pref: %llu\n"
170*12967Sgavin.maltby@oracle.com " system wide pref: %llu\n"
171*12967Sgavin.maltby@oracle.com " no prefs, not raised: %llu\n"
172*12967Sgavin.maltby@oracle.com " from unint, not raised: %llu\n"
173*12967Sgavin.maltby@oracle.com " bad state, not raised: %llu\n"
174*12967Sgavin.maltby@oracle.com " override pref, raised: %llu\n", lookups,
1750Sstevel@tonic-gate lookups ? ns_total / (1000 * lookups) : 0, dep_inserts,
1760Sstevel@tonic-gate dep_inserts ? dep_cycle_ns / (1000 * dep_inserts) : 0,
1770Sstevel@tonic-gate dep_inserts ? dep_insert_ns / (1000 * dep_inserts) : 0,
178*12967Sgavin.maltby@oracle.com (u_longlong_t)graph_num, (u_longlong_t)restarter_num,
179*12967Sgavin.maltby@oracle.com ct_maint, ct_hwerr, ct_service, ct_global, ct_noprefs,
180*12967Sgavin.maltby@oracle.com ct_from_uninit, ct_bad_state, ct_ovr_prefs);
181*12967Sgavin.maltby@oracle.com
1820Sstevel@tonic-gate
1830Sstevel@tonic-gate return (DCMD_OK);
1840Sstevel@tonic-gate }
1850Sstevel@tonic-gate
1860Sstevel@tonic-gate static char
xstate2chr(restarter_instance_state_t s)1870Sstevel@tonic-gate xstate2chr(restarter_instance_state_t s)
1880Sstevel@tonic-gate {
1890Sstevel@tonic-gate switch (s) {
1900Sstevel@tonic-gate case RESTARTER_STATE_UNINIT: return ('u');
1910Sstevel@tonic-gate case RESTARTER_STATE_DISABLED: return ('d');
1920Sstevel@tonic-gate case RESTARTER_STATE_OFFLINE: return ('0');
1930Sstevel@tonic-gate case RESTARTER_STATE_DEGRADED: return ('D');
1940Sstevel@tonic-gate case RESTARTER_STATE_ONLINE: return ('1');
1950Sstevel@tonic-gate case RESTARTER_STATE_MAINT: return ('m');
1960Sstevel@tonic-gate case RESTARTER_STATE_NONE: return ('n');
1970Sstevel@tonic-gate default: return ('?');
1980Sstevel@tonic-gate }
1990Sstevel@tonic-gate }
2000Sstevel@tonic-gate
2010Sstevel@tonic-gate /*ARGSUSED*/
2020Sstevel@tonic-gate static int
pr_instance(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)2030Sstevel@tonic-gate pr_instance(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2040Sstevel@tonic-gate {
2050Sstevel@tonic-gate restarter_instance_list_t ril;
2060Sstevel@tonic-gate restarter_inst_t ri;
2070Sstevel@tonic-gate char *iname;
2080Sstevel@tonic-gate char statechr = '-';
2090Sstevel@tonic-gate char typechr;
2100Sstevel@tonic-gate
2110Sstevel@tonic-gate if ((flags & DCMD_ADDRSPEC) == 0) {
2120Sstevel@tonic-gate if (mdb_readvar(&ril, "instance_list") == -1) {
2130Sstevel@tonic-gate mdb_warn("failed to read 'instance_list' value\n");
2140Sstevel@tonic-gate return (DCMD_ERR);
2150Sstevel@tonic-gate }
2160Sstevel@tonic-gate
2170Sstevel@tonic-gate if (mdb_pwalk_dcmd("uu_list_node", "instance", 0, NULL,
2180Sstevel@tonic-gate (uintptr_t)ril.ril_instance_list) == -1) {
2190Sstevel@tonic-gate mdb_warn("can't walk instances\n");
2200Sstevel@tonic-gate return (DCMD_ERR);
2210Sstevel@tonic-gate }
2220Sstevel@tonic-gate
2230Sstevel@tonic-gate return (DCMD_OK);
2240Sstevel@tonic-gate }
2250Sstevel@tonic-gate
2260Sstevel@tonic-gate if (mdb_vread(&ri, sizeof (restarter_inst_t), addr) == -1) {
2270Sstevel@tonic-gate mdb_warn("couldn't read instance at %a\n");
2280Sstevel@tonic-gate return (DCMD_ERR);
2290Sstevel@tonic-gate }
2300Sstevel@tonic-gate
2310Sstevel@tonic-gate if (DCMD_HDRSPEC(flags))
2320Sstevel@tonic-gate mdb_printf("%-10s %-3s %1s %1s %4s\n", "ADDR", "ID", "T", "S",
2330Sstevel@tonic-gate "FMRI");
2340Sstevel@tonic-gate
2350Sstevel@tonic-gate iname = mdb_alloc(1024, UM_SLEEP | UM_GC);
2360Sstevel@tonic-gate
2370Sstevel@tonic-gate if (mdb_readstr(iname, 1024, (uintptr_t)ri.ri_i.i_fmri) == -1) {
2380Sstevel@tonic-gate mdb_warn("couldn't read instance name\n");
2390Sstevel@tonic-gate strcpy(iname, "-");
2400Sstevel@tonic-gate }
2410Sstevel@tonic-gate
2420Sstevel@tonic-gate statechr = xstate2chr(ri.ri_i.i_state);
2430Sstevel@tonic-gate typechr = (ri.ri_i.i_enabled) ? 'I' : 'i';
2440Sstevel@tonic-gate
2450Sstevel@tonic-gate mdb_printf("%-10a %3x %c %c %s\n", addr, ri.ri_id, typechr, statechr,
2460Sstevel@tonic-gate iname);
2470Sstevel@tonic-gate
2480Sstevel@tonic-gate return (DCMD_OK);
2490Sstevel@tonic-gate }
2500Sstevel@tonic-gate
2510Sstevel@tonic-gate /*ARGSUSED*/
2520Sstevel@tonic-gate static int
pr_vertex(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)2530Sstevel@tonic-gate pr_vertex(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
2540Sstevel@tonic-gate {
2550Sstevel@tonic-gate uu_list_t *dgraphp;
2560Sstevel@tonic-gate graph_vertex_t gv;
2570Sstevel@tonic-gate char *vname;
2580Sstevel@tonic-gate int id;
2590Sstevel@tonic-gate char typechr;
2600Sstevel@tonic-gate char statechr = '-';
2610Sstevel@tonic-gate
2620Sstevel@tonic-gate if ((flags & DCMD_ADDRSPEC) == 0) {
2630Sstevel@tonic-gate if (mdb_readvar(&dgraphp, "dgraph") == -1) {
2640Sstevel@tonic-gate mdb_warn("failed to read 'dgraph' value\n");
2650Sstevel@tonic-gate return (DCMD_ERR);
2660Sstevel@tonic-gate }
2670Sstevel@tonic-gate
2680Sstevel@tonic-gate if (mdb_pwalk_dcmd("uu_list_node", "vertex", 0, NULL,
2690Sstevel@tonic-gate (uintptr_t)dgraphp) == -1) {
2700Sstevel@tonic-gate mdb_warn("can't walk vertices");
2710Sstevel@tonic-gate return (DCMD_ERR);
2720Sstevel@tonic-gate }
2730Sstevel@tonic-gate
2740Sstevel@tonic-gate return (DCMD_OK);
2750Sstevel@tonic-gate }
2760Sstevel@tonic-gate
2770Sstevel@tonic-gate if (mdb_vread(&gv, sizeof (graph_vertex_t), addr) == -1) {
2780Sstevel@tonic-gate mdb_warn("couldn't read vertex at %a\n");
2790Sstevel@tonic-gate return (DCMD_ERR);
2800Sstevel@tonic-gate }
2810Sstevel@tonic-gate
2820Sstevel@tonic-gate if (DCMD_HDRSPEC(flags))
2830Sstevel@tonic-gate mdb_printf("%-10s %-3s %1s %1s %4s\n", "ADDR", "ID", "T", "S",
2840Sstevel@tonic-gate "FMRI");
2850Sstevel@tonic-gate
2860Sstevel@tonic-gate vname = mdb_alloc(1024, UM_SLEEP | UM_GC);
2870Sstevel@tonic-gate
2880Sstevel@tonic-gate if (mdb_readstr(vname, 1024, (uintptr_t)gv.gv_name) == -1) {
2890Sstevel@tonic-gate mdb_warn("couldn't read vertex name\n");
2900Sstevel@tonic-gate strcpy(vname, "-");
2910Sstevel@tonic-gate }
2920Sstevel@tonic-gate
2930Sstevel@tonic-gate id = gv.gv_id;
2940Sstevel@tonic-gate
2950Sstevel@tonic-gate switch (gv.gv_type) {
2960Sstevel@tonic-gate case GVT_FILE:
2970Sstevel@tonic-gate typechr = 'f';
2980Sstevel@tonic-gate break;
2990Sstevel@tonic-gate case GVT_GROUP:
3000Sstevel@tonic-gate switch (gv.gv_depgroup) {
3010Sstevel@tonic-gate case DEPGRP_REQUIRE_ANY:
3020Sstevel@tonic-gate typechr = 'r';
3030Sstevel@tonic-gate break;
3040Sstevel@tonic-gate case DEPGRP_REQUIRE_ALL:
3050Sstevel@tonic-gate typechr = 'R';
3060Sstevel@tonic-gate break;
3070Sstevel@tonic-gate case DEPGRP_EXCLUDE_ALL:
3080Sstevel@tonic-gate typechr = 'X';
3090Sstevel@tonic-gate break;
3100Sstevel@tonic-gate case DEPGRP_OPTIONAL_ALL:
3110Sstevel@tonic-gate typechr = 'o';
3120Sstevel@tonic-gate break;
3130Sstevel@tonic-gate default:
3140Sstevel@tonic-gate typechr = '?';
3150Sstevel@tonic-gate break;
3160Sstevel@tonic-gate }
3170Sstevel@tonic-gate break;
3180Sstevel@tonic-gate case GVT_INST:
3190Sstevel@tonic-gate typechr = (gv.gv_flags & GV_ENABLED) ? 'I' : 'i';
3200Sstevel@tonic-gate statechr = xstate2chr(gv.gv_state);
3210Sstevel@tonic-gate break;
3220Sstevel@tonic-gate case GVT_SVC:
3230Sstevel@tonic-gate typechr = 's';
3240Sstevel@tonic-gate break;
3250Sstevel@tonic-gate default:
3260Sstevel@tonic-gate typechr = '?';
3270Sstevel@tonic-gate break;
3280Sstevel@tonic-gate }
3290Sstevel@tonic-gate
3300Sstevel@tonic-gate mdb_printf("%-10a %3x %c %c %s\n", addr, id, typechr, statechr, vname);
3310Sstevel@tonic-gate
3320Sstevel@tonic-gate return (DCMD_OK);
3330Sstevel@tonic-gate }
3340Sstevel@tonic-gate
3350Sstevel@tonic-gate /* ARGSUSED */
3360Sstevel@tonic-gate static int
logbuf(uintptr_t addr,uint_t flags,int argc,const mdb_arg_t * argv)3370Sstevel@tonic-gate logbuf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
3380Sstevel@tonic-gate {
3392747Sbustos GElf_Sym sym;
3400Sstevel@tonic-gate char *buf;
3410Sstevel@tonic-gate char *cp;
3420Sstevel@tonic-gate
3432747Sbustos if (mdb_lookup_by_name("logbuf", &sym) == -1) {
3442747Sbustos mdb_warn("The 'logbuf' symbol is missing.\n");
3450Sstevel@tonic-gate return (DCMD_ERR);
3460Sstevel@tonic-gate }
3470Sstevel@tonic-gate
3482747Sbustos buf = mdb_alloc(sym.st_size, UM_SLEEP | UM_GC);
3490Sstevel@tonic-gate
3502747Sbustos if (mdb_vread(buf, sym.st_size, sym.st_value) == -1) {
3510Sstevel@tonic-gate mdb_warn("failed to read 'logbuf'\n");
3520Sstevel@tonic-gate return (DCMD_ERR);
3530Sstevel@tonic-gate }
3540Sstevel@tonic-gate
3550Sstevel@tonic-gate cp = strchr(buf, '\0');
3560Sstevel@tonic-gate
3570Sstevel@tonic-gate if (cp == buf)
3580Sstevel@tonic-gate /* Empty */
3590Sstevel@tonic-gate return (DCMD_OK);
3600Sstevel@tonic-gate
3612747Sbustos if (cp >= buf + sym.st_size ||
3622747Sbustos strchr(cp + 1, '\0') >= buf + sym.st_size) {
3630Sstevel@tonic-gate mdb_warn("'logbuf' is corrupt\n");
3640Sstevel@tonic-gate return (DCMD_ERR);
3650Sstevel@tonic-gate }
3660Sstevel@tonic-gate
3670Sstevel@tonic-gate mdb_printf("%s", cp + 1);
3680Sstevel@tonic-gate mdb_printf("%s", buf);
3690Sstevel@tonic-gate
3700Sstevel@tonic-gate return (DCMD_OK);
3710Sstevel@tonic-gate }
3720Sstevel@tonic-gate
3730Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = {
3740Sstevel@tonic-gate { "instance", NULL, "display svc.startd restarter instance",
3750Sstevel@tonic-gate pr_instance },
3760Sstevel@tonic-gate { "startd_log", NULL, "display svc.startd debug message buffer",
3770Sstevel@tonic-gate logbuf },
3780Sstevel@tonic-gate { "startd_status", NULL, "svc.startd status summary", startd_status },
3790Sstevel@tonic-gate { "vertex", NULL, "display svc.startd dependency graph vertex",
3800Sstevel@tonic-gate pr_vertex },
3810Sstevel@tonic-gate { NULL }
3820Sstevel@tonic-gate };
3830Sstevel@tonic-gate
3840Sstevel@tonic-gate static const mdb_walker_t walkers[] = {
3850Sstevel@tonic-gate { NULL }
3860Sstevel@tonic-gate };
3870Sstevel@tonic-gate
3880Sstevel@tonic-gate static const mdb_modinfo_t modinfo = {
3890Sstevel@tonic-gate MDB_API_VERSION, dcmds, walkers
3900Sstevel@tonic-gate };
3910Sstevel@tonic-gate
3920Sstevel@tonic-gate const mdb_modinfo_t *
_mdb_init(void)3930Sstevel@tonic-gate _mdb_init(void)
3940Sstevel@tonic-gate {
3950Sstevel@tonic-gate return (&modinfo);
3960Sstevel@tonic-gate }
397