systrace.c (211608) | systrace.c (219561) |
---|---|
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 * | 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 $ | 23 * $FreeBSD: head/sys/cddl/dev/systrace/systrace.c 219561 2011-03-12 09:09:25Z avg $ |
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 | 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> | 62#if defined(__amd64__) 63#include <amd64/linux32/linux.h> 64#include <amd64/linux32/linux32_proto.h> 65#include <amd64/linux32/linux32_syscalls.c> 66#include <amd64/linux32/linux32_systrace_args.c> 67#elif defined(__i386__) 68#include <i386/linux/linux.h> 69#include <i386/linux/linux_proto.h> 70#include <i386/linux/linux_syscalls.c> 71#include <i386/linux/linux_systrace_args.c> 72#else 73#error Only i386 and amd64 are supported. 74#endif |
67extern struct sysent linux_sysent[]; | 75extern struct sysent linux_sysent[]; |
68#define DEVNAME "dtrace/linsystrace" 69#define PROVNAME "linsyscall" | 76#define MODNAME "linux32" |
70#define MAXSYSCALL LINUX_SYS_MAXSYSCALL 71#define SYSCALLNAMES linux_syscallnames 72#define SYSENT linux_sysent | 77#define MAXSYSCALL LINUX_SYS_MAXSYSCALL 78#define SYSCALLNAMES linux_syscallnames 79#define SYSENT linux_sysent |
80#elif defined(FREEBSD32_SYSTRACE) 81/* 82 * The syscall arguments are processed into a DTrace argument array 83 * using a generated function. See sys/kern/makesyscalls.sh. 84 */ 85#include <compat/freebsd32/freebsd32_proto.h> 86#include <compat/freebsd32/freebsd32_util.h> 87#include <compat/freebsd32/freebsd32_syscall.h> 88#include <compat/freebsd32/freebsd32_systrace_args.c> 89extern const char *freebsd32_syscallnames[]; 90#define MODNAME "freebsd32" 91#define MAXSYSCALL FREEBSD32_SYS_MAXSYSCALL 92#define SYSCALLNAMES freebsd32_syscallnames 93#define SYSENT freebsd32_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> | 94#else 95/* 96 * The syscall arguments are processed into a DTrace argument array 97 * using a generated function. See sys/kern/makesyscalls.sh. 98 */ 99#include <sys/syscall.h> 100#include <kern/systrace_args.c> |
80#define DEVNAME "dtrace/systrace" 81#define PROVNAME "syscall" | 101#define MODNAME "freebsd" |
82#define MAXSYSCALL SYS_MAXSYSCALL 83#define SYSCALLNAMES syscallnames 84#define SYSENT sysent 85#endif 86 | 102#define MAXSYSCALL SYS_MAXSYSCALL 103#define SYSCALLNAMES syscallnames 104#define SYSENT sysent 105#endif 106 |
107#define PROVNAME "syscall" 108#define DEVNAME "dtrace/systrace/" MODNAME 109 |
|
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++) { | 110#define SYSTRACE_ARTIFICIAL_FRAMES 1 111 112#define SYSTRACE_SHIFT 16 113#define SYSTRACE_ISENTRY(x) ((int)(x) >> SYSTRACE_SHIFT) 114#define SYSTRACE_SYSNUM(x) ((int)(x) & ((1 << SYSTRACE_SHIFT) - 1)) 115#define SYSTRACE_ENTRY(id) ((1 << SYSTRACE_SHIFT) | (id)) 116#define SYSTRACE_RETURN(id) (id) 117 --- 114 unchanged lines hidden (view full) --- 232systrace_provide(void *arg, dtrace_probedesc_t *desc) 233{ 234 int i; 235 236 if (desc != NULL) 237 return; 238 239 for (i = 0; i < MAXSYSCALL; i++) { |
217 if (dtrace_probe_lookup(systrace_id, NULL, | 240 if (dtrace_probe_lookup(systrace_id, MODNAME, |
218 uglyhack.pp_syscallnames[i], "entry") != 0) 219 continue; 220 | 241 uglyhack.pp_syscallnames[i], "entry") != 0) 242 continue; 243 |
221 (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], | 244 (void) dtrace_probe_create(systrace_id, MODNAME, uglyhack.pp_syscallnames[i], |
222 "entry", SYSTRACE_ARTIFICIAL_FRAMES, 223 (void *)((uintptr_t)SYSTRACE_ENTRY(i))); | 245 "entry", SYSTRACE_ARTIFICIAL_FRAMES, 246 (void *)((uintptr_t)SYSTRACE_ENTRY(i))); |
224 (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i], | 247 (void) dtrace_probe_create(systrace_id, MODNAME, 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 | 248 "return", SYSTRACE_ARTIFICIAL_FRAMES, 249 (void *)((uintptr_t)SYSTRACE_RETURN(i))); 250 } 251} 252 253static void 254systrace_destroy(void *arg, dtrace_id_t id, void *parg) 255{ --- 97 unchanged lines hidden (view full) --- 353{ 354 return (0); 355} 356 357SYSINIT(systrace_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_load, NULL); 358SYSUNINIT(systrace_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, systrace_unload, NULL); 359 360#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); | 361DEV_MODULE(systrace_linux32, systrace_modevent, NULL); 362MODULE_VERSION(systrace_linux32, 1); 363MODULE_DEPEND(systrace_linux32, linux, 1, 1, 1); 364MODULE_DEPEND(systrace_linux32, dtrace, 1, 1, 1); 365MODULE_DEPEND(systrace_linux32, opensolaris, 1, 1, 1); 366#elif defined(FREEBSD32_SYSTRACE) 367DEV_MODULE(systrace_freebsd32, systrace_modevent, NULL); 368MODULE_VERSION(systrace_freebsd32, 1); 369MODULE_DEPEND(systrace_freebsd32, dtrace, 1, 1, 1); 370MODULE_DEPEND(systrace_freebsd32, 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 | 371#else 372DEV_MODULE(systrace, systrace_modevent, NULL); 373MODULE_VERSION(systrace, 1); 374MODULE_DEPEND(systrace, dtrace, 1, 1, 1); 375MODULE_DEPEND(systrace, opensolaris, 1, 1, 1); 376#endif |