summaryrefslogtreecommitdiff
path: root/libps/ps.h
diff options
context:
space:
mode:
authorantrik <antrik@users.sf.net>2009-06-20 12:29:06 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-09-18 20:34:20 +0200
commitbe9be179a2cde041fbe042362ee80f9874233953 (patch)
tree22ae322b09d7e6b81b6b984c235a1e865774f8e8 /libps/ps.h
parent7cecc5f97fb28126a7d930efe44d3a03a64ba272 (diff)
Obtain number of ports in proc and libps
Add (and implement) a proc RPC to obtain the number of Mach ports used by the target task. Add infrastructure in libps to read this information. * hurd/process.defs (proc_getnports): New RPC. * hurd/process_request.defs (proc_getnports_request): New RPC. * libps/procstat.c (proc_stat_set_flags): Call proc_getnports RPC if needed. * libps/ps.h (proc_stat): New `num_ports' field. (PSTAT_NUM_PORTS): New macro. (proc_stat_num_ports): New macro. * libps/spec.c (ps_get_num_ports): New function. (ps_num_ports_getter): New variable. (specs): New entry for `ps_num_ports_getter'. * proc/info.c (S_proc_getnports): New function.
Diffstat (limited to 'libps/ps.h')
-rw-r--r--libps/ps.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libps/ps.h b/libps/ps.h
index a013c44e..b85ede46 100644
--- a/libps/ps.h
+++ b/libps/ps.h
@@ -303,6 +303,8 @@ struct proc_stat
char *env;
/* The length of ENV. */
size_t env_len;
+
+ unsigned num_ports;
};
/* Proc_stat flag bits; each bit is set in the FLAGS field if that
@@ -340,6 +342,7 @@ struct proc_stat
#define PSTAT_OWNER_UID 0x200000 /* The uid of the the proc's owner */
#define PSTAT_UMASK 0x400000 /* The proc's current umask */
#define PSTAT_HOOK 0x800000 /* Has a non-zero hook */
+#define PSTAT_NUM_PORTS 0x4000000 /* Number of Mach ports in the task */
/* Flag bits that don't correspond precisely to any field. */
#define PSTAT_NO_MSGPORT 0x1000000 /* Don't use the msgport at all */
@@ -443,6 +446,7 @@ extern char *proc_stat_state_tags;
#define proc_stat_umask(ps) ((ps)->umask)
#define proc_stat_tty(ps) ((ps)->tty)
#define proc_stat_task_events_info(ps) ((ps)->task_events_info)
+#define proc_stat_num_ports(ps) ((ps)->num_ports)
#define proc_stat_has(ps, needs) (((ps)->flags & needs) == needs)
/* True if PS refers to a thread and not a process. */