[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/11] ipc: add protected payload
From: |
Justus Winter |
Subject: |
[PATCH 02/11] ipc: add protected payload |
Date: |
Mon, 17 Feb 2014 18:20:52 +0100 |
* ipc/ipc_port.c (ipc_port_init): Initialize protected_payload.
(ipc_port_print): Print protected_payload.
(ipc_port_set_protected_payload): New function.
* ipc/ipc_port.h (struct ipc_port): Add field protected_payload.
(ipc_port_set_protected_payload): Add function declaration.
---
ipc/ipc_port.c | 22 ++++++++++++++++++++++
ipc/ipc_port.h | 4 ++++
2 files changed, 26 insertions(+)
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index d4ade8e..4e6d598 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -425,6 +425,25 @@ 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;
+ imq_unlock(mqueue);
+}
+
+
+/*
* Routine: ipc_port_clear_receiver
* Purpose:
* Prepares a receive right for transmission/destruction.
@@ -493,6 +512,7 @@ ipc_port_init(
port->ip_seqno = 0;
port->ip_msgcount = 0;
port->ip_qlimit = MACH_PORT_QLIMIT_DEFAULT;
+ port->ip_protected_payload = 0;
ipc_mqueue_init(&port->ip_messages);
ipc_thread_queue_init(&port->ip_blocked);
@@ -1240,6 +1260,8 @@ ipc_port_print(port)
printf(", sndrs=0x%x", port->ip_blocked.ithq_base);
printf(", kobj=0x%x\n", port->ip_kobject);
+ iprintf("protected_payload=%p\n", (void *) port->ip_protected_payload);
+
indent -= 2;
}
diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h
index 27d2e49..a1a0943 100644
--- a/ipc/ipc_port.h
+++ b/ipc/ipc_port.h
@@ -96,6 +96,7 @@ struct ipc_port {
mach_port_msgcount_t ip_msgcount;
mach_port_msgcount_t ip_qlimit;
struct ipc_thread_queue ip_blocked;
+ unsigned long ip_protected_payload;
};
#define ip_object ip_target.ipt_object
@@ -262,6 +263,9 @@ extern void
ipc_port_set_seqno(ipc_port_t, mach_port_seqno_t);
extern void
+ipc_port_set_protected_payload(ipc_port_t, unsigned long);
+
+extern void
ipc_port_clear_receiver(ipc_port_t);
extern void
--
1.8.5.2
- protected payloads for GNU Mach, Justus Winter, 2014/02/17
- [PATCH 01/11] include: skip routines related to migrating threads, Justus Winter, 2014/02/17
- [PATCH 04/11] doc: document mach_port_set_protected_payload, Justus Winter, 2014/02/17
- [PATCH 02/11] ipc: add protected payload,
Justus Winter <=
- [PATCH 03/11] ipc: implement mach_port_set_protected_payload, Justus Winter, 2014/02/17
- [PATCH 07/11] include: define MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2014/02/17
- [PATCH 08/11] doc: document MACH_MSG_TYPE_PROTECTED_PAYLOAD, Justus Winter, 2014/02/17
- [PATCH 06/11] doc: document msgh_protected_payload, Justus Winter, 2014/02/17
- [PATCH 10/11] ipc: clear the payload when moving a receive port, Justus Winter, 2014/02/17
- [PATCH 05/11] include: add msgh_protected_payload to mach_msg_header_t, Justus Winter, 2014/02/17
- [PATCH 11/11] doc: document message semantics with protected payloads, Justus Winter, 2014/02/17
- [PATCH 09/11] ipc: provide the protected payload in ipc_kmsg_copyout_header, Justus Winter, 2014/02/17
- Re: protected payloads for GNU Mach, Samuel Thibault, 2014/02/19