Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump Print rval[1] if non-zero and present in the t...



details:   https://anonhg.NetBSD.org/src/rev/c6615e822e3d
branches:  trunk
changeset: 547220:c6615e822e3d
user:      dsl <dsl%NetBSD.org@localhost>
date:      Thu May 15 12:57:54 2003 +0000

description:
Print rval[1] if non-zero and present in the trace entry.
To get both fd numbers for pipe().

diffstat:

 usr.bin/kdump/kdump.c |  43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diffs (109 lines):

diff -r 24607017ddc4 -r c6615e822e3d usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Thu May 15 12:56:16 2003 +0000
+++ b/usr.bin/kdump/kdump.c     Thu May 15 12:57:54 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.47 2003/01/30 21:43:26 atatat Exp $        */
+/*     $NetBSD: kdump.c,v 1.48 2003/05/15 12:57:54 dsl Exp $   */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.47 2003/01/30 21:43:26 atatat Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.48 2003/05/15 12:57:54 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -60,6 +60,7 @@
 #include <ctype.h>
 #include <err.h>
 #include <signal.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -101,7 +102,7 @@
 void   dumpheader __P((struct ktr_header *));
 void   ioctldecode __P((u_long));
 void   ktrsyscall __P((struct ktr_syscall *));
-void   ktrsysret __P((struct ktr_sysret *));
+void   ktrsysret __P((struct ktr_sysret *, int));
 void   ktrnamei __P((char *, int));
 void   ktremul __P((char *, int, int));
 void   ktrgenio __P((struct ktr_genio *, int));
@@ -111,6 +112,7 @@
 void   ktrmmsg __P((struct ktr_mmsg *, int));
 void   usage __P((void));
 void   eprint __P((int));
+void   rprint __P((register_t));
 char   *ioctlname __P((long));
 static const char *signame __P((long, int));
 
@@ -215,7 +217,7 @@
                        ktrsyscall((struct ktr_syscall *)m);
                        break;
                case KTR_SYSRET:
-                       ktrsysret((struct ktr_sysret *)m);
+                       ktrsysret((struct ktr_sysret *)m, ktrlen);
                        break;
                case KTR_NAMEI:
                        ktrnamei(m, ktrlen);
@@ -422,11 +424,11 @@
 }
 
 void
-ktrsysret(ktr)
+ktrsysret(ktr, len)
        struct ktr_sysret *ktr;
+       int len;
 {
        const struct emulation *revelant;
-       register_t ret = ktr->ktr_retval;
        int error = ktr->ktr_error;
        int code = ktr->ktr_code;
 
@@ -444,15 +446,11 @@
 
        switch (error) {
        case 0:
-               if (!plain) {
-                       (void)printf("%ld", (long)ret);
-                       if (ret < 0 || ret > 9)
-                               (void)printf("/%#lx", (long)ret);
-               } else {
-                       if (decimal)
-                               (void)printf("%ld", (long)ret);
-                       else
-                               (void)printf("%#lx", (long)ret);
+               rprint(ktr->ktr_retval);
+               if (len > offsetof(struct ktr_sysret, ktr_retval_1) &&
+                   ktr->ktr_retval_1 != 0) {
+                       (void)printf(", ");
+                       rprint(ktr->ktr_retval_1);
                }
                break;
 
@@ -463,6 +461,21 @@
        (void)putchar('\n');
 }
 
+void
+rprint(register_t ret)
+{
+       if (!plain) {
+               (void)printf("%ld", (long)ret);
+               if (ret < 0 || ret > 9)
+                       (void)printf("/%#lx", (long)ret);
+       } else {
+               if (decimal)
+                       (void)printf("%ld", (long)ret);
+               else
+                       (void)printf("%#lx", (long)ret);
+       }
+}
+
 /*
  * We print the original emulation's error numerically, but we
  * translate it to netbsd to print it symbolically.



Home | Main Index | Thread Index | Old Index