17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ad4023c4Sdp * Common Development and Distribution License (the "License"). 6ad4023c4Sdp * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22ad4023c4Sdp * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #include <sys/dtrace.h> 297c478bd9Sstevel@tonic-gate #include <sys/systrace.h> 307c478bd9Sstevel@tonic-gate #include <sys/stat.h> 317c478bd9Sstevel@tonic-gate #include <sys/systm.h> 327c478bd9Sstevel@tonic-gate #include <sys/conf.h> 337c478bd9Sstevel@tonic-gate #include <sys/ddi.h> 347c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 357c478bd9Sstevel@tonic-gate #include <sys/atomic.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #define SYSTRACE_ARTIFICIAL_FRAMES 1 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define SYSTRACE_SHIFT 16 407c478bd9Sstevel@tonic-gate #define SYSTRACE_ISENTRY(x) ((int)(x) >> SYSTRACE_SHIFT) 417c478bd9Sstevel@tonic-gate #define SYSTRACE_SYSNUM(x) ((int)(x) & ((1 << SYSTRACE_SHIFT) - 1)) 427c478bd9Sstevel@tonic-gate #define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id)) 437c478bd9Sstevel@tonic-gate #define SYSTRACE_RETURN(id) (id) 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #if ((1 << SYSTRACE_SHIFT) <= NSYSCALL) 467c478bd9Sstevel@tonic-gate #error 1 << SYSTRACE_SHIFT must exceed number of system calls 477c478bd9Sstevel@tonic-gate #endif 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate static dev_info_t *systrace_devi; 507c478bd9Sstevel@tonic-gate static dtrace_provider_id_t systrace_id; 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate static void 537c478bd9Sstevel@tonic-gate systrace_init(struct sysent *actual, systrace_sysent_t **interposed) 547c478bd9Sstevel@tonic-gate { 557c478bd9Sstevel@tonic-gate systrace_sysent_t *sysent = *interposed; 567c478bd9Sstevel@tonic-gate int i; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate if (sysent == NULL) { 597c478bd9Sstevel@tonic-gate *interposed = sysent = kmem_zalloc(sizeof (systrace_sysent_t) * 607c478bd9Sstevel@tonic-gate NSYSCALL, KM_SLEEP); 617c478bd9Sstevel@tonic-gate } 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate for (i = 0; i < NSYSCALL; i++) { 647c478bd9Sstevel@tonic-gate struct sysent *a = &actual[i]; 657c478bd9Sstevel@tonic-gate systrace_sysent_t *s = &sysent[i]; 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate if (LOADABLE_SYSCALL(a) && !LOADED_SYSCALL(a)) 687c478bd9Sstevel@tonic-gate continue; 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate if (a->sy_callc == dtrace_systrace_syscall) 717c478bd9Sstevel@tonic-gate continue; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 747c478bd9Sstevel@tonic-gate if (a->sy_callc == dtrace_systrace_syscall32) 757c478bd9Sstevel@tonic-gate continue; 767c478bd9Sstevel@tonic-gate #endif 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate s->stsy_underlying = a->sy_callc; 797c478bd9Sstevel@tonic-gate } 807c478bd9Sstevel@tonic-gate } 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 837c478bd9Sstevel@tonic-gate static void 847c478bd9Sstevel@tonic-gate systrace_provide(void *arg, const dtrace_probedesc_t *desc) 857c478bd9Sstevel@tonic-gate { 867c478bd9Sstevel@tonic-gate int i; 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate if (desc != NULL) 897c478bd9Sstevel@tonic-gate return; 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate systrace_init(sysent, &systrace_sysent); 927c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 937c478bd9Sstevel@tonic-gate systrace_init(sysent32, &systrace_sysent32); 947c478bd9Sstevel@tonic-gate #endif 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate for (i = 0; i < NSYSCALL; i++) { 977c478bd9Sstevel@tonic-gate if (systrace_sysent[i].stsy_underlying == NULL) 987c478bd9Sstevel@tonic-gate continue; 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate if (dtrace_probe_lookup(systrace_id, NULL, 1017c478bd9Sstevel@tonic-gate syscallnames[i], "entry") != 0) 1027c478bd9Sstevel@tonic-gate continue; 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], 1057c478bd9Sstevel@tonic-gate "entry", SYSTRACE_ARTIFICIAL_FRAMES, 1067c478bd9Sstevel@tonic-gate (void *)((uintptr_t)SYSTRACE_ENTRY(i))); 1077c478bd9Sstevel@tonic-gate (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i], 1087c478bd9Sstevel@tonic-gate "return", SYSTRACE_ARTIFICIAL_FRAMES, 1097c478bd9Sstevel@tonic-gate (void *)((uintptr_t)SYSTRACE_RETURN(i))); 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate systrace_sysent[i].stsy_entry = DTRACE_IDNONE; 1127c478bd9Sstevel@tonic-gate systrace_sysent[i].stsy_return = DTRACE_IDNONE; 1137c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1147c478bd9Sstevel@tonic-gate systrace_sysent32[i].stsy_entry = DTRACE_IDNONE; 1157c478bd9Sstevel@tonic-gate systrace_sysent32[i].stsy_return = DTRACE_IDNONE; 1167c478bd9Sstevel@tonic-gate #endif 1177c478bd9Sstevel@tonic-gate } 1187c478bd9Sstevel@tonic-gate } 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1217c478bd9Sstevel@tonic-gate static void 1227c478bd9Sstevel@tonic-gate systrace_destroy(void *arg, dtrace_id_t id, void *parg) 1237c478bd9Sstevel@tonic-gate { 1247c478bd9Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * There's nothing to do here but assert that we have actually been 1287c478bd9Sstevel@tonic-gate * disabled. 1297c478bd9Sstevel@tonic-gate */ 1307c478bd9Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 1317c478bd9Sstevel@tonic-gate ASSERT(systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE); 1327c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1337c478bd9Sstevel@tonic-gate ASSERT(systrace_sysent32[sysnum].stsy_entry == DTRACE_IDNONE); 1347c478bd9Sstevel@tonic-gate #endif 1357c478bd9Sstevel@tonic-gate } else { 1367c478bd9Sstevel@tonic-gate ASSERT(systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE); 1377c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1387c478bd9Sstevel@tonic-gate ASSERT(systrace_sysent32[sysnum].stsy_return == DTRACE_IDNONE); 1397c478bd9Sstevel@tonic-gate #endif 1407c478bd9Sstevel@tonic-gate } 1417c478bd9Sstevel@tonic-gate } 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1447c478bd9Sstevel@tonic-gate static void 1457c478bd9Sstevel@tonic-gate systrace_enable(void *arg, dtrace_id_t id, void *parg) 1467c478bd9Sstevel@tonic-gate { 1477c478bd9Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 1487c478bd9Sstevel@tonic-gate int enabled = (systrace_sysent[sysnum].stsy_entry != DTRACE_IDNONE || 1497c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return != DTRACE_IDNONE); 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 1527c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_entry = id; 1537c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1547c478bd9Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_entry = id; 1557c478bd9Sstevel@tonic-gate #endif 1567c478bd9Sstevel@tonic-gate } else { 1577c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return = id; 1587c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1597c478bd9Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_return = id; 1607c478bd9Sstevel@tonic-gate #endif 1617c478bd9Sstevel@tonic-gate } 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate if (enabled) { 1647c478bd9Sstevel@tonic-gate ASSERT(sysent[sysnum].sy_callc == dtrace_systrace_syscall); 1657c478bd9Sstevel@tonic-gate return; 1667c478bd9Sstevel@tonic-gate } 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate (void) casptr(&sysent[sysnum].sy_callc, 1697c478bd9Sstevel@tonic-gate (void *)systrace_sysent[sysnum].stsy_underlying, 1707c478bd9Sstevel@tonic-gate (void *)dtrace_systrace_syscall); 1717c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1727c478bd9Sstevel@tonic-gate (void) casptr(&sysent32[sysnum].sy_callc, 1737c478bd9Sstevel@tonic-gate (void *)systrace_sysent32[sysnum].stsy_underlying, 1747c478bd9Sstevel@tonic-gate (void *)dtrace_systrace_syscall32); 1757c478bd9Sstevel@tonic-gate #endif 1767c478bd9Sstevel@tonic-gate } 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 1797c478bd9Sstevel@tonic-gate static void 1807c478bd9Sstevel@tonic-gate systrace_disable(void *arg, dtrace_id_t id, void *parg) 1817c478bd9Sstevel@tonic-gate { 1827c478bd9Sstevel@tonic-gate int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg); 1837c478bd9Sstevel@tonic-gate int disable = (systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE || 1847c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE); 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate if (disable) { 1877c478bd9Sstevel@tonic-gate (void) casptr(&sysent[sysnum].sy_callc, 1887c478bd9Sstevel@tonic-gate (void *)dtrace_systrace_syscall, 1897c478bd9Sstevel@tonic-gate (void *)systrace_sysent[sysnum].stsy_underlying); 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1927c478bd9Sstevel@tonic-gate (void) casptr(&sysent32[sysnum].sy_callc, 1937c478bd9Sstevel@tonic-gate (void *)dtrace_systrace_syscall32, 1947c478bd9Sstevel@tonic-gate (void *)systrace_sysent32[sysnum].stsy_underlying); 1957c478bd9Sstevel@tonic-gate #endif 1967c478bd9Sstevel@tonic-gate } 1977c478bd9Sstevel@tonic-gate 1987c478bd9Sstevel@tonic-gate if (SYSTRACE_ISENTRY((uintptr_t)parg)) { 1997c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_entry = DTRACE_IDNONE; 2007c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 2017c478bd9Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_entry = DTRACE_IDNONE; 2027c478bd9Sstevel@tonic-gate #endif 2037c478bd9Sstevel@tonic-gate } else { 2047c478bd9Sstevel@tonic-gate systrace_sysent[sysnum].stsy_return = DTRACE_IDNONE; 2057c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 2067c478bd9Sstevel@tonic-gate systrace_sysent32[sysnum].stsy_return = DTRACE_IDNONE; 2077c478bd9Sstevel@tonic-gate #endif 2087c478bd9Sstevel@tonic-gate } 2097c478bd9Sstevel@tonic-gate } 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate static dtrace_pattr_t systrace_attr = { 2127c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 2137c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 2147c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 2157c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 2167c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 2177c478bd9Sstevel@tonic-gate }; 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate static dtrace_pops_t systrace_pops = { 2207c478bd9Sstevel@tonic-gate systrace_provide, 2217c478bd9Sstevel@tonic-gate NULL, 2227c478bd9Sstevel@tonic-gate systrace_enable, 2237c478bd9Sstevel@tonic-gate systrace_disable, 2247c478bd9Sstevel@tonic-gate NULL, 2257c478bd9Sstevel@tonic-gate NULL, 2267c478bd9Sstevel@tonic-gate NULL, 2277c478bd9Sstevel@tonic-gate NULL, 2287c478bd9Sstevel@tonic-gate NULL, 2297c478bd9Sstevel@tonic-gate systrace_destroy 2307c478bd9Sstevel@tonic-gate }; 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate static int 2337c478bd9Sstevel@tonic-gate systrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) 2347c478bd9Sstevel@tonic-gate { 2357c478bd9Sstevel@tonic-gate switch (cmd) { 2367c478bd9Sstevel@tonic-gate case DDI_ATTACH: 2377c478bd9Sstevel@tonic-gate break; 2387c478bd9Sstevel@tonic-gate case DDI_RESUME: 2397c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 2407c478bd9Sstevel@tonic-gate default: 2417c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 2427c478bd9Sstevel@tonic-gate } 2437c478bd9Sstevel@tonic-gate 244*2b6e762cSahl systrace_probe = (void (*)())dtrace_probe; 2457c478bd9Sstevel@tonic-gate membar_enter(); 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate if (ddi_create_minor_node(devi, "systrace", S_IFCHR, 0, 2487c478bd9Sstevel@tonic-gate DDI_PSEUDO, NULL) == DDI_FAILURE || 249ad4023c4Sdp dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER, NULL, 2507c478bd9Sstevel@tonic-gate &systrace_pops, NULL, &systrace_id) != 0) { 2517c478bd9Sstevel@tonic-gate systrace_probe = systrace_stub; 2527c478bd9Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL); 2537c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 2547c478bd9Sstevel@tonic-gate } 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate ddi_report_dev(devi); 2577c478bd9Sstevel@tonic-gate systrace_devi = devi; 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 2607c478bd9Sstevel@tonic-gate } 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate static int 2637c478bd9Sstevel@tonic-gate systrace_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) 2647c478bd9Sstevel@tonic-gate { 2657c478bd9Sstevel@tonic-gate switch (cmd) { 2667c478bd9Sstevel@tonic-gate case DDI_DETACH: 2677c478bd9Sstevel@tonic-gate break; 2687c478bd9Sstevel@tonic-gate case DDI_SUSPEND: 2697c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 2707c478bd9Sstevel@tonic-gate default: 2717c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 2727c478bd9Sstevel@tonic-gate } 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate if (dtrace_unregister(systrace_id) != 0) 2757c478bd9Sstevel@tonic-gate return (DDI_FAILURE); 2767c478bd9Sstevel@tonic-gate 2777c478bd9Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL); 2787c478bd9Sstevel@tonic-gate systrace_probe = systrace_stub; 2797c478bd9Sstevel@tonic-gate return (DDI_SUCCESS); 2807c478bd9Sstevel@tonic-gate } 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 2837c478bd9Sstevel@tonic-gate static int 2847c478bd9Sstevel@tonic-gate systrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result) 2857c478bd9Sstevel@tonic-gate { 2867c478bd9Sstevel@tonic-gate int error; 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate switch (infocmd) { 2897c478bd9Sstevel@tonic-gate case DDI_INFO_DEVT2DEVINFO: 2907c478bd9Sstevel@tonic-gate *result = (void *)systrace_devi; 2917c478bd9Sstevel@tonic-gate error = DDI_SUCCESS; 2927c478bd9Sstevel@tonic-gate break; 2937c478bd9Sstevel@tonic-gate case DDI_INFO_DEVT2INSTANCE: 2947c478bd9Sstevel@tonic-gate *result = (void *)0; 2957c478bd9Sstevel@tonic-gate error = DDI_SUCCESS; 2967c478bd9Sstevel@tonic-gate break; 2977c478bd9Sstevel@tonic-gate default: 2987c478bd9Sstevel@tonic-gate error = DDI_FAILURE; 2997c478bd9Sstevel@tonic-gate } 3007c478bd9Sstevel@tonic-gate return (error); 3017c478bd9Sstevel@tonic-gate } 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 3047c478bd9Sstevel@tonic-gate static int 3057c478bd9Sstevel@tonic-gate systrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p) 3067c478bd9Sstevel@tonic-gate { 3077c478bd9Sstevel@tonic-gate return (0); 3087c478bd9Sstevel@tonic-gate } 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate static struct cb_ops systrace_cb_ops = { 3117c478bd9Sstevel@tonic-gate systrace_open, /* open */ 3127c478bd9Sstevel@tonic-gate nodev, /* close */ 3137c478bd9Sstevel@tonic-gate nulldev, /* strategy */ 3147c478bd9Sstevel@tonic-gate nulldev, /* print */ 3157c478bd9Sstevel@tonic-gate nodev, /* dump */ 3167c478bd9Sstevel@tonic-gate nodev, /* read */ 3177c478bd9Sstevel@tonic-gate nodev, /* write */ 3187c478bd9Sstevel@tonic-gate nodev, /* ioctl */ 3197c478bd9Sstevel@tonic-gate nodev, /* devmap */ 3207c478bd9Sstevel@tonic-gate nodev, /* mmap */ 3217c478bd9Sstevel@tonic-gate nodev, /* segmap */ 3227c478bd9Sstevel@tonic-gate nochpoll, /* poll */ 3237c478bd9Sstevel@tonic-gate ddi_prop_op, /* cb_prop_op */ 3247c478bd9Sstevel@tonic-gate 0, /* streamtab */ 3257c478bd9Sstevel@tonic-gate D_NEW | D_MP /* Driver compatibility flag */ 3267c478bd9Sstevel@tonic-gate }; 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate static struct dev_ops systrace_ops = { 3297c478bd9Sstevel@tonic-gate DEVO_REV, /* devo_rev, */ 3307c478bd9Sstevel@tonic-gate 0, /* refcnt */ 3317c478bd9Sstevel@tonic-gate systrace_info, /* get_dev_info */ 3327c478bd9Sstevel@tonic-gate nulldev, /* identify */ 3337c478bd9Sstevel@tonic-gate nulldev, /* probe */ 3347c478bd9Sstevel@tonic-gate systrace_attach, /* attach */ 3357c478bd9Sstevel@tonic-gate systrace_detach, /* detach */ 3367c478bd9Sstevel@tonic-gate nodev, /* reset */ 3377c478bd9Sstevel@tonic-gate &systrace_cb_ops, /* driver operations */ 3387c478bd9Sstevel@tonic-gate NULL, /* bus operations */ 3397c478bd9Sstevel@tonic-gate nodev /* dev power */ 3407c478bd9Sstevel@tonic-gate }; 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate /* 3437c478bd9Sstevel@tonic-gate * Module linkage information for the kernel. 3447c478bd9Sstevel@tonic-gate */ 3457c478bd9Sstevel@tonic-gate static struct modldrv modldrv = { 3467c478bd9Sstevel@tonic-gate &mod_driverops, /* module type (this is a pseudo driver) */ 3477c478bd9Sstevel@tonic-gate "System Call Tracing", /* name of module */ 3487c478bd9Sstevel@tonic-gate &systrace_ops, /* driver ops */ 3497c478bd9Sstevel@tonic-gate }; 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate static struct modlinkage modlinkage = { 3527c478bd9Sstevel@tonic-gate MODREV_1, 3537c478bd9Sstevel@tonic-gate (void *)&modldrv, 3547c478bd9Sstevel@tonic-gate NULL 3557c478bd9Sstevel@tonic-gate }; 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate int 3587c478bd9Sstevel@tonic-gate _init(void) 3597c478bd9Sstevel@tonic-gate { 3607c478bd9Sstevel@tonic-gate return (mod_install(&modlinkage)); 3617c478bd9Sstevel@tonic-gate } 3627c478bd9Sstevel@tonic-gate 3637c478bd9Sstevel@tonic-gate int 3647c478bd9Sstevel@tonic-gate _info(struct modinfo *modinfop) 3657c478bd9Sstevel@tonic-gate { 3667c478bd9Sstevel@tonic-gate return (mod_info(&modlinkage, modinfop)); 3677c478bd9Sstevel@tonic-gate } 3687c478bd9Sstevel@tonic-gate 3697c478bd9Sstevel@tonic-gate int 3707c478bd9Sstevel@tonic-gate _fini(void) 3717c478bd9Sstevel@tonic-gate { 3727c478bd9Sstevel@tonic-gate return (mod_remove(&modlinkage)); 3737c478bd9Sstevel@tonic-gate } 374