Deleted Added
full compact
23c23
< * $FreeBSD: head/sys/cddl/dev/systrace/systrace.c 179237 2008-05-23 05:59:42Z jb $
---
> * $FreeBSD: head/sys/cddl/dev/systrace/systrace.c 184698 2008-11-05 19:39:11Z rodrigc $
53,54d52
< #include <sys/syscall.h>
< #include <sys/sysent.h>
55a54
> #include <sys/sysent.h>
61a61,87
> #ifdef LINUX_SYSTRACE
> #include <linux.h>
> #include <linux_syscall.h>
> #include <linux_proto.h>
> #include <linux_syscallnames.c>
> #include <linux_systrace.c>
> extern struct sysent linux_sysent[];
> #define DEVNAME "dtrace/linsystrace"
> #define PROVNAME "linsyscall"
> #define MAXSYSCALL LINUX_SYS_MAXSYSCALL
> #define SYSCALLNAMES linux_syscallnames
> #define SYSENT linux_sysent
> #else
> /*
> * The syscall arguments are processed into a DTrace argument array
> * using a generated function. See sys/kern/makesyscalls.sh.
> */
> #include <sys/syscall.h>
> #include <kern/systrace_args.c>
> extern const char *syscallnames[];
> #define DEVNAME "dtrace/systrace"
> #define PROVNAME "syscall"
> #define MAXSYSCALL SYS_MAXSYSCALL
> #define SYSCALLNAMES syscallnames
> #define SYSENT sysent
> #endif
>
70c96
< #if ((1 << SYSTRACE_SHIFT) <= SYS_MAXSYSCALL)
---
> #if ((1 << SYSTRACE_SHIFT) <= MAXSYSCALL)
74,75d99
< extern char *syscallnames[];
<
79,80d102
< static void systrace_args(int, void *, u_int64_t *, int *);
< static void systrace_probe(u_int32_t, int, struct sysent *, void *);
89a112,114
> #ifdef LINUX_SYSTRACE
> .d_name = "linsystrace",
> #else
90a116
> #endif
92a119,123
> static union {
> const char **p_constnames;
> char **pp_syscallnames;
> } uglyhack = { SYSCALLNAMES };
>
116a148
> #if !defined(LINUX_SYSTRACE)
118,119c150,154
< * The syscall arguments are processed into a DTrace argument array
< * using a generated function. See sys/kern/makesyscalls.sh.
---
> * Probe callback function.
> *
> * Note: This function is called for _all_ syscalls, regardless of which sysent
> * array the syscall comes from. It could be a standard syscall or a
> * compat syscall from something like Linux.
121,122d155
< #include <kern/systrace_args.c>
<
130,132c163,164
< * Check if this syscall has a custom argument conversion
< * function registered. If so, it is a syscall registered
< * by a loaded module.
---
> * Check if this syscall has an argument conversion function
> * registered.
139c171
< (*sysent->sy_systrace_args_func)(params, uargs, &n_args);
---
> (*sysent->sy_systrace_args_func)(sysnum, params, uargs, &n_args);
144c176
< * into thhe array of 64-bit values that DTrace
---
> * into the array of 64-bit values that DTrace
151a184
> #endif
175c208
< for (i = 0; i < SYS_MAXSYSCALL; i++) {
---
> for (i = 0; i < MAXSYSCALL; i++) {
177c210
< syscallnames[i], "entry") != 0)
---
> uglyhack.pp_syscallnames[i], "entry") != 0)
180c213
< (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
---
> (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i],
183c216
< (void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
---
> (void) dtrace_probe_create(systrace_id, NULL, uglyhack.pp_syscallnames[i],
211a245,247
> if (SYSENT[sysnum].sy_systrace_args_func == NULL)
> SYSENT[sysnum].sy_systrace_args_func = systrace_args;
>
213c249
< sysent[sysnum].sy_entry = id;
---
> SYSENT[sysnum].sy_entry = id;
215c251
< sysent[sysnum].sy_return = id;
---
> SYSENT[sysnum].sy_return = id;
223,224c259,260
< sysent[sysnum].sy_entry = 0;
< sysent[sysnum].sy_return = 0;
---
> SYSENT[sysnum].sy_entry = 0;
> SYSENT[sysnum].sy_return = 0;
232c268
< "dtrace/systrace");
---
> DEVNAME);
234c270
< if (dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER,
---
> if (dtrace_register(PROVNAME, &systrace_attr, DTRACE_PRIV_USER,
237a274
> #if !defined(LINUX_SYSTRACE)
238a276
> #endif
249a288
> #if !defined(LINUX_SYSTRACE)
250a290
> #endif
288a329,336
> #ifdef LINUX_SYSTRACE
> DEV_MODULE(linsystrace, systrace_modevent, NULL);
> MODULE_VERSION(linsystrace, 1);
> MODULE_DEPEND(linsystrace, linux, 1, 1, 1);
> MODULE_DEPEND(linsystrace, systrace, 1, 1, 1);
> MODULE_DEPEND(linsystrace, dtrace, 1, 1, 1);
> MODULE_DEPEND(linsystrace, opensolaris, 1, 1, 1);
> #else
292a341
> #endif