1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate #include <mdb/mdb_modapi.h> 30*7c478bd9Sstevel@tonic-gate #include <mdb/mdb_ks.h> 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 33*7c478bd9Sstevel@tonic-gate #include <sys/strsubr.h> 34*7c478bd9Sstevel@tonic-gate #include <sys/ptms.h> 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate typedef struct pt_flags { 37*7c478bd9Sstevel@tonic-gate const char *pt_name; 38*7c478bd9Sstevel@tonic-gate const char *pt_descr; 39*7c478bd9Sstevel@tonic-gate } ptflags_t; 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate static const struct pt_flags pf[] = { 42*7c478bd9Sstevel@tonic-gate { "PTLOCK", "Master/slave pair is locked" }, 43*7c478bd9Sstevel@tonic-gate { "PTMOPEN", "Master side is open" }, 44*7c478bd9Sstevel@tonic-gate { "PTSOPEN", "Slave side is open" }, 45*7c478bd9Sstevel@tonic-gate { "PTSTTY", "Slave side is tty" }, 46*7c478bd9Sstevel@tonic-gate { NULL }, 47*7c478bd9Sstevel@tonic-gate }; 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate static int 50*7c478bd9Sstevel@tonic-gate pt_parse_flag(const ptflags_t ftable[], const char *arg, uint32_t *flag) 51*7c478bd9Sstevel@tonic-gate { 52*7c478bd9Sstevel@tonic-gate int i; 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate for (i = 0; ftable[i].pt_name != NULL; i++) { 55*7c478bd9Sstevel@tonic-gate if (strcasecmp(arg, ftable[i].pt_name) == 0) { 56*7c478bd9Sstevel@tonic-gate *flag |= (1 << i); 57*7c478bd9Sstevel@tonic-gate return (0); 58*7c478bd9Sstevel@tonic-gate } 59*7c478bd9Sstevel@tonic-gate } 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate return (-1); 62*7c478bd9Sstevel@tonic-gate } 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate static void 65*7c478bd9Sstevel@tonic-gate pt_flag_usage(const ptflags_t ftable[]) 66*7c478bd9Sstevel@tonic-gate { 67*7c478bd9Sstevel@tonic-gate int i; 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate for (i = 0; ftable[i].pt_name != NULL; i++) 70*7c478bd9Sstevel@tonic-gate mdb_printf("%12s %s\n", 71*7c478bd9Sstevel@tonic-gate ftable[i].pt_name, ftable[i].pt_descr); 72*7c478bd9Sstevel@tonic-gate } 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate static void 77*7c478bd9Sstevel@tonic-gate ptms_pr_qinfo(char *buf, size_t nbytes, struct pt_ttys *pt, char *peername, 78*7c478bd9Sstevel@tonic-gate queue_t *peerq, char *procname) 79*7c478bd9Sstevel@tonic-gate { 80*7c478bd9Sstevel@tonic-gate (void) mdb_snprintf(buf, nbytes, 81*7c478bd9Sstevel@tonic-gate "pts/%d:%s: %p\nprocess: %d(%s)", 82*7c478bd9Sstevel@tonic-gate pt->pt_minor, peername, peerq, pt->pt_pid, procname); 83*7c478bd9Sstevel@tonic-gate } 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate static int 86*7c478bd9Sstevel@tonic-gate ptms(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 87*7c478bd9Sstevel@tonic-gate { 88*7c478bd9Sstevel@tonic-gate const int PT_FLGDELT = (int)(sizeof (uintptr_t) * 2 + 5); 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate struct pt_ttys pt; 91*7c478bd9Sstevel@tonic-gate char c[MAXCOMLEN + 1]; 92*7c478bd9Sstevel@tonic-gate const char *flag = NULL, *not_flag = NULL; 93*7c478bd9Sstevel@tonic-gate proc_t p; 94*7c478bd9Sstevel@tonic-gate uint_t verbose = FALSE; 95*7c478bd9Sstevel@tonic-gate uint32_t mask = 0, not_mask = 0; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC)) 98*7c478bd9Sstevel@tonic-gate return (mdb_walk_dcmd("ptms", "ptms", argc, argv)); 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate if (mdb_getopts(argc, argv, 101*7c478bd9Sstevel@tonic-gate 'v', MDB_OPT_SETBITS, TRUE, &verbose, 102*7c478bd9Sstevel@tonic-gate 'f', MDB_OPT_STR, &flag, 103*7c478bd9Sstevel@tonic-gate 'F', MDB_OPT_STR, ¬_flag, NULL) != argc) 104*7c478bd9Sstevel@tonic-gate return (DCMD_USAGE); 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate if (DCMD_HDRSPEC(flags) && flag == NULL && not_flag == NULL) { 107*7c478bd9Sstevel@tonic-gate (void) mdb_printf("%?-s %s %s %?-s %?-s %3s %-6s %s\n", 108*7c478bd9Sstevel@tonic-gate "ADDR", "PTY", "FL", "MASTERQ", "SLAVEQ", 109*7c478bd9Sstevel@tonic-gate "ZID", "PID", "PROC"); 110*7c478bd9Sstevel@tonic-gate } 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate if (flag != NULL && pt_parse_flag(pf, flag, &mask) == -1) { 113*7c478bd9Sstevel@tonic-gate mdb_warn("unrecognized pty flag '%s'\n", flag); 114*7c478bd9Sstevel@tonic-gate pt_flag_usage(pf); 115*7c478bd9Sstevel@tonic-gate return (DCMD_USAGE); 116*7c478bd9Sstevel@tonic-gate } 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate if (not_flag != NULL && pt_parse_flag(pf, not_flag, ¬_mask) == -1) { 119*7c478bd9Sstevel@tonic-gate mdb_warn("unrecognized queue flag '%s'\n", flag); 120*7c478bd9Sstevel@tonic-gate pt_flag_usage(pf); 121*7c478bd9Sstevel@tonic-gate return (DCMD_USAGE); 122*7c478bd9Sstevel@tonic-gate } 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate if (mdb_vread(&pt, sizeof (pt), addr) == -1) { 125*7c478bd9Sstevel@tonic-gate mdb_warn("failed to read pty structure"); 126*7c478bd9Sstevel@tonic-gate return (DCMD_ERR); 127*7c478bd9Sstevel@tonic-gate } 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate if (mask != 0 && !(pt.pt_state & mask)) 130*7c478bd9Sstevel@tonic-gate return (DCMD_OK); 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate if (not_mask != 0 && (pt.pt_state & not_mask)) 133*7c478bd9Sstevel@tonic-gate return (DCMD_OK); 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate /* 136*7c478bd9Sstevel@tonic-gate * Options are specified for filtering, so If any option is specified on 137*7c478bd9Sstevel@tonic-gate * the command line, just print address and exit. 138*7c478bd9Sstevel@tonic-gate */ 139*7c478bd9Sstevel@tonic-gate if (flag != NULL || not_flag != NULL) { 140*7c478bd9Sstevel@tonic-gate mdb_printf("%0?p\n", addr); 141*7c478bd9Sstevel@tonic-gate return (DCMD_OK); 142*7c478bd9Sstevel@tonic-gate } 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate if (pt.pt_pid != 0) { 145*7c478bd9Sstevel@tonic-gate if (mdb_pid2proc(pt.pt_pid, &p) == NULL) 146*7c478bd9Sstevel@tonic-gate (void) strcpy(c, "<defunct>"); 147*7c478bd9Sstevel@tonic-gate else 148*7c478bd9Sstevel@tonic-gate (void) strcpy(c, p.p_user.u_comm); 149*7c478bd9Sstevel@tonic-gate } else 150*7c478bd9Sstevel@tonic-gate (void) strcpy(c, "<unknown>"); 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate (void) mdb_printf("%0?p %3d %2x %0?p %0?p %3d %6d %s\n", 153*7c478bd9Sstevel@tonic-gate addr, pt.pt_minor, pt.pt_state, pt.ptm_rdq, pt.pts_rdq, 154*7c478bd9Sstevel@tonic-gate pt.pt_zoneid, pt.pt_pid, c); 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate if (verbose) { 157*7c478bd9Sstevel@tonic-gate int i, arm = 0; 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate for (i = 0; pf[i].pt_name != NULL; i++) { 160*7c478bd9Sstevel@tonic-gate if (!(pt.pt_state & (1 << i))) 161*7c478bd9Sstevel@tonic-gate continue; 162*7c478bd9Sstevel@tonic-gate if (!arm) { 163*7c478bd9Sstevel@tonic-gate mdb_printf("%*s|\n%*s+--> ", 164*7c478bd9Sstevel@tonic-gate PT_FLGDELT, "", PT_FLGDELT, ""); 165*7c478bd9Sstevel@tonic-gate arm = 1; 166*7c478bd9Sstevel@tonic-gate } else 167*7c478bd9Sstevel@tonic-gate mdb_printf("%*s ", PT_FLGDELT, ""); 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate mdb_printf("%-12s %s\n", 170*7c478bd9Sstevel@tonic-gate pf[i].pt_name, pf[i].pt_descr); 171*7c478bd9Sstevel@tonic-gate } 172*7c478bd9Sstevel@tonic-gate } 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate return (DCMD_OK); 175*7c478bd9Sstevel@tonic-gate } 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate static void 178*7c478bd9Sstevel@tonic-gate ptms_qinfo(const queue_t *q, char *buf, size_t nbytes, int ismaster) 179*7c478bd9Sstevel@tonic-gate { 180*7c478bd9Sstevel@tonic-gate char c[MAXCOMLEN + 1]; 181*7c478bd9Sstevel@tonic-gate struct pt_ttys pt; 182*7c478bd9Sstevel@tonic-gate proc_t p; 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate (void) mdb_vread(&pt, sizeof (pt), (uintptr_t)q->q_ptr); 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate if (pt.pt_pid != 0) { 187*7c478bd9Sstevel@tonic-gate if (mdb_pid2proc(pt.pt_pid, &p) == NULL) 188*7c478bd9Sstevel@tonic-gate (void) strcpy(c, "<defunct>"); 189*7c478bd9Sstevel@tonic-gate else 190*7c478bd9Sstevel@tonic-gate (void) strcpy(c, p.p_user.u_comm); 191*7c478bd9Sstevel@tonic-gate } else 192*7c478bd9Sstevel@tonic-gate (void) strcpy(c, "<unknown>"); 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate if (ismaster) 195*7c478bd9Sstevel@tonic-gate ptms_pr_qinfo(buf, nbytes, &pt, "slave", pt.pts_rdq, c); 196*7c478bd9Sstevel@tonic-gate else 197*7c478bd9Sstevel@tonic-gate ptms_pr_qinfo(buf, nbytes, &pt, "master", pt.ptm_rdq, c); 198*7c478bd9Sstevel@tonic-gate } 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate void 201*7c478bd9Sstevel@tonic-gate ptm_qinfo(const queue_t *q, char *buf, size_t nbytes) 202*7c478bd9Sstevel@tonic-gate { 203*7c478bd9Sstevel@tonic-gate ptms_qinfo(q, buf, nbytes, 1); 204*7c478bd9Sstevel@tonic-gate } 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate void 207*7c478bd9Sstevel@tonic-gate pts_qinfo(const queue_t *q, char *buf, size_t nbytes) 208*7c478bd9Sstevel@tonic-gate { 209*7c478bd9Sstevel@tonic-gate ptms_qinfo(q, buf, nbytes, 0); 210*7c478bd9Sstevel@tonic-gate } 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate static int 213*7c478bd9Sstevel@tonic-gate ptms_walk_init(mdb_walk_state_t *wsp) 214*7c478bd9Sstevel@tonic-gate { 215*7c478bd9Sstevel@tonic-gate size_t nslots; 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate if (wsp->walk_addr != NULL) { 218*7c478bd9Sstevel@tonic-gate mdb_warn("ptms supports only global walks"); 219*7c478bd9Sstevel@tonic-gate return (WALK_ERR); 220*7c478bd9Sstevel@tonic-gate } 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate if (mdb_readvar(&wsp->walk_addr, "ptms_slots") == -1) { 223*7c478bd9Sstevel@tonic-gate mdb_warn("failed to read 'ptms_slots'"); 224*7c478bd9Sstevel@tonic-gate return (WALK_ERR); 225*7c478bd9Sstevel@tonic-gate } 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gate if (mdb_readvar(&nslots, "ptms_nslots") == -1) { 228*7c478bd9Sstevel@tonic-gate mdb_warn("failed to read 'ptms_nslots'"); 229*7c478bd9Sstevel@tonic-gate return (WALK_ERR); 230*7c478bd9Sstevel@tonic-gate } 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * We remember the pointer value at the end of the array. When 234*7c478bd9Sstevel@tonic-gate * the walk gets there, we're done. 235*7c478bd9Sstevel@tonic-gate */ 236*7c478bd9Sstevel@tonic-gate wsp->walk_arg = (((struct pt_ttys **)wsp->walk_addr) + (nslots - 1)); 237*7c478bd9Sstevel@tonic-gate wsp->walk_data = mdb_alloc(sizeof (struct pt_ttys), UM_SLEEP); 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate return (WALK_NEXT); 240*7c478bd9Sstevel@tonic-gate } 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate static int 243*7c478bd9Sstevel@tonic-gate ptms_walk_step(mdb_walk_state_t *wsp) 244*7c478bd9Sstevel@tonic-gate { 245*7c478bd9Sstevel@tonic-gate int status; 246*7c478bd9Sstevel@tonic-gate uintptr_t ptr; 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate if (wsp->walk_addr > (uintptr_t)wsp->walk_arg) 249*7c478bd9Sstevel@tonic-gate return (WALK_DONE); 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate if (mdb_vread(&ptr, sizeof (struct pt_ttys *), wsp->walk_addr) != 252*7c478bd9Sstevel@tonic-gate (sizeof (struct pt_ttys *))) { 253*7c478bd9Sstevel@tonic-gate mdb_warn("failed to read pt_ttys* at %p", wsp->walk_addr); 254*7c478bd9Sstevel@tonic-gate return (WALK_DONE); 255*7c478bd9Sstevel@tonic-gate } 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate if (ptr == NULL) { 258*7c478bd9Sstevel@tonic-gate wsp->walk_addr += sizeof (uintptr_t); 259*7c478bd9Sstevel@tonic-gate return (WALK_NEXT); 260*7c478bd9Sstevel@tonic-gate } 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate if (mdb_vread(wsp->walk_data, sizeof (struct pt_ttys), ptr) != 263*7c478bd9Sstevel@tonic-gate sizeof (struct pt_ttys)) { 264*7c478bd9Sstevel@tonic-gate mdb_warn("failed to read pt_ttys at %p", ptr); 265*7c478bd9Sstevel@tonic-gate return (WALK_DONE); 266*7c478bd9Sstevel@tonic-gate } 267*7c478bd9Sstevel@tonic-gate 268*7c478bd9Sstevel@tonic-gate status = wsp->walk_callback(ptr, wsp->walk_data, wsp->walk_cbdata); 269*7c478bd9Sstevel@tonic-gate wsp->walk_addr += sizeof (uintptr_t); 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate return (status); 272*7c478bd9Sstevel@tonic-gate } 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gate static void 275*7c478bd9Sstevel@tonic-gate ptms_walk_fini(mdb_walk_state_t *wsp) 276*7c478bd9Sstevel@tonic-gate { 277*7c478bd9Sstevel@tonic-gate mdb_free(wsp->walk_data, sizeof (struct pt_ttys)); 278*7c478bd9Sstevel@tonic-gate } 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = { 281*7c478bd9Sstevel@tonic-gate { "ptms", "?[-v] [-f flag] [-F flag]", 282*7c478bd9Sstevel@tonic-gate "print pseudo-terminal information", ptms }, 283*7c478bd9Sstevel@tonic-gate { "pty", "?[-v] [-f flag] [-F flag]", 284*7c478bd9Sstevel@tonic-gate "print pseudo-terminal information (alias of ::ptms", ptms }, 285*7c478bd9Sstevel@tonic-gate { NULL } 286*7c478bd9Sstevel@tonic-gate }; 287*7c478bd9Sstevel@tonic-gate 288*7c478bd9Sstevel@tonic-gate static const mdb_walker_t walkers[] = { 289*7c478bd9Sstevel@tonic-gate { "ptms", "walk list of pseudo-tty's", 290*7c478bd9Sstevel@tonic-gate ptms_walk_init, ptms_walk_step, ptms_walk_fini }, 291*7c478bd9Sstevel@tonic-gate { "pty", "walk list of pseudo-tty's (alias of ::walk ptms)", 292*7c478bd9Sstevel@tonic-gate ptms_walk_init, ptms_walk_step, ptms_walk_fini }, 293*7c478bd9Sstevel@tonic-gate { NULL } 294*7c478bd9Sstevel@tonic-gate }; 295*7c478bd9Sstevel@tonic-gate 296*7c478bd9Sstevel@tonic-gate static const mdb_qops_t ptm_qops = { 297*7c478bd9Sstevel@tonic-gate ptm_qinfo, mdb_qrnext_default, mdb_qwnext_default 298*7c478bd9Sstevel@tonic-gate }; 299*7c478bd9Sstevel@tonic-gate 300*7c478bd9Sstevel@tonic-gate static const mdb_qops_t pts_qops = { 301*7c478bd9Sstevel@tonic-gate pts_qinfo, mdb_qrnext_default, mdb_qwnext_default 302*7c478bd9Sstevel@tonic-gate }; 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate static const mdb_modinfo_t modinfo = { 305*7c478bd9Sstevel@tonic-gate MDB_API_VERSION, dcmds, walkers 306*7c478bd9Sstevel@tonic-gate }; 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate const mdb_modinfo_t * 309*7c478bd9Sstevel@tonic-gate _mdb_init(void) 310*7c478bd9Sstevel@tonic-gate { 311*7c478bd9Sstevel@tonic-gate GElf_Sym sym; 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate if (mdb_lookup_by_obj("ptm", "ptmwint", &sym) == 0) 314*7c478bd9Sstevel@tonic-gate mdb_qops_install(&ptm_qops, (uintptr_t)sym.st_value); 315*7c478bd9Sstevel@tonic-gate if (mdb_lookup_by_obj("pts", "ptswint", &sym) == 0) 316*7c478bd9Sstevel@tonic-gate mdb_qops_install(&pts_qops, (uintptr_t)sym.st_value); 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate return (&modinfo); 319*7c478bd9Sstevel@tonic-gate } 320*7c478bd9Sstevel@tonic-gate 321*7c478bd9Sstevel@tonic-gate void 322*7c478bd9Sstevel@tonic-gate _mdb_fini(void) 323*7c478bd9Sstevel@tonic-gate { 324*7c478bd9Sstevel@tonic-gate GElf_Sym sym; 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate if (mdb_lookup_by_obj("ptm", "ptmwint", &sym) == 0) 327*7c478bd9Sstevel@tonic-gate mdb_qops_remove(&ptm_qops, (uintptr_t)sym.st_value); 328*7c478bd9Sstevel@tonic-gate if (mdb_lookup_by_obj("pts", "ptswint", &sym) == 0) 329*7c478bd9Sstevel@tonic-gate mdb_qops_remove(&pts_qops, (uintptr_t)sym.st_value); 330*7c478bd9Sstevel@tonic-gate } 331