(Ab)use a KTR_USER trace entry for the linux socket command and arguments.

This commit is contained in:
dsl 2007-06-01 22:42:47 +00:00
parent 79b4d16759
commit d95fed7315
2 changed files with 28 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socketcall.c,v 1.32 2007/03/04 06:01:24 christos Exp $ */
/* $NetBSD: linux_socketcall.c,v 1.33 2007/06/01 22:42:47 dsl Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,8 +37,9 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.32 2007/03/04 06:01:24 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.33 2007/06/01 22:42:47 dsl Exp $");
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
@ -58,6 +59,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.32 2007/03/04 06:01:24 christ
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/device.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
#include <sys/syscallargs.h>
@ -133,13 +137,20 @@ linux_sys_socketcall(l, v, retval)
if (SCARG(uap, what) < 0 || SCARG(uap, what) > LINUX_MAX_SOCKETCALL)
return ENOSYS;
if ((error = copyin((void *) SCARG(uap, args), (void *) &lda,
if ((error = copyin(SCARG(uap, args), &lda,
linux_socketcall[SCARG(uap, what)].argsize))) {
DPRINTF(("copyin for %s failed %d\n",
linux_socketcall[SCARG(uap, what)].name, error));
return error;
}
#ifdef KTRACE
if (KTRPOINT(l->l_proc, KTR_USER))
ktrkuser(l, linux_socketcall[SCARG(uap, what)].name,
&lda, linux_socketcall[SCARG(uap, what)].argsize);
#endif
#ifdef DEBUG_LINUX
/* dump the passed argument data */
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux32_socketcall.c,v 1.2 2007/03/18 21:38:32 dsl Exp $ */
/* $NetBSD: linux32_socketcall.c,v 1.3 2007/06/01 22:42:47 dsl Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@ -31,12 +31,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_socketcall.c,v 1.2 2007/03/18 21:38:32 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_socketcall.c,v 1.3 2007/06/01 22:42:47 dsl Exp $");
#include "opt_ktrace.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/ucred.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
@ -101,5 +106,12 @@ linux32_sys_socketcall(l, v, retval)
linux32_socketcall[SCARG(uap, what)].argsize)) != 0)
return error;
#ifdef KTRACE
/* Trace the socket-call arguments as 'GIO' on fd -1 */
if (KTRPOINT(l->l_proc, KTR_USER))
ktrkuser(l, linux32_socketcall[SCARG(uap, what)].name,
&ua, linux32_socketcall[SCARG(uap, what)].argsize);
#endif
return linux32_socketcall[SCARG(uap, what)].syscall(l, &ua, retval);
}