1 |
/* The proc_stat type, which holds information about a hurd process. |
/* The proc_stat type, which holds information about a hurd process. |
2 |
|
|
3 |
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
Copyright (C) 1995,96,97,98,99,2002 Free Software Foundation, Inc. |
4 |
|
Written by Miles Bader <miles@gnu.org> |
|
Written by Miles Bader <miles@gnu.ai.mit.edu> |
|
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
7 |
modify it under the terms of the GNU General Public License as |
modify it under the terms of the GNU General Public License as |
89 |
/* The set of things we get from procinfo that are per-task (note that this |
/* The set of things we get from procinfo that are per-task (note that this |
90 |
includes thread fields, because tasks use them for thread summaries). */ |
includes thread fields, because tasks use them for thread summaries). */ |
91 |
#define PSTAT_PROCINFO_TASK \ |
#define PSTAT_PROCINFO_TASK \ |
92 |
(PSTAT_PROCINFO_TASK_THREAD_DEP | PSTAT_PROC_INFO | PSTAT_TASK_BASIC) |
(PSTAT_PROCINFO_TASK_THREAD_DEP | PSTAT_PROC_INFO \ |
93 |
|
| PSTAT_TASK_BASIC | PSTAT_TASK_EVENTS) |
94 |
|
|
95 |
/* The set of PSTAT_ flags that we get using proc_getprocinfo. */ |
/* The set of PSTAT_ flags that we get using proc_getprocinfo. */ |
96 |
#define PSTAT_PROCINFO PSTAT_PROCINFO_TASK |
#define PSTAT_PROCINFO PSTAT_PROCINFO_TASK |
97 |
|
|
98 |
/* The set of things in PSTAT_PROCINFO that we will not attempt to refetch on |
/* The set of things in PSTAT_PROCINFO that we will not attempt to refetch on |
99 |
subsequent getprocinfo calls. */ |
subsequent getprocinfo calls. */ |
100 |
#define PSTAT_PROCINFO_MERGE PSTAT_TASK_BASIC |
#define PSTAT_PROCINFO_MERGE (PSTAT_TASK_BASIC | PSTAT_TASK_EVENTS) |
101 |
#define PSTAT_PROCINFO_REFETCH (PSTAT_PROCINFO - PSTAT_PROCINFO_MERGE) |
#define PSTAT_PROCINFO_REFETCH (PSTAT_PROCINFO - PSTAT_PROCINFO_MERGE) |
102 |
|
|
103 |
/* Fetches process information from the set in PSTAT_PROCINFO, returning it |
/* Fetches process information from the set in PSTAT_PROCINFO, returning it |
113 |
|
|
114 |
if ((need & PSTAT_TASK_BASIC) && !(*have & PSTAT_TASK_BASIC)) |
if ((need & PSTAT_TASK_BASIC) && !(*have & PSTAT_TASK_BASIC)) |
115 |
pi_flags |= PI_FETCH_TASKINFO; |
pi_flags |= PI_FETCH_TASKINFO; |
116 |
|
if ((need & PSTAT_TASK_EVENTS) && !(*have & PSTAT_TASK_EVENTS)) |
117 |
|
pi_flags |= PI_FETCH_TASKEVENTS; |
118 |
if ((need & PSTAT_NUM_THREADS) && !(*have & PSTAT_NUM_THREADS)) |
if ((need & PSTAT_NUM_THREADS) && !(*have & PSTAT_NUM_THREADS)) |
119 |
pi_flags |= PI_FETCH_THREADS; |
pi_flags |= PI_FETCH_THREADS; |
120 |
if ((need & PSTAT_THREAD_BASIC) && !(*have & PSTAT_THREAD_BASIC)) |
if ((need & PSTAT_THREAD_BASIC) && !(*have & PSTAT_THREAD_BASIC)) |
301 |
flags |= PSTAT_MSGPORT; |
flags |= PSTAT_MSGPORT; |
302 |
flags |= PSTAT_TASK; /* for authentication */ |
flags |= PSTAT_TASK; /* for authentication */ |
303 |
} |
} |
|
if (flags & PSTAT_TASK_EVENTS) |
|
|
flags |= PSTAT_TASK; |
|
304 |
|
|
305 |
return flags; |
return flags; |
306 |
} |
} |
857 |
/* The process's task port. */ |
/* The process's task port. */ |
858 |
MGET(PSTAT_TASK, PSTAT_PID, proc_pid2task (server, ps->pid, &ps->task)); |
MGET(PSTAT_TASK, PSTAT_PID, proc_pid2task (server, ps->pid, &ps->task)); |
859 |
|
|
|
/* VM statistics for the task. See <mach/task_info.h>. */ |
|
|
if (NEED (PSTAT_TASK_EVENTS, PSTAT_TASK)) |
|
|
{ |
|
|
ps->task_events_info = &ps->task_events_info_buf; |
|
|
ps->task_events_info_size = TASK_EVENTS_INFO_COUNT; |
|
|
if (task_info (ps->task, TASK_EVENTS_INFO, |
|
|
(task_info_t)ps->task_events_info, |
|
|
&ps->task_events_info_size) |
|
|
== 0) |
|
|
have |= PSTAT_TASK_EVENTS; |
|
|
} |
|
|
|
|
860 |
/* PSTAT_STATE_ bits for the process and all its threads. */ |
/* PSTAT_STATE_ bits for the process and all its threads. */ |
861 |
if ((need & PSTAT_STATE) && (have & (PSTAT_PROC_INFO | PSTAT_THREAD_BASIC))) |
if ((need & PSTAT_STATE) && (have & (PSTAT_PROC_INFO | PSTAT_THREAD_BASIC))) |
862 |
{ |
{ |