summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-02-15 05:05:46 +0000
committerMiles Bader <miles@gnu.org>1996-02-15 05:05:46 +0000
commitf693d4acdc5f1882bddad29fec63b383251a1e5c (patch)
tree94adc96d102e895545c6ad54c207dbd78f44a0ed
parent713b5ba3a26ca0bf5a3cac505e55a33aee1d8dd4 (diff)
(ps_alive_filter): New variable.
(ps_alive_p): New function.
-rw-r--r--libps/filters.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libps/filters.c b/libps/filters.c
index f31246a7..ffbb8376 100644
--- a/libps/filters.c
+++ b/libps/filters.c
@@ -1,6 +1,6 @@
/* Some ps_filter_t's to restrict proc_stat_list's in various ways.
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -76,3 +76,16 @@ ps_parent_p(proc_stat_t ps)
}
struct ps_filter ps_parent_filter =
{"parent", PSTAT_STATE, ps_parent_p};
+
+static bool
+ps_alive_p (proc_stat_t ps)
+{
+ ps_flags_t test_flag =
+ proc_stat_is_thread (ps) ? PSTAT_THREAD_BASIC : PSTAT_PROC_INFO;
+ if (proc_stat_has (ps, test_flag))
+ return 1;
+ proc_stat_set_flags (ps, test_flag);
+ return proc_stat_has (ps, test_flag);
+}
+struct ps_filter ps_alive_filter =
+{"alive", 0, ps_alive_p};