diff options
author | Miles Bader <miles@gnu.org> | 1995-03-28 18:16:35 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-03-28 18:16:35 +0000 |
commit | 0795997fccfae312fac9502d46af75b8861e0294 (patch) | |
tree | 8e3dae2404f0f971c42b585fc98dc310584754f7 /libps | |
parent | 698abd6eb72d09be79c0480bde3476af0f6715a1 (diff) |
Add support for the exec_flags field, and make the state bits calculation use
that to support the PSTAT_STATE_TRACED bit.
Update proc_stat_state_tags to add PSTAT_STATE_TRACED.
Diffstat (limited to 'libps')
-rw-r--r-- | libps/procstat.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libps/procstat.c b/libps/procstat.c index 979d98b8..4cb77473 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -31,7 +31,7 @@ /* These directly correspond to the bits in a state, starting from 0. See ps.h for an explanation of what each of these means. */ -char *proc_stat_state_tags = "RTHDSIWN<Z+sempo"; +char *proc_stat_state_tags = "RTHDSIWN<Z+sempox"; /* ---------------------------------------------------------------- */ @@ -94,7 +94,9 @@ proc_stat_set_flags(proc_stat_t ps, int flags) if (flags & PSTAT_TTY) flags |= PSTAT_CTTYID; - if (flags & (PSTAT_CTTYID | PSTAT_CWDIR | PSTAT_AUTH | PSTAT_UMASK)) + if (flags & PSTAT_STATE) + flags |= PSTAT_EXEC_FLAGS; /* For the traced bit. */ + if (flags & (PSTAT_CTTYID | PSTAT_CWDIR | PSTAT_AUTH | PSTAT_UMASK | PSTAT_EXEC_FLAGS)) { flags |= PSTAT_MSGPORT; flags |= PSTAT_TASK; /* for authentication */ @@ -209,6 +211,10 @@ proc_stat_set_flags(proc_stat_t ps, int flags) have |= PSTAT_TASK_EVENTS_INFO; } + /* Get the process's exec flags (see <hurd/hurd_types.h>). */ + MGET(PSTAT_EXEC_FLAGS, PSTAT_MSGPORT | PSTAT_TASK, + msg_get_exec_flags(ps->msgport, ps->task, &ps->exec_flags)); + /* PSTAT_STATE_ bits for the process and all its threads. */ if ((need & PSTAT_STATE) && (have & PSTAT_INFO)) { @@ -235,6 +241,9 @@ proc_stat_set_flags(proc_stat_t ps, int flags) if (pi_flags & PI_ORPHAN) state |= PSTAT_STATE_ORPHANED; + if ((have & PSTAT_EXEC_FLAGS) & (ps->exec_flags & EXEC_TRACED)) + state |= PSTAT_STATE_TRACED; + ps->state = state; have |= PSTAT_STATE; } |