summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-17 17:49:48 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-17 17:49:48 +0100
commit75c022df80be3465c46502c607d7987ac35f66f3 (patch)
tree439ed7862c85d8b9dac6785ecd6109fc20e28c3d
parentfe34b57738261446788d09a5af7a293367c960dc (diff)
update protected_payload.patch
-rw-r--r--debian/patches/protected_payload.patch106
1 files changed, 92 insertions, 14 deletions
diff --git a/debian/patches/protected_payload.patch b/debian/patches/protected_payload.patch
index 719aaf3..c657ab0 100644
--- a/debian/patches/protected_payload.patch
+++ b/debian/patches/protected_payload.patch
@@ -1,3 +1,94 @@
+diff --git a/doc/mach.texi b/doc/mach.texi
+index d089224..b3cc2ec 100644
+--- a/doc/mach.texi
++++ b/doc/mach.texi
+@@ -1330,6 +1330,15 @@ which is conventionally used as a reply port by the recipient of the
+ message. The field must carry a send right, a send-once right,
+ @code{MACH_PORT_NULL}, or @code{MACH_PORT_DEAD}.
+
++@item mach_port_t msgh_protected_payload
++The @code{msgh_protected_payload} field carries a payload that is set
++by the kernel during message delivery. The payload is an opaque
++identifier that can be used by the receiver to lookup the associated
++data structure.
++
++It is only valid in received messages. See @ref{Message Receive} for
++further information.
++
+ @item mach_port_seqno_t msgh_seqno
+ The @code{msgh_seqno} field provides a sequence number for the message.
+ It is only valid in received messages; its value in sent messages is
+@@ -1417,6 +1426,7 @@ types are predefined:
+ @item MACH_MSG_TYPE_STRING
+ @item MACH_MSG_TYPE_STRING_C
+ @item MACH_MSG_TYPE_PORT_NAME
++@item MACH_MSG_TYPE_PROTECTED_PAYLOAD
+ @end table
+
+ The following predefined types specify port rights, and receive special
+@@ -1435,6 +1445,11 @@ should be used in preference to @code{MACH_MSG_TYPE_INTEGER_32}.
+ @item MACH_MSG_TYPE_MAKE_SEND_ONCE
+ @end table
+
++The type @code{MACH_MSG_TYPE_PROTECTED_PAYLOAD} is used by the kernel
++to indicate that a delivered message carries a payload in the
++@code{msgh_protected_payload} field. See @ref{Message Receive} for
++more information.
++
+ @item msgt_size : 8
+ The @code{msgt_size} field specifies the size of each datum, in bits. For
+ example, the msgt_size of @code{MACH_MSG_TYPE_INTEGER_32} data is 32.
+@@ -1934,6 +1949,25 @@ loses the receive right after the message was dequeued from it, then
+ right still exists, but isn't held by the caller, then
+ @code{msgh_local_port} specifies @code{MACH_PORT_NULL}.
+
++Servers usually associate some state with a receive right. To that
++end, they might use a hash table to look up the state for the port a
++message was sent to. To optimize this, a task may associate an opaque
++@var{payload} with a receive right using the
++@code{mach_port_set_protected_payload} function. Once this is done,
++the kernel will set the @code{msgh_protected_payload} field to
++@var{payload} when delivering a message to this right and indicate
++this by setting the local part of @code{msgh_bits} to
++@code{MACH_MSG_TYPE_PROTECTED_PAYLOAD}.
++
++The support for protected payloads was added to GNU Mach. To preserve
++binary compatibility, the @code{msgh_local_port} and
++@code{msgh_local_port} share the same location. This makes it
++possible to add the payload information without increasing the size of
++@code{mach_msg_header_t}. This is an implementation detail. Which
++field is valid is determined by the local part of the
++@code{msgh_bits}. Existing software is not affected. When a receive
++right is transferred to another task, its payload is cleared.
++
+ Received messages are stamped with a sequence number, taken from the
+ port from which the message was received. (Messages received from a
+ port set are stamped with a sequence number from the appropriate member
+@@ -2715,6 +2749,24 @@ In addition to the normal diagnostic return codes from the call's server
+ (normally the kernel), the call may return @code{mach_msg} return codes.
+ @end deftypefun
+
++@deftypefun kern_return_t mach_port_set_protected_payload (@w{ipc_space_t @var{task}}, @w{mach_port_t @var{name}}, @w{unsigned long @var{payload}})
++The function @code{mach_port_set_protected_payload} sets the protected
++payload to @var{payload}. If @var{payload} is non-zero, the
++@code{msgh_protected_payload} field will be set to @var{payload} if a
++message is delivered to @var{name}.
++
++The function returns @code{KERN_SUCCESS} if the call succeeded,
++@code{KERN_INVALID_TASK} if @var{task} was invalid,
++@code{KERN_INVALID_NAME} if @var{name} did not denote a right and
++@code{KERN_INVALID_RIGHT} if @var{name} denoted a right, but not a
++receive right.
++
++The @code{mach_port_set_protected_payload} call is actually an RPC to
++@var{task}, normally a send right for a task port, but potentially any
++send right. In addition to the normal diagnostic return codes from
++the call's server (normally the kernel), the call may return
++@code{mach_msg} return codes.
++@end deftypefun
+
+ @node Port Sets
+ @subsection Port Sets
diff --git a/include/mach/mach_port.defs b/include/mach/mach_port.defs
index e1f45e3..96a5987 100644
--- a/include/mach/mach_port.defs
@@ -49,19 +140,6 @@ index f78e978..0a7297e 100644
/*
* A dummy value. Mostly used to indicate that the actual value
-diff --git a/ipc/ipc_init.c b/ipc/ipc_init.c
-index debda47..7627b4e 100644
---- a/ipc/ipc_init.c
-+++ b/ipc/ipc_init.c
-@@ -80,7 +80,7 @@ ipc_bootstrap(void)
- sizeof(struct ipc_tree_entry), 0, NULL, NULL, NULL, 0);
-
- kmem_cache_init(&ipc_object_caches[IOT_PORT], "ipc_port",
-- sizeof(struct ipc_port), 0, NULL, NULL, NULL, 0);
-+ sizeof(struct ipc_port)+4, 0, NULL, NULL, NULL, 0);
-
- kmem_cache_init(&ipc_object_caches[IOT_PORT_SET], "ipc_pset",
- sizeof(struct ipc_pset), 0, NULL, NULL, NULL, 0);
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 0e43410..aa51100 100644
--- a/ipc/ipc_kmsg.c
@@ -272,7 +350,7 @@ index 41fe3de..1edbb47 100644
if (bits & MACH_PORT_TYPE_SEND) {
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
-index fbc5e69..d80d526 100644
+index 13572a1..14c3653 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -1564,3 +1564,40 @@ mach_port_set_syscall_right(task, name)