Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/kdump Drop support for KTRFACv0 (NetBSD 3) and KTRFA...



details:   https://anonhg.NetBSD.org/src/rev/12acb0c82bbd
branches:  trunk
changeset: 826501:12acb0c82bbd
user:      uwe <uwe%NetBSD.org@localhost>
date:      Fri Sep 08 20:36:56 2017 +0000

description:
Drop support for KTRFACv0 (NetBSD 3) and KTRFACv1 (NetBSD 5).
Note that on 32-bit platforms it probably never worked anyway because
header size changed from v1 to v2 when time_t became 64 bit.

ok christos@
CVS: ----------------------------------------------------------------------
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?

diffstat:

 usr.bin/kdump/kdump.c |  87 +++++++++++---------------------------------------
 1 files changed, 20 insertions(+), 67 deletions(-)

diffs (122 lines):

diff -r aa9178b8524c -r 12acb0c82bbd usr.bin/kdump/kdump.c
--- a/usr.bin/kdump/kdump.c     Fri Sep 08 15:29:43 2017 +0000
+++ b/usr.bin/kdump/kdump.c     Fri Sep 08 20:36:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kdump.c,v 1.125 2016/09/05 00:40:29 sevan Exp $        */
+/*     $NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $  */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)kdump.c    8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.125 2016/09/05 00:40:29 sevan Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.126 2017/09/08 20:36:56 uwe Exp $");
 #endif
 #endif /* not lint */
 
@@ -329,14 +329,14 @@
 {
        char unknown[64];
        const char *type;
-       union holdtime {
-               struct timeval tv;
-               struct timespec ts;
-       };
-       static union holdtime prevtime;
-       union holdtime temp;
+       static struct timespec prevtime;
+       struct timespec temp;
        int col;
 
+       if (__predict_false(kth->ktr_version != KTRFAC_VERSION(KTRFACv2)))
+               errx(EXIT_FAILURE, "Unsupported ktrace version %x",
+                    kth->ktr_version);
+
        switch (kth->ktr_type) {
        case KTR_SYSCALL:
                type = "CALL";
@@ -383,70 +383,23 @@
                type = unknown;
        }
 
-       col = printf("%6d ", kth->ktr_pid);
-       if (kth->ktr_version > KTRFACv0)
-               col += printf("%6d ", kth->ktr_lid);
+       col = printf("%6d %6d ", kth->ktr_pid, kth->ktr_lid);
        col += printf("%-8.*s ", MAXCOMLEN, kth->ktr_comm);
        if (timestamp) {
-               (void)&prevtime;
                if (timestamp == 2) {
-                       switch (kth->ktr_version) {
-                       case KTRFAC_VERSION(KTRFACv0):
-                               if (prevtime.tv.tv_sec == 0)
-                                       temp.tv.tv_sec = temp.tv.tv_usec = 0;
-                               else
-                                       timersub(&kth->ktr_otv,
-                                           &prevtime.tv, &temp.tv);
-                               prevtime.tv.tv_sec = kth->ktr_otv.tv_sec;
-                               prevtime.tv.tv_usec = kth->ktr_otv.tv_usec;
-                               break;
-                       case KTRFAC_VERSION(KTRFACv1):
-                               if (prevtime.ts.tv_sec == 0)
-                                       temp.ts.tv_sec = temp.ts.tv_nsec = 0;
-                               else
-                                       timespecsub(&kth->ktr_ots,
-                                           &prevtime.ts, &temp.ts);
-                               prevtime.ts.tv_sec = kth->ktr_ots.tv_sec;
-                               prevtime.ts.tv_nsec = kth->ktr_ots.tv_nsec;
-                               break;
-                       case KTRFAC_VERSION(KTRFACv2):
-                               if (prevtime.ts.tv_sec == 0)
-                                       temp.ts.tv_sec = temp.ts.tv_nsec = 0;
-                               else
-                                       timespecsub(&kth->ktr_ts,
-                                           &prevtime.ts, &temp.ts);
-                               prevtime.ts.tv_sec = kth->ktr_ts.tv_sec;
-                               prevtime.ts.tv_nsec = kth->ktr_ts.tv_nsec;
-                               break;
-                       default:
-                               goto badversion;
-                       }
+                       if (prevtime.tv_sec == 0)
+                               temp.tv_sec = temp.tv_nsec = 0;
+                       else
+                               timespecsub(&kth->ktr_ts, &prevtime, &temp);
+                       prevtime.tv_sec = kth->ktr_ts.tv_sec;
+                       prevtime.tv_nsec = kth->ktr_ts.tv_nsec;
                } else {
-                       switch (kth->ktr_version) {
-                       case KTRFAC_VERSION(KTRFACv0):
-                               temp.tv.tv_sec = kth->ktr_otv.tv_sec;
-                               temp.tv.tv_usec = kth->ktr_otv.tv_usec;
-                               break;
-                       case KTRFAC_VERSION(KTRFACv1):
-                               temp.ts.tv_sec = kth->ktr_ots.tv_sec;
-                               temp.ts.tv_nsec = kth->ktr_ots.tv_nsec;
-                               break;
-                       case KTRFAC_VERSION(KTRFACv2):
-                               temp.ts.tv_sec = kth->ktr_ts.tv_sec;
-                               temp.ts.tv_nsec = kth->ktr_ts.tv_nsec;
-                               break;
-                       default:
-                       badversion:
-                               err(1, "Unsupported ktrace version %x",
-                                   kth->ktr_version);
-                       }
+                       temp.tv_sec = kth->ktr_ts.tv_sec;
+                       temp.tv_nsec = kth->ktr_ts.tv_nsec;
                }
-               if (kth->ktr_version == KTRFACv0)
-                       col += printf("%lld.%06ld ",
-                           (long long)temp.tv.tv_sec, (long)temp.tv.tv_usec);
-               else
-                       col += printf("%lld.%09ld ",
-                           (long long)temp.ts.tv_sec, (long)temp.ts.tv_nsec);
+
+               col += printf("%lld.%09ld ",
+                   (long long)temp.tv_sec, (long)temp.tv_nsec);
        }
        col += printf("%-4s  ", type);
        return col;



Home | Main Index | Thread Index | Old Index