summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-09-17 05:31:39 +0000
committerjeff <jeff@FreeBSD.org>2007-09-17 05:31:39 +0000
commit3fc0f8b973fdc2f392a3234d653e09d71e2aab98 (patch)
treee572a7b77f24339d2dc6ebf6b83c1e2c1ce0f6a5 /bin/ps
parent74666fdfce0e06484d5f82e8fced0c16c06477d1 (diff)
downloadFreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.zip
FreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.tar.gz
- Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/print.c9
-rw-r--r--bin/ps/ps.c4
2 files changed, 6 insertions, 7 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 081c4f5..29dffb6 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -197,14 +197,13 @@ logname(KINFO *k, VARENT *ve)
void
state(KINFO *k, VARENT *ve)
{
- int flag, sflag, tdflags;
+ int flag, tdflags;
char *cp;
VAR *v;
char buf[16];
v = ve->var;
flag = k->ki_p->ki_flag;
- sflag = k->ki_p->ki_sflag;
tdflags = k->ki_p->ki_tdflags; /* XXXKSE */
cp = buf;
@@ -242,7 +241,7 @@ state(KINFO *k, VARENT *ve)
*cp = '?';
}
cp++;
- if (!(sflag & PS_INMEM))
+ if (!(flag & P_INMEM))
*cp++ = 'W';
if (k->ki_p->ki_nice < NZERO)
*cp++ = '<';
@@ -591,7 +590,7 @@ getpcpu(const KINFO *k)
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
/* XXX - I don't like this */
- if (k->ki_p->ki_swtime == 0 || (k->ki_p->ki_sflag & PS_INMEM) == 0)
+ if (k->ki_p->ki_swtime == 0 || (k->ki_p->ki_flag & P_INMEM) == 0)
return (0.0);
if (rawcpu)
return (100.0 * fxtofl(k->ki_p->ki_pctcpu));
@@ -619,7 +618,7 @@ getpmem(KINFO *k)
if (failure)
return (0.0);
- if ((k->ki_p->ki_sflag & PS_INMEM) == 0)
+ if ((k->ki_p->ki_flag & P_INMEM) == 0)
return (0.0);
/* XXX want pmap ptpages, segtab, etc. (per architecture) */
/* XXX don't have info about shared */
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 73a6121..ee2b7f8 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -994,13 +994,13 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki,
return (s);
}
-#define UREADOK(ki) (forceuread || (ki->ki_p->ki_sflag & PS_INMEM))
+#define UREADOK(ki) (forceuread || (ki->ki_p->ki_flag & P_INMEM))
static void
saveuser(KINFO *ki)
{
- if (ki->ki_p->ki_sflag & PS_INMEM) {
+ if (ki->ki_p->ki_flag & P_INMEM) {
/*
* The u-area might be swapped out, and we can't get
* at it because we have a crashdump and no swap.
OpenPOWER on IntegriCloud