Deleted Added
sdiff udiff text old ( 211608 ) new ( 219561 )
full compact
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

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

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 * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22 *
23 * $FreeBSD: head/sys/cddl/dev/systrace/systrace.c 211608 2010-08-22 10:53:32Z rpaulo $
24 *
25 */
26
27/*
28 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
30 */
31

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

54#include <sys/sysent.h>
55#include <sys/uio.h>
56#include <sys/unistd.h>
57#include <machine/stdarg.h>
58
59#include <sys/dtrace.h>
60
61#ifdef LINUX_SYSTRACE
62#include <linux.h>
63#include <linux_syscall.h>
64#include <linux_proto.h>
65#include <linux_syscallnames.c>
66#include <linux_systrace.c>
67extern struct sysent linux_sysent[];
68#define DEVNAME "dtrace/linsystrace"
69#define PROVNAME "linsyscall"
70#define MAXSYSCALL LINUX_SYS_MAXSYSCALL
71#define SYSCALLNAMES linux_syscallnames
72#define SYSENT linux_sysent
73#else
74/*
75 * The syscall arguments are processed into a DTrace argument array
76 * using a generated function. See sys/kern/makesyscalls.sh.
77 */
78#include <sys/syscall.h>
79#include <kern/systrace_args.c>
80#define DEVNAME "dtrace/systrace"
81#define PROVNAME "syscall"
82#define MAXSYSCALL SYS_MAXSYSCALL
83#define SYSCALLNAMES syscallnames
84#define SYSENT sysent
85#endif
86
87#define SYSTRACE_ARTIFICIAL_FRAMES 1
88
89#define SYSTRACE_SHIFT 16
90#define SYSTRACE_ISENTRY(x) ((int)(x) >> SYSTRACE_SHIFT)
91#define SYSTRACE_SYSNUM(x) ((int)(x) & ((1 << SYSTRACE_SHIFT) - 1))
92#define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id))
93#define SYSTRACE_RETURN(id) (id)
94

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

209systrace_provide(void *arg, dtrace_probedesc_t *desc)
210{
211 int i;
212
213 if (desc != NULL)
214 return;
215
216 for (i = 0; i < MAXSYSCALL; i++) {
217 if (dtrace_probe_lookup(systrace_id, NULL,
218 uglyhack.pp_syscallnames[i], "entry") != 0)
219 continue;
220
221 (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i],
222 "entry", SYSTRACE_ARTIFICIAL_FRAMES,
223 (void *)((uintptr_t)SYSTRACE_ENTRY(i)));
224 (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i],
225 "return", SYSTRACE_ARTIFICIAL_FRAMES,
226 (void *)((uintptr_t)SYSTRACE_RETURN(i)));
227 }
228}
229
230static void
231systrace_destroy(void *arg, dtrace_id_t id, void *parg)
232{

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

330{
331 return (0);
332}
333
334SYSINIT(systrace_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_load, NULL);
335SYSUNINIT(systrace_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_unload, NULL);
336
337#ifdef LINUX_SYSTRACE
338DEV_MODULE(linsystrace, systrace_modevent, NULL);
339MODULE_VERSION(linsystrace, 1);
340MODULE_DEPEND(linsystrace, linux, 1, 1, 1);
341MODULE_DEPEND(linsystrace, systrace, 1, 1, 1);
342MODULE_DEPEND(linsystrace, dtrace, 1, 1, 1);
343MODULE_DEPEND(linsystrace, opensolaris, 1, 1, 1);
344#else
345DEV_MODULE(systrace, systrace_modevent, NULL);
346MODULE_VERSION(systrace, 1);
347MODULE_DEPEND(systrace, dtrace, 1, 1, 1);
348MODULE_DEPEND(systrace, opensolaris, 1, 1, 1);
349#endif