From f693d4acdc5f1882bddad29fec63b383251a1e5c Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 15 Feb 1996 05:05:46 +0000 Subject: (ps_alive_filter): New variable. (ps_alive_p): New function. --- libps/filters.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 @@ -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}; -- cgit v1.2.3