summaryrefslogtreecommitdiff
path: root/debian/patches/introspection0001-hurd-add-an-Hurd-server-introspection-protocol.patch
blob: 6ed724f42078fd9bebc9c09e49bf28ffc35d43f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
From 9eb39e752a828ed0f9b4adff13d524de51be1025 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Wed, 21 May 2014 16:40:12 +0200
Subject: [PATCH hurd 1/8] hurd: add an Hurd server introspection protocol

Most Hurd servers use libports to manage receive rights and the
associated objects.  These procedures can be used to query the state
associated with receive rights managed by libports.

The procedures are not specific to libports.  Any Hurd server can
implement this protocol.  To do so, a server installs a send right in
the array of well-known ports, under the key
HURD_PORT_REGISTER_INTROSPECTION.

* hurd/hurd_port.defs: New file.
* hurd/hurd_types.h (HURD_PORT_REGISTER_INTROSPECTION): New macro.
(HURD_PORT_REGISTER_MAX): Likewise.
* hurd/subsystems: Add hurd_port subsystem.
---
 hurd/hurd_port.defs | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 hurd/hurd_types.h   |  7 +++++
 hurd/subsystems     |  1 +
 3 files changed, 86 insertions(+)
 create mode 100644 hurd/hurd_port.defs

diff --git a/hurd/hurd_port.defs b/hurd/hurd_port.defs
new file mode 100644
index 0000000..d1f46b3
--- /dev/null
+++ b/hurd/hurd_port.defs
@@ -0,0 +1,78 @@
+/* Hurd server introspection.
+
+   Copyright (C) 2014 Free Software Foundation, Inc.
+
+   This file is part of the GNU Hurd.
+
+   The GNU Hurd is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   The GNU Hurd is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with the GNU Hurd.  If not, see <http://www.gnu.org/licenses/>.  */
+
+subsystem hurd_port 39000;
+
+/* Hurd server introspection.
+
+   Most Hurd servers use libports to manage receive rights and the
+   associated objects.  These procedures can be used to query the
+   state associated with receive rights managed by libports.
+
+   The procedures are not specific to libports.  Any Hurd server can
+   implement this protocol.  To do so, a server installs a send right
+   in the array of well-known ports, under the key
+   HURD_PORT_REGISTER_INTROSPECTION.
+
+   A client in possession of the servers task port can retrieve a copy
+   of this send right using mach_ports_lookup.  */
+
+#include <hurd/hurd_types.defs>
+
+#ifdef HURD_PORT_IMPORTS
+HURD_PORT_IMPORTS
+#endif
+
+INTR_INTERFACE
+
+/* Return the number of hard and weak references of the object
+   directly associated with the receive right NAME.
+
+   Return EINVAL if NAME does not denote a receive right managed by
+   the port-to-object mapper, or if the concept of reference counting
+   simply does not apply.  */
+routine hurd_port_get_refcounts (
+	introspection: mach_port_t;
+	name: mach_port_name_t;
+	waittime timeout: natural_t;
+	RPT
+	out hard: natural_t;
+	out weak: natural_t);
+
+/* Return a compact, human-readable description of the object related
+   with the receive right NAME.
+
+   This description is meant for debugging purposes and should include
+   relevant internal state.  If possible, it should include
+   information that is meaningful in other contexts (like a file name,
+   or the inode number).
+
+   Return EINVAL if NAME does not denote a receive right managed by
+   the port-to-object mapper.  */
+routine hurd_port_debug_info (
+	introspection: mach_port_t;
+	name: mach_port_name_t;
+	waittime timeout: natural_t;
+	RPT
+	out debug_info: string_t);
+
+routine hurd_port_trace_class_rpcs (
+	introspection: mach_port_t;
+	name: mach_port_name_t;
+	trace_port: mach_port_send_t);
diff --git a/hurd/hurd_types.h b/hurd/hurd_types.h
index 4341177..76a8201 100644
--- a/hurd/hurd_types.h
+++ b/hurd/hurd_types.h
@@ -23,6 +23,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <time.h>		/* For struct timespec.  */
 #include <mach/std_types.h>	/* For mach_port_t et al. */
 #include <mach/message.h>	/* For mach_msg_id_t et al. */
+#include <mach/mach_param.h>	/* For TASK_PORT_REGISTER_MAX. */
 #include <sys/types.h>		/* For pid_t and uid_t.  */
 
 /* A string identifying this release of the GNU Hurd.  Our
@@ -372,4 +373,10 @@ enum
     INIT_INT_MAX,
   };
 
+/* Define the well-known ports available via mach_ports_lookup.  */
+#define HURD_PORT_REGISTER_INTROSPECTION	0
+
+/* This is a fixed limit.  */
+#define HURD_PORT_REGISTER_MAX			TASK_PORT_REGISTER_MAX
+
 #endif
diff --git a/hurd/subsystems b/hurd/subsystems
index c05895c..59893b2 100644
--- a/hurd/subsystems
+++ b/hurd/subsystems
@@ -36,6 +36,7 @@ tape		35000	Special control operations for magtapes
 login		36000	Database of logged-in users
 pfinet		37000   Internet configuration calls
 password	38000	Password checker
+hurd_port	39000	Port debugging and introspection
 <ioctl space>  100000-	First subsystem of ioctl class 'f' (lowest class)
 tioctl	       156000	Ioctl class 't' (terminals)
 tioctl	       156200     (continued)
-- 
2.1.4