summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-05-22 20:10:31 +0000
committerdt <dt@FreeBSD.org>1999-05-22 20:10:31 +0000
commit20219ea96694d6163d1e5902345c310431619911 (patch)
tree107f0494cf8712359adaea1f114d354a923899f5 /sys/fs
parent1dea181fa6ac7bb1b60556443d481ad036416953 (diff)
downloadFreeBSD-src-20219ea96694d6163d1e5902345c310431619911.zip
FreeBSD-src-20219ea96694d6163d1e5902345c310431619911.tar.gz
Don't call calcru() on a swapped-out process. calcru() access p_stats, which
is in U-area.
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/procfs/procfs_status.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c
index ba1abe4..d34e215 100644
--- a/sys/fs/procfs/procfs_status.c
+++ b/sys/fs/procfs/procfs_status.c
@@ -37,7 +37,7 @@
* @(#)procfs_status.c 8.4 (Berkeley) 6/15/94
*
* From:
- * $Id: procfs_status.c,v 1.12 1999/01/05 03:53:06 peter Exp $
+ * $Id: procfs_status.c,v 1.13 1999/04/28 11:37:20 phk Exp $
*/
#include <sys/param.h>
@@ -102,23 +102,17 @@ procfs_dostatus(curp, p, pfs, uio)
if (*sep != ',')
ps += sprintf(ps, "noflags");
- if (p->p_flag & P_INMEM)
- ps += sprintf(ps, " %ld,%ld",
- p->p_stats->p_start.tv_sec,
- p->p_stats->p_start.tv_usec);
- else
- ps += sprintf(ps, " -1,-1");
-
- {
+ if (p->p_flag & P_INMEM) {
struct timeval ut, st;
- calcru(p, &ut, &st, (void *) 0);
- ps += sprintf(ps, " %ld,%ld %ld,%ld",
- ut.tv_sec,
- ut.tv_usec,
- st.tv_sec,
- st.tv_usec);
- }
+ calcru(p, &ut, &st, (struct timeval *) NULL);
+ ps += sprintf(ps, " %ld,%ld %ld,%ld %ld,%ld",
+ p->p_stats->p_start.tv_sec,
+ p->p_stats->p_start.tv_usec,
+ ut.tv_sec, ut.tv_usec,
+ st.tv_sec, st.tv_usec);
+ } else
+ ps += sprintf(ps, " -1,-1 -1,-1 -1,-1");
ps += sprintf(ps, " %s",
(p->p_wchan && p->p_wmesg) ? p->p_wmesg : "nochan");
OpenPOWER on IntegriCloud