Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common improve the (#ifdef DEBUG_LINUX) soc...



details:   https://anonhg.NetBSD.org/src/rev/924e62a4471c
branches:  trunk
changeset: 569776:924e62a4471c
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Sep 05 09:09:02 2004 +0000

description:
improve the (#ifdef DEBUG_LINUX) socketcall argument dump code:
- print the socketcall type
- special case socket(2) call, it's also the only one with first argument
  not being a socket descriptor
- only dump the relevant part of linux_socketcall_dummy_args, instead
  of always the whole structure

diffstat:

 sys/compat/linux/common/linux_socketcall.c |  30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r 3cadea90a1aa -r 924e62a4471c sys/compat/linux/common/linux_socketcall.c
--- a/sys/compat/linux/common/linux_socketcall.c        Sun Sep 05 08:48:32 2004 +0000
+++ b/sys/compat/linux/common/linux_socketcall.c        Sun Sep 05 09:09:02 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_socketcall.c,v 1.26 2004/08/29 20:45:18 jdolecek Exp $   */
+/*     $NetBSD: linux_socketcall.c,v 1.27 2004/09/05 09:09:02 jdolecek Exp $   */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.26 2004/08/29 20:45:18 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.27 2004/09/05 09:09:02 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -142,14 +142,28 @@
        }
 
 #ifdef DEBUG_LINUX
+       /* dump the passed argument data */
        {
-               int i;
-               u_int8_t *data = (void *)&lda.dummy_ints[1];
+               DPRINTF(("linux_socketcall('%s'): ",
+                   linux_socketcall[SCARG(uap, what)].name));
 
-               DPRINTF(("linux_socketcall: socket %d [", lda.dummy_ints[0]));
-               for(i=0; i < sizeof(lda) - sizeof(lda.dummy_ints[0]); i++)
-                       DPRINTF(("%02x ", data[i]));
-               DPRINTF(("]\n"));
+               if (SCARG(uap, what) == LINUX_SYS_socket) {
+                       DPRINTF(("[dom %d type %d proto %d]\n",
+                               lda.dummy_ints[0],
+                               lda.dummy_ints[1],
+                               lda.dummy_ints[2]));
+               } else {
+                       int i, sz;
+                       u_int8_t *data = (u_int8_t *)&lda.dummy_ints[1];
+
+                       sz = linux_socketcall[SCARG(uap, what)].argsize
+                           - sizeof(lda.dummy_ints[0]);
+
+                       DPRINTF(("socket %d [", lda.dummy_ints[0]));
+                       for(i=0; i < sz; i++)
+                               DPRINTF(("%02x ", data[i]));
+                       DPRINTF(("]\n"));
+               }
        }
 #endif
 



Home | Main Index | Thread Index | Old Index