From be9be179a2cde041fbe042362ee80f9874233953 Mon Sep 17 00:00:00 2001 From: antrik Date: Sat, 20 Jun 2009 12:29:06 +0200 Subject: 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. --- libps/procstat.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libps/procstat.c') diff --git a/libps/procstat.c b/libps/procstat.c index 6e920f4f..eac4ae42 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -990,6 +990,10 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t flags) if (ps_context_find_tty_by_cttyid (ps->context, ps->cttyid, &ps->tty) == 0) have |= PSTAT_TTY; + /* The number of Mach ports in the task. */ + MGET (PSTAT_NUM_PORTS, PSTAT_PID, + proc_getnports (server, ps->pid, &ps->num_ports)); + /* Update PS's flag state. We haven't tried user flags yet, so don't mark them as having failed. We do this before checking user bits so that the user fetch hook sees PS in a consistent state. */ -- cgit v1.2.3