dtrace_modevent.c revision 1.3
1/*	$NetBSD: dtrace_modevent.c,v 1.3 2010/03/13 22:31:15 christos Exp $	*/
2
3/*
4 * CDDL HEADER START
5 *
6 * The contents of this file are subject to the terms of the
7 * Common Development and Distribution License (the "License").
8 * You may not use this file except in compliance with the License.
9 *
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions
13 * and limitations under the License.
14 *
15 * When distributing Covered Code, include this CDDL HEADER in each
16 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 * If applicable, add the following below this CDDL HEADER, with the
18 * fields enclosed by brackets "[]" replaced with your own identifying
19 * information: Portions Copyright [yyyy] [name of copyright owner]
20 *
21 * CDDL HEADER END
22 *
23 * $FreeBSD: src/sys/cddl/dev/dtrace/dtrace_modevent.c,v 1.1.4.1 2009/08/03 08:13:06 kensmith Exp $
24 *
25 */
26
27/* ARGSUSED */
28static int
29dtrace_modcmd(modcmd_t cmd, void *data)
30{
31	int bmajor = -1, cmajor = -1;
32
33	switch (cmd) {
34	case MODULE_CMD_INIT:
35		dtrace_load(NULL);
36		return devsw_attach("dtrace", NULL, &bmajor,
37		    &dtrace_cdevsw, &cmajor);
38	case MODULE_CMD_FINI:
39		dtrace_unload();
40		return devsw_detach(NULL, &dtrace_cdevsw);
41	default:
42		return ENOTTY;
43	}
44}
45