summaryrefslogtreecommitdiff
path: root/debian/patches/introspection0004-utils-implement-portinfo-query-process.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/introspection0004-utils-implement-portinfo-query-process.patch')
-rw-r--r--debian/patches/introspection0004-utils-implement-portinfo-query-process.patch168
1 files changed, 0 insertions, 168 deletions
diff --git a/debian/patches/introspection0004-utils-implement-portinfo-query-process.patch b/debian/patches/introspection0004-utils-implement-portinfo-query-process.patch
deleted file mode 100644
index dfd095e9..00000000
--- a/debian/patches/introspection0004-utils-implement-portinfo-query-process.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From 6c2d3e9e3f4b30b3cea7df49db75272554a88c29 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: [PATCH hurd 4/9] 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.
----
- libshouldbeinlibc/Makefile | 2 +-
- libshouldbeinlibc/portinfo.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
- libshouldbeinlibc/portinfo.h | 1 +
- utils/portinfo.c | 3 +-
- 4 files changed, 72 insertions(+), 3 deletions(-)
-
-diff --git a/libshouldbeinlibc/Makefile b/libshouldbeinlibc/Makefile
-index 633d60e..a41a879 100644
---- a/libshouldbeinlibc/Makefile
-+++ b/libshouldbeinlibc/Makefile
-@@ -36,6 +36,6 @@ installhdrs = idvec.h timefmt.h maptime.h \
-
- installhdrsubdir = .
-
--OBJS = $(SRCS:.c=.o)
-+OBJS = $(SRCS:.c=.o) hurd_portUser.o
-
- include ../Makeconf
-diff --git a/libshouldbeinlibc/portinfo.c b/libshouldbeinlibc/portinfo.c
-index e6305c6..f99b789 100644
---- a/libshouldbeinlibc/portinfo.c
-+++ b/libshouldbeinlibc/portinfo.c
-@@ -17,10 +17,77 @@
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-+#include <assert.h>
-+#include <error.h>
-+#include <string.h>
- #include <sys/types.h>
- #include <sys/mman.h>
-
- #include "portinfo.h"
-+#include "hurd_port_U.h"
-+
-+static void
-+show_portinfo_query (mach_port_t task, mach_port_t name,
-+ unsigned show, FILE *stream)
-+{
-+ error_t err;
-+ static mach_port_t introspection_port;
-+ static mach_port_t for_task;
-+
-+ if (task != for_task)
-+ {
-+ mach_port_t *ports;
-+ size_t ports_len;
-+
-+ err = mach_ports_lookup (task, &ports, &ports_len);
-+ if (! err)
-+ {
-+ size_t i;
-+ if (MACH_PORT_VALID (introspection_port))
-+ mach_port_deallocate (mach_task_self (), introspection_port);
-+
-+ for (i = 0; i < ports_len; i++)
-+ if (i == HURD_PORT_REGISTER_INTROSPECTION)
-+ introspection_port = ports[i];
-+ else
-+ {
-+ if (MACH_PORT_VALID (ports[i]))
-+ mach_port_deallocate (mach_task_self (), ports[i]);
-+ }
-+ }
-+ else
-+ introspection_port = MACH_PORT_DEAD;
-+
-+ for_task = task;
-+ }
-+
-+ if (! MACH_PORT_VALID (introspection_port))
-+ return;
-+
-+ string_t info; /* XXX */
-+ err = hurd_port_debug_info (introspection_port, name, 100, info);
-+ if (err)
-+ {
-+ if (err != EINVAL)
-+ error (0, err, "hurd_port_debug_info");
-+ return;
-+ }
-+
-+ if (strlen (info) > 0)
-+ fprintf (stream, " [%s", info);
-+
-+ if (show & PORTINFO_DETAILS)
-+ {
-+ unsigned int hard, weak;
-+ err = hurd_port_get_refcounts (introspection_port, name, 100,
-+ &hard, &weak);
-+ if (! err)
-+ fprintf (stream, ", hard: %u, weak: %u", hard, weak);
-+ }
-+
-+ fprintf (stream, "]");
-+}
-+
-
- /* Prints info about NAME in TASK to STREAM, in a way described by the flags
- in SHOW. If TYPE is non-zero, it should be what mach_port_type returns
-@@ -83,6 +150,8 @@ print_port_info (mach_port_t name, mach_port_type_t type, task_t task,
- status.mps_nsrequest ? ", ns-req" : "");
- }
- }
-+ if (show & PORTINFO_QUERY)
-+ show_portinfo_query (task, name, show, stream);
- }
- if (type & MACH_PORT_TYPE_SEND)
- {
-diff --git a/libshouldbeinlibc/portinfo.h b/libshouldbeinlibc/portinfo.h
-index 143c289..bd96eb8 100644
---- a/libshouldbeinlibc/portinfo.h
-+++ b/libshouldbeinlibc/portinfo.h
-@@ -31,6 +31,7 @@
- #define PORTINFO_DETAILS 0x1
- #define PORTINFO_MEMBERS 0x4
- #define PORTINFO_HEX_NAMES 0x8
-+#define PORTINFO_QUERY 0x10
-
- /* Prints info about NAME in TASK to STREAM, in a way described by the flags
- in SHOW. If TYPE is non-zero, it should be what mach_port_type returns
-diff --git a/utils/portinfo.c b/utils/portinfo.c
-index 4c40352..27998db 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;
---
-2.1.4
-