38 |
own_uid = getuid (); |
own_uid = getuid (); |
39 |
return own_uid >= 0 && own_uid == proc_stat_owner_uid (ps); |
return own_uid >= 0 && own_uid == proc_stat_owner_uid (ps); |
40 |
} |
} |
41 |
struct ps_filter ps_own_filter = |
const struct ps_filter ps_own_filter = |
42 |
{"own", PSTAT_OWNER_UID, ps_own_p}; |
{"own", PSTAT_OWNER_UID, ps_own_p}; |
43 |
|
|
44 |
static int |
static int |
47 |
return |
return |
48 |
!(proc_stat_state (ps) & (PSTAT_STATE_P_SESSLDR | PSTAT_STATE_P_LOGINLDR)); |
!(proc_stat_state (ps) & (PSTAT_STATE_P_SESSLDR | PSTAT_STATE_P_LOGINLDR)); |
49 |
} |
} |
50 |
struct ps_filter ps_not_leader_filter = |
const struct ps_filter ps_not_leader_filter = |
51 |
{"not-sess-leader", PSTAT_STATE, ps_not_leader_p}; |
{"not-sess-leader", PSTAT_STATE, ps_not_leader_p}; |
52 |
|
|
53 |
static int |
static int |
58 |
!(state & PSTAT_STATE_P_ORPHAN) |
!(state & PSTAT_STATE_P_ORPHAN) |
59 |
|| (state & (PSTAT_STATE_P_SESSLDR | PSTAT_STATE_P_LOGINLDR)); |
|| (state & (PSTAT_STATE_P_SESSLDR | PSTAT_STATE_P_LOGINLDR)); |
60 |
} |
} |
61 |
struct ps_filter ps_unorphaned_filter = |
const struct ps_filter ps_unorphaned_filter = |
62 |
{"unorphaned", PSTAT_STATE, ps_unorphaned_p}; |
{"unorphaned", PSTAT_STATE, ps_unorphaned_p}; |
63 |
|
|
64 |
static int |
static int |
66 |
{ |
{ |
67 |
return proc_stat_cttyid (ps) != MACH_PORT_NULL; |
return proc_stat_cttyid (ps) != MACH_PORT_NULL; |
68 |
} |
} |
69 |
struct ps_filter ps_ctty_filter = |
const struct ps_filter ps_ctty_filter = |
70 |
{"ctty", PSTAT_CTTYID, ps_ctty_p}; |
{"ctty", PSTAT_CTTYID, ps_ctty_p}; |
71 |
|
|
72 |
static int |
static int |
74 |
{ |
{ |
75 |
return !(proc_stat_state (ps) & PSTAT_STATE_P_NOPARENT); |
return !(proc_stat_state (ps) & PSTAT_STATE_P_NOPARENT); |
76 |
} |
} |
77 |
struct ps_filter ps_parent_filter = |
const struct ps_filter ps_parent_filter = |
78 |
{"parent", PSTAT_STATE, ps_parent_p}; |
{"parent", PSTAT_STATE, ps_parent_p}; |
79 |
|
|
80 |
static int |
static int |
87 |
proc_stat_set_flags (ps, test_flag); |
proc_stat_set_flags (ps, test_flag); |
88 |
return proc_stat_has (ps, test_flag); |
return proc_stat_has (ps, test_flag); |
89 |
} |
} |
90 |
struct ps_filter ps_alive_filter = |
const struct ps_filter ps_alive_filter = |
91 |
{"alive", 0, ps_alive_p}; |
{"alive", 0, ps_alive_p}; |