FreeBSD/sys/cddl/dev/systrace/systrace.c
/*
 * 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.
 */
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.
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 .
static void
systrace_probe(struct syscall_args *sa, enum systrace_probe_t type, int retval)
{
	uint64_t uargs[nitems(sa->args)];
	dtrace_id_t id;
	int n_args, sysnum;
	sysnum = sa->code;
	memset(uargs, 0, sizeof(uargs));
	if (type == SYSTRACE_ENTRY) {
		id = sa->callp->sy_entry;
		if (sa->callp->sy_systrace_args_func != NULL)
			(*sa->callp->sy_systrace_args_func)(sysnum, sa->args,
			    uargs, &n_args);
		else
			systrace_args(sysnum, sa->args, uargs, &n_args);
		curthread->t_dtrace_systrace_args = uargs;
	} else {
		id = sa->callp->sy_return;
		curthread->t_dtrace_systrace_args = NULL;
		uargs[0] = uargs[1] = retval;
	}
	dtrace_probe(id, uargs[0], uargs[1], uargs[2], uargs[3], uargs[4]);
}
static void systrace_probe ( struct syscall_args * sa , enum systrace_probe_t type , int retval ) { uint64_t uargs [ nitems ( sa -> args ) ] ; dtrace_id_t id ; int n_args , sysnum ; sysnum = sa -> code ; memset ( uargs , 0 , sizeof ( uargs ) ) ; if ( type == SYSTRACE_ENTRY ) { id = sa -> callp -> sy_entry ; if ( sa -> callp -> sy_systrace_args_func != NULL ) ( * sa -> callp -> sy_systrace_args_func ) ( sysnum , sa -> args , uargs , & n_args ) ; else systrace_args ( sysnum , sa -> args , uargs , & n_args ) ; curthread -> t_dtrace_systrace_args = uargs ; } else { id = sa -> callp -> sy_return ; curthread -> t_dtrace_systrace_args = NULL ; uargs [ 0 ] = uargs [ 1 ] = retval ; } dtrace_probe ( id , uargs [ 0 ] , uargs [ 1 ] , uargs [ 2 ] , uargs [ 3 ] , uargs [ 4 ] ) ; }
Probe callback function.
Probe callback function .
/*
			 * Convert the syscall parameters using the registered
			 * function.
			 */ /*
			 * Use the built-in system call argument conversion
			 * function to translate the syscall structure fields
			 * into the array of 64-bit values that DTrace expects.
			 */ /*
		 * Save probe arguments now so that we can retrieve them if
		 * the getargval method is called from further down the stack.
		 */ /* Set arg0 and arg1 as the return value of this syscall. */ /* Process the probe using the converted argments. */