summaryrefslogtreecommitdiff
path: root/libps/procstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'libps/procstat.c')
-rw-r--r--libps/procstat.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libps/procstat.c b/libps/procstat.c
index fd91669c..b6fe86c6 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -88,6 +88,10 @@ add_preconditions (ps_flags_t flags)
flags |= PSTAT_CTTYID;
if (flags & PSTAT_STATE)
flags |= PSTAT_EXEC_FLAGS; /* For the traced bit. */
+ if (flags & PSTAT_SUSPEND_COUNT)
+ /* We just request the resources require for both the thread and task
+ versions, as the extraneous info won't be possible to aquire anyway. */
+ flags |= PSTAT_INFO | PSTAT_THREAD_INFO;
if (flags & (PSTAT_CTTYID | PSTAT_CWDIR | PSTAT_AUTH | PSTAT_UMASK
| PSTAT_EXEC_FLAGS)
&& !(flags & PSTAT_NO_MSGPORT))
@@ -254,6 +258,17 @@ proc_stat_set_flags (proc_stat_t ps, ps_flags_t flags)
have |= PSTAT_THREAD_INFO;
}
+ if ((need & PSTAT_SUSPEND_COUNT)
+ &&
+ ((have & PSTAT_PID) ? (have & PSTAT_INFO) : (have & PSTAT_THREAD_INFO)))
+ {
+ if (have & PSTAT_PID)
+ ps->suspend_count = ps->info->taskinfo.suspend_count;
+ else
+ ps->suspend_count = ps->thread_basic_info.suspend_count;
+ have |= PSTAT_SUSPEND_COUNT;
+ }
+
ps->flags = have; /* should_suppress_msgport looks at them. */
if (should_suppress_msgport (ps))
/* Something is likely to have hosed the msg port, so don't use it. */