From 176ec926aec9642768615d5875171c24fb10e6b7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 21 May 2014 17:38:46 +0200 Subject: utils: implement portinfo --query-process Implement portinfo --query-process (hopefully) as envisaged by a comment in portinfo.c. We use the new Hurd server introspection protocol to obtain information about the objects related to ports: % utils/portinfo --receive --query-process 5586 77 77: receive [bucket: diskfs_port_bucket, class: diskfs_protid_class, node{inode: 48194, hard: 1, weak: 1}, path: hello/hurd/developers_:)] * libshouldbeinlibc/Makefile (OBJS): Add hurd_portUser.o. * libshouldbeinlibc/portinfo.c (show_portinfo_query): New function. (print_port_info): Use show_portinfo_query if desired. * libshouldbeinlibc/portinfo.h (PORTINFO_QUERY): New macro. * utils/portinfo.c (argp_option): Drop #if 0. (parse_opt): Handle --query-process. --- utils/portinfo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/portinfo.c b/utils/portinfo.c index 4c403526..27998db0 100644 --- a/utils/portinfo.c +++ b/utils/portinfo.c @@ -44,10 +44,8 @@ static const struct argp_option options[] = { {"verbose", 'v', 0, 0, "Give more detailed information"}, {"members", 'm', 0, 0, "Show members of port-sets"}, {"hex-names", 'x', 0, 0, "Show port names in hexadecimal"}, -#if 0 /* XXX implement this */ {"query-process", 'q', 0, 0, "Query the process itself for the identity of" " the ports in question -- requires the process be in a sane state"}, -#endif {"hold", '*', 0, OPTION_HIDDEN}, {0,0,0,0, "Selecting which names to show:", 2}, @@ -249,6 +247,7 @@ main (int argc, char **argv) case 'v': show |= PORTINFO_DETAILS; break; case 'm': show |= PORTINFO_MEMBERS; break; case 'x': show |= PORTINFO_HEX_NAMES; break; + case 'q': show |= PORTINFO_QUERY; break; case 'r': only |= MACH_PORT_TYPE_RECEIVE; break; case 's': only |= MACH_PORT_TYPE_SEND; break; -- cgit v1.2.3