diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-07 14:46:32 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-07 14:46:32 +0100 |
commit | a2e5bc33358bb663acebf270c26a4b0e302ac292 (patch) | |
tree | 36c519889cbaa25184e3c08e3898c3420e84d723 /debian | |
parent | 56faa3e49e4c7ffb668005882384febe6a0d4511 (diff) |
add patch series
Diffstat (limited to 'debian')
-rw-r--r-- | debian/patches/0001-Retire-old_mach_port_get_receive_status.patch | 132 | ||||
-rw-r--r-- | debian/patches/0002-Add-a-new-flavor-of-no-senders-notifications.patch | 371 | ||||
-rw-r--r-- | debian/patches/series | 2 |
3 files changed, 505 insertions, 0 deletions
diff --git a/debian/patches/0001-Retire-old_mach_port_get_receive_status.patch b/debian/patches/0001-Retire-old_mach_port_get_receive_status.patch new file mode 100644 index 0000000..ff28768 --- /dev/null +++ b/debian/patches/0001-Retire-old_mach_port_get_receive_status.patch @@ -0,0 +1,132 @@ +From d1b97ad52514eb9d676dc7efe0bff6cc518d4548 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 6 Dec 2014 11:59:32 +0100 +Subject: [PATCH gnumach 1/2] Retire `old_mach_port_get_receive_status' + +Retire the compatibility RPC `old_mach_port_get_receive_status' that +works like `mach_port_get_receive_status' but returns an +`old_mach_port_status' object that lacks the `mps_seqno' field. + +* include/mach/mach_port.defs (old_mach_port_get_receive_status): Drop RPC. +* include/mach/mach_types.defs (old_mach_port_status_t): Drop type. +* include/mach/port.h (old_mach_port_status_t): Likewise. +* ipc/mach_port.c (old_mach_port_get_receive_status): Drop function. +--- + include/mach/mach_port.defs | 9 +-------- + include/mach/mach_types.defs | 2 -- + include/mach/port.h | 16 ---------------- + ipc/mach_port.c | 40 ---------------------------------------- + 4 files changed, 1 insertion(+), 66 deletions(-) + +diff --git a/include/mach/mach_port.defs b/include/mach/mach_port.defs +index c7e8526..c21c34b 100644 +--- a/include/mach/mach_port.defs ++++ b/include/mach/mach_port.defs +@@ -176,14 +176,7 @@ routine mach_port_mod_refs( + right : mach_port_right_t; + delta : mach_port_delta_t); + +-/* +- * Temporary compatibility call. +- */ +- +-routine old_mach_port_get_receive_status( +- task : ipc_space_t; +- name : mach_port_name_t; +- out status : old_mach_port_status_t); ++skip; /* old old_mach_port_get_receive_status */ + + /* + * Only valid for receive rights. +diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs +index 85ad653..8e68d38 100644 +--- a/include/mach/mach_types.defs ++++ b/include/mach/mach_types.defs +@@ -60,8 +60,6 @@ serverprefix SERVERPREFIX; + + type mach_port_status_t = struct[9] of integer_t; + +-type old_mach_port_status_t = struct[8] of integer_t; /* compatibility */ +- + type task_t = mach_port_t + ctype: mach_port_t + #if KERNEL_SERVER +diff --git a/include/mach/port.h b/include/mach/port.h +index 53f6071..79b5f4c 100644 +--- a/include/mach/port.h ++++ b/include/mach/port.h +@@ -134,20 +134,4 @@ typedef struct mach_port_status { + #define MACH_PORT_QLIMIT_DEFAULT ((mach_port_msgcount_t) 5) + #define MACH_PORT_QLIMIT_MAX ((mach_port_msgcount_t) 16) + +-/* +- * Compatibility definitions, for code written +- * before there was an mps_seqno field. +- */ +- +-typedef struct old_mach_port_status { +- mach_port_t mps_pset; /* containing port set */ +-/*mach_port_mscount_t*/natural_t mps_mscount; /* make-send count */ +-/*mach_port_msgcount_t*/natural_t mps_qlimit; /* queue limit */ +-/*mach_port_msgcount_t*/natural_t mps_msgcount; /* number in the queue */ +-/*mach_port_rights_t*/natural_t mps_sorights; /* how many send-once rights */ +-/*boolean_t*/natural_t mps_srights; /* do send rights exist? */ +-/*boolean_t*/natural_t mps_pdrequest; /* port-deleted requested? */ +-/*boolean_t*/natural_t mps_nsrequest; /* no-senders requested? */ +-} old_mach_port_status_t; +- + #endif /* _MACH_PORT_H_ */ +diff --git a/ipc/mach_port.c b/ipc/mach_port.c +index 4ff39f2..c7d9b81 100644 +--- a/ipc/mach_port.c ++++ b/ipc/mach_port.c +@@ -744,46 +744,6 @@ mach_port_mod_refs( + } + + /* +- * Routine: old_mach_port_get_receive_status [kernel call] +- * Purpose: +- * Compatibility for code written before sequence numbers. +- * Retrieves mucho info about a receive right. +- * Conditions: +- * Nothing locked. +- * Returns: +- * KERN_SUCCESS Retrieved status. +- * KERN_INVALID_TASK The space is null. +- * KERN_INVALID_TASK The space is dead. +- * KERN_INVALID_NAME The name doesn't denote a right. +- * KERN_INVALID_RIGHT Name doesn't denote receive rights. +- */ +- +-kern_return_t +-old_mach_port_get_receive_status( +- ipc_space_t space, +- mach_port_t name, +- old_mach_port_status_t *statusp) +-{ +- mach_port_status_t status; +- kern_return_t kr; +- +- kr = mach_port_get_receive_status(space, name, &status); +- if (kr != KERN_SUCCESS) +- return kr; +- +- statusp->mps_pset = status.mps_pset; +- statusp->mps_mscount = status.mps_mscount; +- statusp->mps_qlimit = status.mps_qlimit; +- statusp->mps_msgcount = status.mps_msgcount; +- statusp->mps_sorights = status.mps_sorights; +- statusp->mps_srights = status.mps_srights; +- statusp->mps_pdrequest = status.mps_pdrequest; +- statusp->mps_nsrequest = status.mps_nsrequest; +- +- return KERN_SUCCESS; +-} +- +-/* + * Routine: mach_port_set_qlimit [kernel call] + * Purpose: + * Changes a receive right's queue limit. +-- +2.1.3 + diff --git a/debian/patches/0002-Add-a-new-flavor-of-no-senders-notifications.patch b/debian/patches/0002-Add-a-new-flavor-of-no-senders-notifications.patch new file mode 100644 index 0000000..1178e8b --- /dev/null +++ b/debian/patches/0002-Add-a-new-flavor-of-no-senders-notifications.patch @@ -0,0 +1,371 @@ +From 25207576b2dca77da167c19a7ff16cf469acf1bc Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 7 Dec 2014 14:27:23 +0100 +Subject: [PATCH gnumach 2/2] Add a new flavor of no-senders notifications + +The no-senders notifications do not carry a port name. Add a new +flavor of no-senders notifications `MACH_NOTIFY_NO_SENDERS2' that does +carry the name of the port that lost the last sender. + +* include/mach/notify.defs (mach_notify_no_senders2): New simple routine. +* include/mach/notify.h (MACH_NOTIFY_NO_SENDERS2): New macro. +* ipc/ipc_notify.c (ipc_notify_no_senders2_template, +ipc_notify_init_no_senders2, ipc_notify_init): Initialize a template. +(ipc_notify_no_senders): Test whether a new-style notification has +been requested. +(ipc_notify_no_senders2): New function. +* ipc/ipc_notify.h (ipc_notify_no_senders2): New declaration. +(NSREQUEST_FLAG_NO_SENDERS2, NSREQUEST_FLAG_MASK, NSREQUEST_IPC_PORT, +NSREQUEST_HAS_FLAG, NSREQUEST_SET_FLAG): Machinery to store flags in +the least significant bits of the `nsrequest' field. +* ipc/ipc_port.c (ipc_port_nsrequest2): Add `new_style' parameter, +rename from `ipc_port_nsrequest', set flag if `new_style' is given, +and filter it from the returned `previous' port. +(ipc_port_nsrequest): New function. +(ipc_port_destroy): Filter out flags from `ip_nsrequest'. +* ipc/ipc_port.h (struct ipc_port): Document the use of flags. +(ipc_port_nsrequest2): New declaration. +* ipc/mach_port.c (mach_port_request_notification): Handle +MACH_NOTIFY_NO_SENDERS2. +--- + include/mach/notify.defs | 9 ++++++ + include/mach/notify.h | 11 +++++++ + ipc/ipc_notify.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ + ipc/ipc_notify.h | 14 ++++++++ + ipc/ipc_port.c | 36 ++++++++++++++++++--- + ipc/ipc_port.h | 10 +++++- + ipc/mach_port.c | 6 ++-- + 7 files changed, 162 insertions(+), 8 deletions(-) + +diff --git a/include/mach/notify.defs b/include/mach/notify.defs +index 6ba4cde..06802ce 100644 +--- a/include/mach/notify.defs ++++ b/include/mach/notify.defs +@@ -110,3 +110,12 @@ simpleroutine mach_notify_dead_name( + msgseqno seqno : mach_port_seqno_t; + #endif + name : mach_port_name_t); ++ ++/* MACH_NOTIFY_NO_SENDERS2: 0111 */ ++simpleroutine mach_notify_no_senders2( ++ notify : notify_port_t; ++#if SEQNOS ++ msgseqno seqno : mach_port_seqno_t; ++#endif ++ name : mach_port_name_t; ++ mscount : mach_port_mscount_t); +diff --git a/include/mach/notify.h b/include/mach/notify.h +index 6d783dd..d3b4c01 100644 +--- a/include/mach/notify.h ++++ b/include/mach/notify.h +@@ -53,6 +53,9 @@ + /* An extant send-once right died */ + #define MACH_NOTIFY_DEAD_NAME (MACH_NOTIFY_FIRST + 010) + /* Send or send-once right died, leaving a dead-name */ ++#define MACH_NOTIFY_NO_SENDERS2 (MACH_NOTIFY_FIRST + 011) ++ /* Receive right has no extant send rights, ++ new version. */ + #define MACH_NOTIFY_LAST (MACH_NOTIFY_FIRST + 015) + + typedef struct { +@@ -81,6 +84,14 @@ typedef struct { + + typedef struct { + mach_msg_header_t not_header; ++ mach_msg_type_t not_port_type; /* MACH_MSG_TYPE_PORT_NAME */ ++ mach_port_t not_port; ++ mach_msg_type_t not_type; /* MACH_MSG_TYPE_INTEGER_32 */ ++ unsigned int not_count; ++} mach_no_senders_notification2_t; ++ ++typedef struct { ++ mach_msg_header_t not_header; + } mach_send_once_notification_t; + + typedef struct { +diff --git a/ipc/ipc_notify.c b/ipc/ipc_notify.c +index df5f68b..8556fee 100644 +--- a/ipc/ipc_notify.c ++++ b/ipc/ipc_notify.c +@@ -47,6 +47,7 @@ mach_port_deleted_notification_t ipc_notify_port_deleted_template; + mach_msg_accepted_notification_t ipc_notify_msg_accepted_template; + mach_port_destroyed_notification_t ipc_notify_port_destroyed_template; + mach_no_senders_notification_t ipc_notify_no_senders_template; ++mach_no_senders_notification2_t ipc_notify_no_senders2_template; + mach_send_once_notification_t ipc_notify_send_once_template; + mach_dead_name_notification_t ipc_notify_dead_name_template; + +@@ -175,6 +176,48 @@ ipc_notify_init_no_senders( + } + + /* ++ * Routine: ipc_notify_init_no_senders2 ++ * Purpose: ++ * Initialize a template for no-senders2 notifications. ++ */ ++ ++void ++ipc_notify_init_no_senders2( ++ mach_no_senders_notification2_t *n) ++{ ++ mach_msg_header_t *m = &n->not_header; ++ mach_msg_type_t *t; ++ ++ m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND_ONCE, 0); ++ m->msgh_size = sizeof *n; ++ m->msgh_seqno = NOTIFY_MSGH_SEQNO; ++ m->msgh_local_port = MACH_PORT_NULL; ++ m->msgh_remote_port = MACH_PORT_NULL; ++ m->msgh_id = MACH_NOTIFY_NO_SENDERS; ++ ++ t = &n->not_port_type; ++ t->msgt_name = MACH_MSG_TYPE_PORT_NAME; ++ t->msgt_size = PORT_T_SIZE_IN_BITS; ++ t->msgt_number = 1; ++ t->msgt_inline = TRUE; ++ t->msgt_longform = FALSE; ++ t->msgt_deallocate = FALSE; ++ t->msgt_unused = 0; ++ ++ t = &n->not_type; ++ t->msgt_name = MACH_MSG_TYPE_INTEGER_32; ++ t->msgt_size = PORT_T_SIZE_IN_BITS; ++ t->msgt_number = 1; ++ t->msgt_inline = TRUE; ++ t->msgt_longform = FALSE; ++ t->msgt_deallocate = FALSE; ++ t->msgt_unused = 0; ++ ++ n->not_port = MACH_PORT_NULL; ++ n->not_count = 0; ++} ++ ++/* + * Routine: ipc_notify_init_send_once + * Purpose: + * Initialize a template for send-once notifications. +@@ -238,6 +281,7 @@ ipc_notify_init(void) + ipc_notify_init_msg_accepted(&ipc_notify_msg_accepted_template); + ipc_notify_init_port_destroyed(&ipc_notify_port_destroyed_template); + ipc_notify_init_no_senders(&ipc_notify_no_senders_template); ++ ipc_notify_init_no_senders2(&ipc_notify_no_senders2_template); + ipc_notify_init_send_once(&ipc_notify_send_once_template); + ipc_notify_init_dead_name(&ipc_notify_dead_name_template); + } +@@ -366,6 +410,11 @@ ipc_notify_no_senders( + ipc_kmsg_t kmsg; + mach_no_senders_notification_t *n; + ++ if (NSREQUEST_HAS_FLAG (port, NSREQUEST_FLAG_NO_SENDERS2)) { ++ ipc_notify_no_senders2 (NSREQUEST_IPC_PORT (port), mscount); ++ return; ++ } ++ + kmsg = ikm_alloc(sizeof *n); + if (kmsg == IKM_NULL) { + printf("dropped no-senders (0x%p, %u)\n", port, mscount); +@@ -384,6 +433,41 @@ ipc_notify_no_senders( + } + + /* ++ * Routine: ipc_notify_no_senders2 ++ * Purpose: ++ * Send a no-senders2 notification. ++ * Conditions: ++ * Nothing locked. ++ * Consumes a ref/soright for port. ++ */ ++ ++void ++ipc_notify_no_senders2( ++ ipc_port_t port, ++ mach_port_mscount_t mscount) ++{ ++ ipc_kmsg_t kmsg; ++ mach_no_senders_notification2_t *n; ++ ++ kmsg = ikm_alloc(sizeof *n); ++ if (kmsg == IKM_NULL) { ++ printf("dropped no-senders (0x%p, %u)\n", port, mscount); ++ ipc_port_release_sonce(port); ++ return; ++ } ++ ++ ikm_init(kmsg, sizeof *n); ++ n = (mach_no_senders_notification2_t *) &kmsg->ikm_header; ++ *n = ipc_notify_no_senders2_template; ++ ++ n->not_header.msgh_remote_port = (mach_port_t) port; ++ n->not_count = mscount; ++ n->not_port = port->ip_receiver_name; ++ ++ ipc_mqueue_send_always(kmsg); ++} ++ ++/* + * Routine: ipc_notify_send_once + * Purpose: + * Send a send-once notification. +diff --git a/ipc/ipc_notify.h b/ipc/ipc_notify.h +index 789bd23..b1fa090 100644 +--- a/ipc/ipc_notify.h ++++ b/ipc/ipc_notify.h +@@ -50,6 +50,20 @@ extern void + ipc_notify_no_senders(ipc_port_t, mach_port_mscount_t); + + extern void ++ipc_notify_no_senders2 (ipc_port_t, mach_port_mscount_t); ++ ++/* No-senders notifications come in two flavors. We use the least ++ significant bit to indicate that the new flavor was requested. */ ++#define NSREQUEST_FLAG_NO_SENDERS2 0x1 ++#define NSREQUEST_FLAG_MASK 0x1 ++#define NSREQUEST_IPC_PORT(X) \ ++ ((ipc_port_t) ((unsigned long) (X) &~ NSREQUEST_FLAG_MASK)) ++#define NSREQUEST_HAS_FLAG(X, F) \ ++ ((unsigned long) (X) & F) ++#define NSREQUEST_SET_FLAG(X, F) \ ++ ((ipc_port_t) ((unsigned long) (X) | F)) ++ ++extern void + ipc_notify_send_once(ipc_port_t); + + extern void +diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c +index 89a5d67..8817c49 100644 +--- a/ipc/ipc_port.c ++++ b/ipc/ipc_port.c +@@ -290,7 +290,7 @@ ipc_port_pdrequest( + } + + /* +- * Routine: ipc_port_nsrequest ++ * Routine: ipc_port_nsrequest2 + * Purpose: + * Make a no-senders request, returning the + * previously registered send-once right. +@@ -302,8 +302,9 @@ ipc_port_pdrequest( + */ + + void +-ipc_port_nsrequest( ++ipc_port_nsrequest2( + ipc_port_t port, ++ boolean_t new_style, + mach_port_mscount_t sync, + ipc_port_t notify, + ipc_port_t *previousp) +@@ -313,7 +314,7 @@ ipc_port_nsrequest( + + assert(ip_active(port)); + +- previous = port->ip_nsrequest; ++ previous = NSREQUEST_IPC_PORT (port->ip_nsrequest); + mscount = port->ip_mscount; + + if ((port->ip_srights == 0) && +@@ -323,7 +324,10 @@ ipc_port_nsrequest( + ip_unlock(port); + ipc_notify_no_senders(notify, mscount); + } else { +- port->ip_nsrequest = notify; ++ port->ip_nsrequest = new_style ++ ? NSREQUEST_SET_FLAG (notify, ++ NSREQUEST_FLAG_NO_SENDERS2) ++ : notify; + ip_unlock(port); + } + +@@ -331,6 +335,28 @@ ipc_port_nsrequest( + } + + /* ++ * Routine: ipc_port_nsrequest ++ * Purpose: ++ * Make a no-senders request, returning the ++ * previously registered send-once right. ++ * Just cancels the previous request if notify is IP_NULL. ++ * Conditions: ++ * The port is locked and active. It is unlocked. ++ * Consumes a ref for notify (if non-null), and ++ * returns previous with a ref (if non-null). ++ */ ++ ++void ++ipc_port_nsrequest( ++ ipc_port_t port, ++ mach_port_mscount_t sync, ++ ipc_port_t notify, ++ ipc_port_t *previousp) ++{ ++ ipc_port_nsrequest2 (port, FALSE, sync, notify, previousp); ++} ++ ++/* + * Routine: ipc_port_set_qlimit + * Purpose: + * Changes a port's queue limit; the maximum number +@@ -698,7 +724,7 @@ ipc_port_destroy( + + /* throw away no-senders request */ + +- nsrequest = port->ip_nsrequest; ++ nsrequest = NSREQUEST_IPC_PORT (port->ip_nsrequest); + if (nsrequest != IP_NULL) + ipc_notify_send_once(nsrequest); /* consumes ref */ + +diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h +index 6914c71..e614ae8 100644 +--- a/ipc/ipc_port.h ++++ b/ipc/ipc_port.h +@@ -88,7 +88,7 @@ struct ipc_port { + mach_port_rights_t ip_srights; + mach_port_rights_t ip_sorights; + +- struct ipc_port *ip_nsrequest; ++ struct ipc_port *ip_nsrequest; /* flags in the LSBs */ + struct ipc_port *ip_pdrequest; + struct ipc_port_request *ip_dnrequests; + +@@ -245,6 +245,14 @@ extern void ipc_port_nsrequest( + ipc_port_t notify, + ipc_port_t *previousp); + ++/* Make a no-senders request, new version. */ ++extern void ipc_port_nsrequest2( ++ ipc_port_t port, ++ boolean_t new_style, ++ mach_port_mscount_t sync, ++ ipc_port_t notify, ++ ipc_port_t *previousp); ++ + /* Change a port's queue limit */ + extern void ipc_port_set_qlimit( + ipc_port_t port, +diff --git a/ipc/mach_port.c b/ipc/mach_port.c +index c7d9b81..ad10cd2 100644 +--- a/ipc/mach_port.c ++++ b/ipc/mach_port.c +@@ -1202,7 +1202,8 @@ mach_port_request_notification( + break; + } + +- case MACH_NOTIFY_NO_SENDERS: { ++ case MACH_NOTIFY_NO_SENDERS: ++ case MACH_NOTIFY_NO_SENDERS2: { + ipc_port_t port; + + kr = ipc_port_translate_receive(space, name, &port); +@@ -1210,7 +1211,8 @@ mach_port_request_notification( + return kr; + /* port is locked and active */ + +- ipc_port_nsrequest(port, sync, notify, previousp); ++ ipc_port_nsrequest2 (port, id == MACH_NOTIFY_NO_SENDERS2, ++ sync, notify, previousp); + /* port is unlocked */ + break; + } +-- +2.1.3 + diff --git a/debian/patches/series b/debian/patches/series index 01571be..471a407 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -9,3 +9,5 @@ vm_cache_policy.patch tn-0001-kern-provide-notifications-about-new-tasks.patch tn-0002-include-add-X_IMPORTS-to-ipc-definitions.patch +0001-Retire-old_mach_port_get_receive_status.patch +0002-Add-a-new-flavor-of-no-senders-notifications.patch |