Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ps Since kinfo_proc2 has many values that are 64-bit, ps...
details: https://anonhg.NetBSD.org/src/rev/8d4dce18c24d
branches: trunk
changeset: 526080:8d4dce18c24d
user: nathanw <nathanw%NetBSD.org@localhost>
date: Wed Apr 24 21:41:22 2002 +0000
description:
Since kinfo_proc2 has many values that are 64-bit, ps needs to know
that they're 64-bit, and grab them out of memory appropriately. Otherwise,
big-endian systems get the wrong end of the 64-bit value and lose.
Keywords affected: inblk, majflt, minflt, msgrcv, msgsnd, nivcsw, nsigs,
nswap, nvcsw, and oublk.
diffstat:
bin/ps/keyword.c | 24 ++++++++++++------------
bin/ps/print.c | 19 +++++++++++++++++--
bin/ps/ps.h | 4 ++--
3 files changed, 31 insertions(+), 16 deletions(-)
diffs (122 lines):
diff -r 5bc4c3de294d -r 8d4dce18c24d bin/ps/keyword.c
--- a/bin/ps/keyword.c Wed Apr 24 21:24:16 2002 +0000
+++ b/bin/ps/keyword.c Wed Apr 24 21:41:22 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: keyword.c,v 1.26 2001/01/08 13:20:29 itojun Exp $ */
+/* $NetBSD: keyword.c,v 1.27 2002/04/24 21:41:22 nathanw Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
-__RCSID("$NetBSD: keyword.c,v 1.26 2001/01/08 13:20:29 itojun Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.27 2002/04/24 21:41:22 nathanw Exp $");
#endif
#endif /* not lint */
@@ -97,7 +97,7 @@
{"flags", "", "f"},
{"holdcnt", "HOLDCNT", NULL, 0, pvar, 0, POFF(p_holdcnt), INT, "d"},
{"ignored", "", "sigignore"},
- {"inblk", "INBLK", NULL, 0, pvar, 0, POFF(p_uru_inblock), ULONG, "d"},
+ {"inblk", "INBLK", NULL, 0, pvar, 0, POFF(p_uru_inblock), UINT64, "ldd"},
{"inblock", "", "inblk"},
{"jobc", "JOBC", NULL, 0, pvar, 0, POFF(p_jobc), SHORT, "d"},
{"ktrace", "KTRACE", NULL, 0, pvar, 0, POFF(p_traceflag), INT, "x"},
@@ -107,20 +107,20 @@
{"login", "LOGIN", NULL, LJUST, logname},
{"logname", "", "login"},
{"lstart", "STARTED", NULL, LJUST, lstarted},
- {"majflt", "MAJFLT", NULL, 0, pvar, 0, POFF(p_uru_majflt), ULONG, "d"},
- {"minflt", "MINFLT", NULL, 0, pvar, 0, POFF(p_uru_minflt), ULONG, "d"},
- {"msgrcv", "MSGRCV", NULL, 0, pvar, 0, POFF(p_uru_msgrcv), ULONG, "d"},
- {"msgsnd", "MSGSND", NULL, 0, pvar, 0, POFF(p_uru_msgsnd), ULONG, "d"},
+ {"majflt", "MAJFLT", NULL, 0, pvar, 0, POFF(p_uru_majflt), UINT64, "ldd"},
+ {"minflt", "MINFLT", NULL, 0, pvar, 0, POFF(p_uru_minflt), UINT64, "ldd"},
+ {"msgrcv", "MSGRCV", NULL, 0, pvar, 0, POFF(p_uru_msgrcv), UINT64, "ldd"},
+ {"msgsnd", "MSGSND", NULL, 0, pvar, 0, POFF(p_uru_msgsnd), UINT64, "ldd"},
{"ni", "", "nice"},
{"nice", "NI", NULL, 0, pnice},
- {"nivcsw", "NIVCSW", NULL, 0, pvar, 0, POFF(p_uru_nivcsw), ULONG, "d"},
+ {"nivcsw", "NIVCSW", NULL, 0, pvar, 0, POFF(p_uru_nivcsw), UINT64, "ldd"},
{"nsignals", "", "nsigs"},
- {"nsigs", "NSIGS", NULL, 0, pvar, 0, POFF(p_uru_nsignals), ULONG, "d"},
- {"nswap", "NSWAP", NULL, 0, pvar, 0, POFF(p_uru_nswap), ULONG, "d"},
- {"nvcsw", "NVCSW", NULL, 0, pvar, 0, POFF(p_uru_nvcsw), ULONG, "d"},
+ {"nsigs", "NSIGS", NULL, 0, pvar, 0, POFF(p_uru_nsignals), UINT64, "ldd"},
+ {"nswap", "NSWAP", NULL, 0, pvar, 0, POFF(p_uru_nswap), UINT64, "ldd"},
+ {"nvcsw", "NVCSW", NULL, 0, pvar, 0, POFF(p_uru_nvcsw), UINT64, "ldd"},
/* XXX */
{"nwchan", "WCHAN", NULL, 0, pvar, 0, POFF(p_wchan), KPTR, "llx"},
- {"oublk", "OUBLK", NULL, 0, pvar, 0, POFF(p_uru_oublock), ULONG, "d"},
+ {"oublk", "OUBLK", NULL, 0, pvar, 0, POFF(p_uru_oublock), UINT64, "ldd"},
{"oublock", "", "oublk"},
/* XXX */
{"p_ru", "P_RU", NULL, 0, pvar, 0, POFF(p_ru), KPTR, "llx"},
diff -r 5bc4c3de294d -r 8d4dce18c24d bin/ps/print.c
--- a/bin/ps/print.c Wed Apr 24 21:24:16 2002 +0000
+++ b/bin/ps/print.c Wed Apr 24 21:41:22 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.71 2002/02/21 19:31:03 martin Exp $ */
+/* $NetBSD: print.c,v 1.72 2002/04/24 21:41:22 nathanw 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.71 2002/02/21 19:31:03 martin Exp $");
+__RCSID("$NetBSD: print.c,v 1.72 2002/04/24 21:41:22 nathanw Exp $");
#endif
#endif /* not lint */
@@ -961,6 +961,15 @@
uval &= 0xffffff;
vok = VPTR;
break;
+ case INT64:
+ val = (long long)GET(int64_t);
+ vok = VSIGN;
+ break;
+ case UINT64:
+ uval = (unsigned long long)CHK_INF127(GET(u_int64_t));
+ vok = VUNSIGN;
+ break;
+
default:
/* nothing... */;
}
@@ -1081,6 +1090,12 @@
(void)asprintf(&obuf, ofmt, width, &buf[i]);
}
break;
+ case INT64:
+ (void)printf(ofmt, width, (long long)GET(int64_t));
+ return;
+ case UINT64:
+ (void)printf(ofmt, width, (unsigned long long)CHK_INF127(GET(u_int64_t)));
+ return;
default:
errx(1, "unknown type %d", v->type);
}
diff -r 5bc4c3de294d -r 8d4dce18c24d bin/ps/ps.h
--- a/bin/ps/ps.h Wed Apr 24 21:24:16 2002 +0000
+++ b/bin/ps/ps.h Wed Apr 24 21:41:22 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ps.h,v 1.17 2000/06/07 04:58:02 simonb Exp $ */
+/* $NetBSD: ps.h,v 1.18 2002/04/24 21:41:22 nathanw Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@
enum type {
CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, KPTR24,
- INT32, UINT32, SIGLIST
+ INT32, UINT32, SIGLIST, INT64, UINT64
};
/* Variables. */
Home |
Main Index |
Thread Index |
Old Index