Deleted Added
full compact
dtrace_ioctl.c (184698) dtrace_ioctl.c (211608)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 4 unchanged lines hidden (view full) ---

13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 4 unchanged lines hidden (view full) ---

13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * $FreeBSD: head/sys/cddl/dev/dtrace/dtrace_ioctl.c 184698 2008-11-05 19:39:11Z rodrigc $
21 * $FreeBSD: head/sys/cddl/dev/dtrace/dtrace_ioctl.c 211608 2010-08-22 10:53:32Z rpaulo $
22 *
23 */
24
25static int dtrace_verbose_ioctl;
26SYSCTL_INT(_debug_dtrace, OID_AUTO, verbose_ioctl, CTLFLAG_RW, &dtrace_verbose_ioctl, 0, "");
27
28#define DTRACE_IOCTL_PRINTF(fmt, ...) if (dtrace_verbose_ioctl) printf(fmt, ## __VA_ARGS__ )
29
22 *
23 */
24
25static int dtrace_verbose_ioctl;
26SYSCTL_INT(_debug_dtrace, OID_AUTO, verbose_ioctl, CTLFLAG_RW, &dtrace_verbose_ioctl, 0, "");
27
28#define DTRACE_IOCTL_PRINTF(fmt, ...) if (dtrace_verbose_ioctl) printf(fmt, ## __VA_ARGS__ )
29
30static int
31dtrace_ioctl_helper(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
32 struct thread *td)
33{
34 int rval;
35 dof_helper_t *dhp = NULL;
36 dof_hdr_t *dof = NULL;
37
38 switch (cmd) {
39 case DTRACEHIOC_ADDDOF:
40 dhp = (dof_helper_t *)addr;
41 /* XXX all because dofhp_dof is 64 bit */
42#ifdef __i386
43 addr = (caddr_t)(uint32_t)dhp->dofhp_dof;
44#else
45 addr = (caddr_t)dhp->dofhp_dof;
46#endif
47 /* FALLTHROUGH */
48 case DTRACEHIOC_ADD:
49 dof = dtrace_dof_copyin((intptr_t)addr, &rval);
50
51 if (dof == NULL)
52 return (rval);
53
54 mutex_enter(&dtrace_lock);
55 if ((rval = dtrace_helper_slurp((dof_hdr_t *)dof, dhp)) != -1) {
56 if (dhp) {
57 dhp->gen = rval;
58 copyout(dhp, addr, sizeof(*dhp));
59 }
60 rval = 0;
61 } else {
62 rval = EINVAL;
63 }
64 mutex_exit(&dtrace_lock);
65 return (rval);
66 case DTRACEHIOC_REMOVE:
67 mutex_enter(&dtrace_lock);
68 rval = dtrace_helper_destroygen((int)*addr);
69 mutex_exit(&dtrace_lock);
70
71 return (rval);
72 default:
73 break;
74 }
75
76 return (ENOTTY);
77}
78
30/* ARGSUSED */
31static int
32dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
33 int flags __unused, struct thread *td)
34{
35#if __FreeBSD_version < 800039
36 dtrace_state_t *state = dev->si_drv1;
37#else

--- 745 unchanged lines hidden ---
79/* ARGSUSED */
80static int
81dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
82 int flags __unused, struct thread *td)
83{
84#if __FreeBSD_version < 800039
85 dtrace_state_t *state = dev->si_drv1;
86#else

--- 745 unchanged lines hidden ---