dtrace_modevent.c revision 1.2
1/*	$NetBSD: dtrace_modevent.c,v 1.2 2010/02/21 01:46:33 darran 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	int error = 0;
33
34	switch (cmd) {
35	case MODULE_CMD_INIT:
36		dtrace_load(NULL);
37		return devsw_attach("dtrace", NULL, &bmajor,
38		    &dtrace_cdevsw, &cmajor);
39	case MODULE_CMD_FINI:
40		dtrace_unload();
41		return devsw_detach(NULL, &dtrace_cdevsw);
42	default:
43		return ENOTTY;
44	}
45}
46