Source-Changes-HG archive

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

[src/trunk]: src/bin/ps Use int32_t for temporary variables (instead of long)...



details:   https://anonhg.NetBSD.org/src/rev/cd7dc935ebaf
branches:  trunk
changeset: 522566:cd7dc935ebaf
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 21 19:31:03 2002 +0000

description:
Use int32_t for temporary variables (instead of long), that is the same
type as we get the data passed from the kernel. This avoids (missing)
sign extension bugs on LP64 systems and partly takes care of PR 15677.

We now print this values as negative seconds - still wrong, but that
probably is due to the simple way this values are acumulated in the
scheduler, causing negative times when ntpd steps time backwards.

diffstat:

 bin/ps/print.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 5f3d87218ee7 -r cd7dc935ebaf bin/ps/print.c
--- a/bin/ps/print.c    Thu Feb 21 18:57:44 2002 +0000
+++ b/bin/ps/print.c    Thu Feb 21 19:31:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print.c,v 1.70 2002/01/21 23:01:55 jdolecek Exp $      */
+/*     $NetBSD: print.c,v 1.71 2002/02/21 19:31:03 martin Exp $        */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c    8.6 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.70 2002/01/21 23:01:55 jdolecek Exp $");
+__RCSID("$NetBSD: print.c,v 1.71 2002/02/21 19:31:03 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -728,8 +728,8 @@
        int mode;
 {
        VAR *v;
-       long secs;
-       long psecs;     /* "parts" of a second. first micro, then centi */
+       int32_t secs;
+       int32_t psecs;  /* "parts" of a second. first micro, then centi */
        int fmtlen;
 
        v = ve->var;
@@ -772,8 +772,8 @@
                                v->width = fmtlen;
                }
        } else {
-               printf("%*ld:%02ld.%02ld", v->width - 6, secs / SECSPERMIN,
-                   secs % SECSPERMIN, psecs);
+               printf("%*ld:%02ld.%02ld", v->width - 6, (long)(secs / SECSPERMIN),
+                   (long)(secs % SECSPERMIN), (long)psecs);
        }
 }
 



Home | Main Index | Thread Index | Old Index