summaryrefslogtreecommitdiff
path: root/ipc/ipc_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/ipc_port.c')
-rw-r--r--ipc/ipc_port.c88
1 files changed, 67 insertions, 21 deletions
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index 8e41c3ca..86a4ee2a 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -53,6 +53,7 @@
#if MACH_KDB
#include <ddb/db_output.h>
+#include <ipc/ipc_print.h>
#endif /* MACH_KDB */
@@ -93,11 +94,11 @@ ipc_port_timestamp(void)
*/
kern_return_t
-ipc_port_dnrequest(port, name, soright, indexp)
- ipc_port_t port;
- mach_port_t name;
- ipc_port_t soright;
- ipc_port_request_index_t *indexp;
+ipc_port_dnrequest(
+ ipc_port_t port,
+ mach_port_t name,
+ ipc_port_t soright,
+ ipc_port_request_index_t *indexp)
{
ipc_port_request_t ipr, table;
ipc_port_request_index_t index;
@@ -141,8 +142,7 @@ ipc_port_dnrequest(port, name, soright, indexp)
*/
kern_return_t
-ipc_port_dngrow(port)
- ipc_port_t port;
+ipc_port_dngrow(ipc_port_t port)
{
ipc_table_size_t its;
ipc_port_request_t otable, ntable;
@@ -274,9 +274,9 @@ ipc_port_dncancel(
void
ipc_port_pdrequest(
- ipc_port_t port,
- ipc_port_t notify,
- ipc_port_t *previousp)
+ ipc_port_t port,
+ const ipc_port_t notify,
+ ipc_port_t *previousp)
{
ipc_port_t previous;
@@ -381,8 +381,7 @@ ipc_port_set_qlimit(
*/
ipc_mqueue_t
-ipc_port_lock_mqueue(port)
- ipc_port_t port;
+ipc_port_lock_mqueue(ipc_port_t port)
{
if (port->ip_pset != IPS_NULL) {
ipc_pset_t pset = port->ip_pset;
@@ -412,9 +411,9 @@ ipc_port_lock_mqueue(port)
*/
void
-ipc_port_set_seqno(port, seqno)
- ipc_port_t port;
- mach_port_seqno_t seqno;
+ipc_port_set_seqno(
+ ipc_port_t port,
+ mach_port_seqno_t seqno)
{
ipc_mqueue_t mqueue;
@@ -424,6 +423,44 @@ ipc_port_set_seqno(port, seqno)
}
/*
+ * Routine: ipc_port_set_protected_payload
+ * Purpose:
+ * Changes a port's protected payload.
+ * Conditions:
+ * The port is locked and active.
+ */
+
+void
+ipc_port_set_protected_payload(ipc_port_t port, unsigned long payload)
+{
+ ipc_mqueue_t mqueue;
+
+ mqueue = ipc_port_lock_mqueue(port);
+ port->ip_protected_payload = payload;
+ ipc_port_flag_protected_payload_set(port);
+ imq_unlock(mqueue);
+}
+
+/*
+ * Routine: ipc_port_clear_protected_payload
+ * Purpose:
+ * Clear a port's protected payload.
+ * Conditions:
+ * The port is locked and active.
+ */
+
+void
+ipc_port_clear_protected_payload(ipc_port_t port)
+{
+ ipc_mqueue_t mqueue;
+
+ mqueue = ipc_port_lock_mqueue(port);
+ ipc_port_flag_protected_payload_clear(port);
+ imq_unlock(mqueue);
+}
+
+
+/*
* Routine: ipc_port_clear_receiver
* Purpose:
* Prepares a receive right for transmission/destruction.
@@ -492,6 +529,8 @@ ipc_port_init(
port->ip_seqno = 0;
port->ip_msgcount = 0;
port->ip_qlimit = MACH_PORT_QLIMIT_DEFAULT;
+ ipc_port_flag_protected_payload_clear(port);
+ port->ip_protected_payload = 0;
ipc_mqueue_init(&port->ip_messages);
ipc_thread_queue_init(&port->ip_blocked);
@@ -614,6 +653,7 @@ ipc_port_destroy(
/* make port be in limbo */
port->ip_receiver_name = MACH_PORT_NULL;
port->ip_destination = IP_NULL;
+ ipc_port_flag_protected_payload_clear(port);
ip_unlock(port);
if (!ipc_port_check_circularity(port, pdrequest)) {
@@ -1134,16 +1174,15 @@ ipc_port_release_receive(
*/
ipc_port_t
-ipc_port_alloc_special(space)
- ipc_space_t space;
+ipc_port_alloc_special(ipc_space_t space)
{
ipc_port_t port;
- port = (ipc_port_t) io_alloc(IOT_PORT);
+ port = ip_alloc();
if (port == IP_NULL)
return IP_NULL;
- io_lock_init(&port->ip_object);
+ ip_lock_init(port);
port->ip_references = 1;
port->ip_object.io_bits = io_makebits(TRUE, IOT_PORT, 0);
@@ -1211,12 +1250,17 @@ ipc_port_dealloc_special(
void
ipc_port_print(port)
- ipc_port_t port;
+ const ipc_port_t port;
{
printf("port 0x%x\n", port);
indent += 2;
+ iprintf("flags ");
+ printf("has_protected_payload=%d",
+ ipc_port_flag_protected_payload(port));
+ printf("\n");
+
ipc_object_print(&port->ip_object);
iprintf("receiver=0x%x", port->ip_receiver);
printf(", receiver_name=0x%x\n", port->ip_receiver_name);
@@ -1239,7 +1283,9 @@ ipc_port_print(port)
printf(", sndrs=0x%x", port->ip_blocked.ithq_base);
printf(", kobj=0x%x\n", port->ip_kobject);
- indent -=2;
+ iprintf("protected_payload=%p\n", (void *) port->ip_protected_payload);
+
+ indent -= 2;
}
#endif /* MACH_KDB */