[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/23] hurd: add intranpayload functions to all hurd types
From: |
Justus Winter |
Subject: |
[PATCH 19/23] hurd: add intranpayload functions to all hurd types |
Date: |
Fri, 29 Nov 2013 01:03:47 +0100 |
For each hurd type defined in hurd_types.h, add a intranpayload
function. If an X_INTRAN mutation is defined for a type, a
corresponding X_INTRAN_PAYLOAD has to be defined. If no X_INTRAN
mutation is defined, use ports_payload_get_name as intranpayload
function, turning the payload back into an port name.
* hurd/hurd_types.defs: Add intranpayload functions.
---
hurd/hurd_types.defs | 106 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 105 insertions(+), 1 deletion(-)
diff --git a/hurd/hurd_types.defs b/hurd/hurd_types.defs
index 4b32504..7389101 100644
--- a/hurd/hurd_types.defs
+++ b/hurd/hurd_types.defs
@@ -22,9 +22,64 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA
02139, USA. */
#include <mach/mach_types.defs>
#include <device/device_types.defs>
+/* The Hurd uses protected payloads to quickly look up the object
+ receiving a message. Looking up objects is optimized at the cost
+ of having to translate payloads back to port names if the server
+ function expect a port name rather than an object.
+
+ Support for this is implemented in libports. Almost all of Hurd's
+ servers use libports. For servers using libports, the optimized
+ lookup is completely transparent.
+
+ Servers not using libports are not using protected payloads
+ automatically. Define HURD_DEFAULT_PAYLOAD_TO_PORT to 1 (1 like
+ the identity function) for programs not using libports to avoid
+ injecting the default payload-to-port translation function which is
+ in libports. If you want to use protected payloads without
+ libports, you can use HURD_DEFAULT_PAYLOAD_TO_PORT to inject a
+ custom translation function. */
+
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+# if HURD_DEFAULT_PAYLOAD_TO_PORT
+/* Any non-numeric value will fail this test. If 1 (or any number) is
+ given, do not inject the default translator function. */
+# undef HURD_DEFAULT_PAYLOAD_TO_PORT
+# endif
+#else
+ import <hurd/ports.h>;
+# define HURD_DEFAULT_PAYLOAD_TO_PORT ports_payload_get_name
+#endif
+
+/* Override the mach_port_t. Use the default payload to port
+ translation function to convert payloads back to port names for
+ this type. */
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+type mach_port_t = MACH_MSG_TYPE_COPY_SEND
+ intranpayload: mach_port_t HURD_DEFAULT_PAYLOAD_TO_PORT;
+#endif
+
+/* The Hurd types. You can inject translation functions for type X
+ using the X_INTRAN, X_INTRAN_PAYLOAD, X_OUTTRAN, and X_DESTRUCTOR.
+
+ If you define X_INTRAN and your server is using libports, you also
+ have to define X_INTRAN_PAYLOAD.
+
+ If you do not use libports, and do not want to use the protected
+ payload mechanism, but you do want to use X_INTRAN, you must
+ provide a X_INTRAN_PAYLOAD that either ignores the message by
+ returning NULL, or indicates an error condition in some appropriate
+ way. If you do want to use the protected payload mechanism, make
+ sure you also define an appropriate HURD_DEFAULT_PAYLOAD_TO_PORT
+ translation function. */
+
type file_t = mach_port_copy_send_t
#ifdef FILE_INTRAN
intran: FILE_INTRAN
+intranpayload: FILE_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: file_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef FILE_OUTTRAN
outtran: FILE_OUTTRAN
@@ -37,6 +92,11 @@ destructor: FILE_DESTRUCTOR
type fsys_t = mach_port_copy_send_t
#ifdef FSYS_INTRAN
intran: FSYS_INTRAN
+intranpayload: FSYS_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: fsys_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef FSYS_OUTTRAN
outtran: FSYS_OUTTRAN
@@ -50,6 +110,11 @@ destructor: FSYS_DESTRUCTOR
type io_t = mach_port_copy_send_t
#ifdef IO_INTRAN
intran: IO_INTRAN
+intranpayload: IO_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: io_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef IO_OUTTRAN
outtran: IO_OUTTRAN
@@ -62,6 +127,11 @@ destructor: IO_DESTRUCTOR
type process_t = mach_port_copy_send_t
#ifdef PROCESS_INTRAN
intran: PROCESS_INTRAN
+intranpayload: PROCESS_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: process_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef PROCESS_OUTTRAN
outtran: PROCESS_OUTTRAN
@@ -74,6 +144,11 @@ destructor: PROCESS_DESTRUCTOR
type auth_t = mach_port_copy_send_t
#ifdef AUTH_INTRAN
intran: AUTH_INTRAN
+intranpayload: AUTH_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: auth_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef AUTH_OUTTRAN
outtran: AUTH_OUTTRAN
@@ -86,6 +161,11 @@ destructor: AUTH_DESTRUCTOR
type socket_t = mach_port_copy_send_t
#ifdef SOCKET_INTRAN
intran: SOCKET_INTRAN
+intranpayload: SOCKET_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: socket_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef SOCKET_OUTTRAN
outtran: SOCKET_OUTTRAN
@@ -99,6 +179,11 @@ destructor: SOCKET_DESTRUCTOR
type pf_t = mach_port_copy_send_t
#ifdef PF_INTRAN
intran: PF_INTRAN
+intranpayload: PF_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: pf_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef PF_OUTTRAN
outtran: PF_OUTTRAN
@@ -111,6 +196,11 @@ destructor: PF_DESTRUCTOR
type addr_port_t = mach_port_copy_send_t
#ifdef ADDRPORT_INTRAN
intran: ADDRPORT_INTRAN
+intranpayload: ADDRPORT_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: addr_port_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef ADDRPORT_OUTTRAN
outtran: ADDRPORT_OUTTRAN
@@ -123,6 +213,11 @@ destructor: ADDRPORT_DESTRUCTOR
type term_t = mach_port_copy_send_t
#ifdef TERM_INTRAN
intran: TERM_INTRAN
+intranpayload: TERM_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: term_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef TERM_OUTTRAN
outtran: TERM_OUTTRAN
@@ -135,6 +230,11 @@ destructor: TERM_DESTRUCTOR
type startup_t = mach_port_copy_send_t
#ifdef STARTUP_INTRAN
intran: STARTUP_INTRAN
+intranpayload: STARTUP_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: startup_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef STARTUP_OUTTRAN
outtran: STARTUP_OUTTRAN
@@ -147,6 +247,11 @@ destructor: STARTUP_DESTRUCTOR
type fs_notify_t = mach_port_copy_send_t
#ifdef FS_NOTIFY_INTRAN
intran: FS_NOTIFY_INTRAN
+intranpayload: FS_NOTIFY_INTRAN_PAYLOAD
+#else
+#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT
+intranpayload: fs_notify_t HURD_DEFAULT_PAYLOAD_TO_PORT
+#endif
#endif
#ifdef FS_NOTIFY_OUTTRAN
outtran: FS_NOTIFY_OUTTRAN
@@ -156,7 +261,6 @@ destructor: FS_NOTIFY_DESTRUCTOR
#endif
;
-
type proccoll_t = mach_port_copy_send_t;
type sreply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
--
1.7.10.4
- [PATCH 08/23] libtrivfs: add a payload-aware intrans functions, (continued)
- [PATCH 08/23] libtrivfs: add a payload-aware intrans functions, Justus Winter, 2013/11/28
- [PATCH 09/23] libcons: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 11/23] pfinet: add a payload-aware intrans functions, Justus Winter, 2013/11/28
- [PATCH 13/23] auth: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 12/23] pflocal: add a payload-aware intrans functions, Justus Winter, 2013/11/28
- [PATCH 14/23] trans: add a payload-aware intrans function to password, Justus Winter, 2013/11/28
- [PATCH 15/23] proc: add a payload-aware intrans function, Justus Winter, 2013/11/28
- [PATCH 17/23] trans: disable default payload to port mapping in fsysServer.c, Justus Winter, 2013/11/28
- [PATCH 16/23] init: disable default payload to port mapping, Justus Winter, 2013/11/28
- [PATCH 18/23] libports: add ports_payload_get_name, Justus Winter, 2013/11/28
- [PATCH 19/23] hurd: add intranpayload functions to all hurd types,
Justus Winter <=
- [PATCH 22/23] Fix build, Justus Winter, 2013/11/28
- [PATCH 23/23] XXX i broke rpctrace, Justus Winter, 2013/11/28
- [PATCH 21/23] XXX libports: clear payload prior to port destruction, Justus Winter, 2013/11/28
- [PATCH 20/23] libports: use protected payloads to optimize the object lookup, Justus Winter, 2013/11/28