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.
This commit is contained in:
nathanw 2002-04-24 21:41:22 +00:00
parent 8eef8db58c
commit 43634bc5ba
3 changed files with 31 additions and 16 deletions

View File

@ -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 @@ VAR var[] = {
{"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 @@ VAR var[] = {
{"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"},

View File

@ -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 @@ printval(bp, v, mode)
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 @@ printval(bp, v, mode)
(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);
}

View File

@ -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. */