1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #include <sys/dtrace.h> 30*0Sstevel@tonic-gate #include <sys/systrace.h> 31*0Sstevel@tonic-gate #include <sys/stat.h> 32*0Sstevel@tonic-gate #include <sys/systm.h> 33*0Sstevel@tonic-gate #include <sys/conf.h> 34*0Sstevel@tonic-gate #include <sys/ddi.h> 35*0Sstevel@tonic-gate #include <sys/sunddi.h> 36*0Sstevel@tonic-gate #include <sys/atomic.h> 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #define SYSTRACE_ARTIFICIAL_FRAMES 1 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate #define SYSTRACE_SHIFT 16 41*0Sstevel@tonic-gate #define SYSTRACE_ISENTRY(x) ((int)(x) >> SYSTRACE_SHIFT) 42*0Sstevel@tonic-gate #define SYSTRACE_SYSNUM(x) ((int)(x) & ((1 << SYSTRACE_SHIFT) - 1)) 43*0Sstevel@tonic-gate #define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id)) 44*0Sstevel@tonic-gate #define SYSTRACE_RETURN(id) (id) 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate #if ((1 << SYSTRACE_SHIFT) <= NSYSCALL) 47*0Sstevel@tonic-gate #error 1 << SYSTRACE_SHIFT must exceed number of system calls 48*0Sstevel@tonic-gate #endif 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate static dev_info_t *systrace_devi; 51*0Sstevel@tonic-gate static dtrace_provider_id_t systrace_id; 52*0Sstevel@tonic-gate 53*0Sstevel@tonic-gate static void 54*0Sstevel@tonic-gate systrace_init(struct sysent *actual, systrace_sysent_t **interposed) 55*0Sstevel@tonic-gate { 56*0Sstevel@tonic-gate systrace_sysent_t *sysent = *interposed; 57*0Sstevel@tonic-gate int i; 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate if (sysent == NULL) { 60*0Sstevel@tonic-gate *interposed = sysent = kmem_zalloc(sizeof (systrace_sysent_t) * 61*0Sstevel@tonic-gate NSYSCALL, KM_SLEEP); 62*0Sstevel@tonic-gate } 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gate for (i = 0; i < NSYSCALL; i++) { 65*0Sstevel@tonic-gate struct sysent *a = &actual[i]; 66*0Sstevel@tonic-gate systrace_sysent_t *s = &sysent[i]; 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate if (LOADABLE_SYSCALL(a) && !LOADED_SYSCALL(a)) 69*0Sstevel@tonic-gate continue; 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate if (a->sy_callc == dtrace_systrace_syscall) 72*0Sstevel@tonic-gate continue; 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 75*0Sstevel@tonic-gate if (a->sy_callc == dtrace_systrace_syscall32) 76*0Sstevel@tonic-gate continue; 77*0Sstevel@tonic-gate #endif 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate s->stsy_underlying = a->sy_callc; 80*0Sstevel@tonic-gate } 81*0Sstevel@tonic-gate } 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate /*ARGSUSED*/ 84*0Sstevel@tonic-gate static void 85*0Sstevel@tonic-gate systrace_provide(void *arg, const dtrace_probedesc_t *desc) 86*0Sstevel@tonic-gate { 87*0Sstevel@tonic-gate int i; 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate if (desc != NULL) 90*0Sstevel@tonic-gate return; 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate systrace_init(sysent, &systrace_sysent); 93*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 94*0Sstevel@tonic-gate systrace_init(sysent32, &systrace_sysent32); 95*0Sstevel@tonic-gate #endif 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate for (i = 0; i < NSYSCALL; i++) { 98*0Sstevel@tonic-gate if (systrace_sysent[i].stsy_underlying == NULL) 99*0Sstevel@tonic-gate continue; 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate if (dtrace_probe_lookup(systrace_id, NULL, 102*0Sstevel@tonic-gate syscallnames[i], "entry") != 0) 103*0Sstevel@tonic-gate continue; 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], 106*0Sstevel@tonic-gate "entry", SYSTRACE_ARTIFICIAL_FRAMES, 107*0Sstevel@tonic-gate (void *)((uintptr_t)SYSTRACE_ENTRY(i))); 108*0Sstevel@tonic-gate (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], 109*0Sstevel@tonic-gate "return", SYSTRACE_ARTIFICIAL_FRAMES, 110*0Sstevel@tonic-gate (void *)((uintptr_t)SYSTRACE_RETURN(i))); 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate systrace_sysent[i].stsy_entry = DTRACE_IDNONE; 113*0Sstevel@tonic-gate systrace_sysent[i].stsy_return = DTRACE_IDNONE; 114*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 115*0Sstevel@tonic-gate systrace_sysent32[i].stsy_entry = DTRACE_IDNONE; 116*0Sstevel@tonic-gate systrace_sysent32[i].stsy_return = DTRACE_IDNONE; 117*0Sstevel@tonic-gate #endif 118*0Sstevel@tonic-gate } 119*0Sstevel@tonic-gate } 120*0Sstevel@tonic-gate 121*0Sstevel@tonic-gate /*ARGSUSED*/ 122*0Sstevel@tonic-gate static void 123*0Sstevel@tonic-gate systrace_destroy(void *arg, dtrace_id_t id, void *parg) 124*0Sstevel@tonic-gate { 125*0Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate /* 128*0Sstevel@tonic-gate * There's nothing to do here but assert that we have actually been 129*0Sstevel@tonic-gate * disabled. 130*0Sstevel@tonic-gate */ 131*0Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 132*0Sstevel@tonic-gate ASSERT(systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE); 133*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 134*0Sstevel@tonic-gate ASSERT(systrace_sysent32[sysnum].stsy_entry == DTRACE_IDNONE); 135*0Sstevel@tonic-gate #endif 136*0Sstevel@tonic-gate } else { 137*0Sstevel@tonic-gate ASSERT(systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE); 138*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 139*0Sstevel@tonic-gate ASSERT(systrace_sysent32[sysnum].stsy_return == DTRACE_IDNONE); 140*0Sstevel@tonic-gate #endif 141*0Sstevel@tonic-gate } 142*0Sstevel@tonic-gate } 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate /*ARGSUSED*/ 145*0Sstevel@tonic-gate static void 146*0Sstevel@tonic-gate systrace_enable(void *arg, dtrace_id_t id, void *parg) 147*0Sstevel@tonic-gate { 148*0Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 149*0Sstevel@tonic-gate int enabled = (systrace_sysent[sysnum].stsy_entry != DTRACE_IDNONE || 150*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return != DTRACE_IDNONE); 151*0Sstevel@tonic-gate 152*0Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 153*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_entry = id; 154*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 155*0Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_entry = id; 156*0Sstevel@tonic-gate #endif 157*0Sstevel@tonic-gate } else { 158*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return = id; 159*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 160*0Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_return = id; 161*0Sstevel@tonic-gate #endif 162*0Sstevel@tonic-gate } 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate if (enabled) { 165*0Sstevel@tonic-gate ASSERT(sysent[sysnum].sy_callc == dtrace_systrace_syscall); 166*0Sstevel@tonic-gate return; 167*0Sstevel@tonic-gate } 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate (void) casptr(&sysent[sysnum].sy_callc, 170*0Sstevel@tonic-gate (void *)systrace_sysent[sysnum].stsy_underlying, 171*0Sstevel@tonic-gate (void *)dtrace_systrace_syscall); 172*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 173*0Sstevel@tonic-gate (void) casptr(&sysent32[sysnum].sy_callc, 174*0Sstevel@tonic-gate (void *)systrace_sysent32[sysnum].stsy_underlying, 175*0Sstevel@tonic-gate (void *)dtrace_systrace_syscall32); 176*0Sstevel@tonic-gate #endif 177*0Sstevel@tonic-gate } 178*0Sstevel@tonic-gate 179*0Sstevel@tonic-gate /*ARGSUSED*/ 180*0Sstevel@tonic-gate static void 181*0Sstevel@tonic-gate systrace_disable(void *arg, dtrace_id_t id, void *parg) 182*0Sstevel@tonic-gate { 183*0Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 184*0Sstevel@tonic-gate int disable = (systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE || 185*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE); 186*0Sstevel@tonic-gate 187*0Sstevel@tonic-gate if (disable) { 188*0Sstevel@tonic-gate (void) casptr(&sysent[sysnum].sy_callc, 189*0Sstevel@tonic-gate (void *)dtrace_systrace_syscall, 190*0Sstevel@tonic-gate (void *)systrace_sysent[sysnum].stsy_underlying); 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 193*0Sstevel@tonic-gate (void) casptr(&sysent32[sysnum].sy_callc, 194*0Sstevel@tonic-gate (void *)dtrace_systrace_syscall32, 195*0Sstevel@tonic-gate (void *)systrace_sysent32[sysnum].stsy_underlying); 196*0Sstevel@tonic-gate #endif 197*0Sstevel@tonic-gate } 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 200*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_entry = DTRACE_IDNONE; 201*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 202*0Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_entry = DTRACE_IDNONE; 203*0Sstevel@tonic-gate #endif 204*0Sstevel@tonic-gate } else { 205*0Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return = DTRACE_IDNONE; 206*0Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 207*0Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_return = DTRACE_IDNONE; 208*0Sstevel@tonic-gate #endif 209*0Sstevel@tonic-gate } 210*0Sstevel@tonic-gate } 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate static dtrace_pattr_t systrace_attr = { 213*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 214*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 215*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 216*0Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 217*0Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 218*0Sstevel@tonic-gate }; 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate static dtrace_pops_t systrace_pops = { 221*0Sstevel@tonic-gate systrace_provide, 222*0Sstevel@tonic-gate NULL, 223*0Sstevel@tonic-gate systrace_enable, 224*0Sstevel@tonic-gate systrace_disable, 225*0Sstevel@tonic-gate NULL, 226*0Sstevel@tonic-gate NULL, 227*0Sstevel@tonic-gate NULL, 228*0Sstevel@tonic-gate NULL, 229*0Sstevel@tonic-gate NULL, 230*0Sstevel@tonic-gate systrace_destroy 231*0Sstevel@tonic-gate }; 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate static int 234*0Sstevel@tonic-gate systrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) 235*0Sstevel@tonic-gate { 236*0Sstevel@tonic-gate switch (cmd) { 237*0Sstevel@tonic-gate case DDI_ATTACH: 238*0Sstevel@tonic-gate break; 239*0Sstevel@tonic-gate case DDI_RESUME: 240*0Sstevel@tonic-gate return (DDI_SUCCESS); 241*0Sstevel@tonic-gate default: 242*0Sstevel@tonic-gate return (DDI_FAILURE); 243*0Sstevel@tonic-gate } 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate systrace_probe = dtrace_probe; 246*0Sstevel@tonic-gate membar_enter(); 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate if (ddi_create_minor_node(devi, "systrace", S_IFCHR, 0, 249*0Sstevel@tonic-gate DDI_PSEUDO, NULL) == DDI_FAILURE || 250*0Sstevel@tonic-gate dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER, 0, 251*0Sstevel@tonic-gate &systrace_pops, NULL, &systrace_id) != 0) { 252*0Sstevel@tonic-gate systrace_probe = systrace_stub; 253*0Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL); 254*0Sstevel@tonic-gate return (DDI_FAILURE); 255*0Sstevel@tonic-gate } 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate ddi_report_dev(devi); 258*0Sstevel@tonic-gate systrace_devi = devi; 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate return (DDI_SUCCESS); 261*0Sstevel@tonic-gate } 262*0Sstevel@tonic-gate 263*0Sstevel@tonic-gate static int 264*0Sstevel@tonic-gate systrace_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) 265*0Sstevel@tonic-gate { 266*0Sstevel@tonic-gate switch (cmd) { 267*0Sstevel@tonic-gate case DDI_DETACH: 268*0Sstevel@tonic-gate break; 269*0Sstevel@tonic-gate case DDI_SUSPEND: 270*0Sstevel@tonic-gate return (DDI_SUCCESS); 271*0Sstevel@tonic-gate default: 272*0Sstevel@tonic-gate return (DDI_FAILURE); 273*0Sstevel@tonic-gate } 274*0Sstevel@tonic-gate 275*0Sstevel@tonic-gate if (dtrace_unregister(systrace_id) != 0) 276*0Sstevel@tonic-gate return (DDI_FAILURE); 277*0Sstevel@tonic-gate 278*0Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL); 279*0Sstevel@tonic-gate systrace_probe = systrace_stub; 280*0Sstevel@tonic-gate return (DDI_SUCCESS); 281*0Sstevel@tonic-gate } 282*0Sstevel@tonic-gate 283*0Sstevel@tonic-gate /*ARGSUSED*/ 284*0Sstevel@tonic-gate static int 285*0Sstevel@tonic-gate systrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) 286*0Sstevel@tonic-gate { 287*0Sstevel@tonic-gate int error; 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate switch (infocmd) { 290*0Sstevel@tonic-gate case DDI_INFO_DEVT2DEVINFO: 291*0Sstevel@tonic-gate *result = (void *)systrace_devi; 292*0Sstevel@tonic-gate error = DDI_SUCCESS; 293*0Sstevel@tonic-gate break; 294*0Sstevel@tonic-gate case DDI_INFO_DEVT2INSTANCE: 295*0Sstevel@tonic-gate *result = (void *)0; 296*0Sstevel@tonic-gate error = DDI_SUCCESS; 297*0Sstevel@tonic-gate break; 298*0Sstevel@tonic-gate default: 299*0Sstevel@tonic-gate error = DDI_FAILURE; 300*0Sstevel@tonic-gate } 301*0Sstevel@tonic-gate return (error); 302*0Sstevel@tonic-gate } 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /*ARGSUSED*/ 305*0Sstevel@tonic-gate static int 306*0Sstevel@tonic-gate systrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p) 307*0Sstevel@tonic-gate { 308*0Sstevel@tonic-gate return (0); 309*0Sstevel@tonic-gate } 310*0Sstevel@tonic-gate 311*0Sstevel@tonic-gate static struct cb_ops systrace_cb_ops = { 312*0Sstevel@tonic-gate systrace_open, /* open */ 313*0Sstevel@tonic-gate nodev, /* close */ 314*0Sstevel@tonic-gate nulldev, /* strategy */ 315*0Sstevel@tonic-gate nulldev, /* print */ 316*0Sstevel@tonic-gate nodev, /* dump */ 317*0Sstevel@tonic-gate nodev, /* read */ 318*0Sstevel@tonic-gate nodev, /* write */ 319*0Sstevel@tonic-gate nodev, /* ioctl */ 320*0Sstevel@tonic-gate nodev, /* devmap */ 321*0Sstevel@tonic-gate nodev, /* mmap */ 322*0Sstevel@tonic-gate nodev, /* segmap */ 323*0Sstevel@tonic-gate nochpoll, /* poll */ 324*0Sstevel@tonic-gate ddi_prop_op, /* cb_prop_op */ 325*0Sstevel@tonic-gate 0, /* streamtab */ 326*0Sstevel@tonic-gate D_NEW | D_MP /* Driver compatibility flag */ 327*0Sstevel@tonic-gate }; 328*0Sstevel@tonic-gate 329*0Sstevel@tonic-gate static struct dev_ops systrace_ops = { 330*0Sstevel@tonic-gate DEVO_REV, /* devo_rev, */ 331*0Sstevel@tonic-gate 0, /* refcnt */ 332*0Sstevel@tonic-gate systrace_info, /* get_dev_info */ 333*0Sstevel@tonic-gate nulldev, /* identify */ 334*0Sstevel@tonic-gate nulldev, /* probe */ 335*0Sstevel@tonic-gate systrace_attach, /* attach */ 336*0Sstevel@tonic-gate systrace_detach, /* detach */ 337*0Sstevel@tonic-gate nodev, /* reset */ 338*0Sstevel@tonic-gate &systrace_cb_ops, /* driver operations */ 339*0Sstevel@tonic-gate NULL, /* bus operations */ 340*0Sstevel@tonic-gate nodev /* dev power */ 341*0Sstevel@tonic-gate }; 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate /* 344*0Sstevel@tonic-gate * Module linkage information for the kernel. 345*0Sstevel@tonic-gate */ 346*0Sstevel@tonic-gate static struct modldrv modldrv = { 347*0Sstevel@tonic-gate &mod_driverops, /* module type (this is a pseudo driver) */ 348*0Sstevel@tonic-gate "System Call Tracing", /* name of module */ 349*0Sstevel@tonic-gate &systrace_ops, /* driver ops */ 350*0Sstevel@tonic-gate }; 351*0Sstevel@tonic-gate 352*0Sstevel@tonic-gate static struct modlinkage modlinkage = { 353*0Sstevel@tonic-gate MODREV_1, 354*0Sstevel@tonic-gate (void *)&modldrv, 355*0Sstevel@tonic-gate NULL 356*0Sstevel@tonic-gate }; 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate int 359*0Sstevel@tonic-gate _init(void) 360*0Sstevel@tonic-gate { 361*0Sstevel@tonic-gate return (mod_install(&modlinkage)); 362*0Sstevel@tonic-gate } 363*0Sstevel@tonic-gate 364*0Sstevel@tonic-gate int 365*0Sstevel@tonic-gate _info(struct modinfo *modinfop) 366*0Sstevel@tonic-gate { 367*0Sstevel@tonic-gate return (mod_info(&modlinkage, modinfop)); 368*0Sstevel@tonic-gate } 369*0Sstevel@tonic-gate 370*0Sstevel@tonic-gate int 371*0Sstevel@tonic-gate _fini(void) 372*0Sstevel@tonic-gate { 373*0Sstevel@tonic-gate return (mod_remove(&modlinkage)); 374*0Sstevel@tonic-gate } 375