diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2013-11-21 16:50:49 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-10-01 09:03:51 +0200 |
commit | d565bf2f784ce1203e77306d05eade03933bc523 (patch) | |
tree | 1c30bed601834acd886b9dc4abcecb706349d8b6 /ipc/ipc_port.h | |
parent | 3a0fae39873c9c7d73dc978888e45b87ad27d44e (diff) | |
download | gnumach-d565bf2f784ce1203e77306d05eade03933bc523.tar.gz gnumach-d565bf2f784ce1203e77306d05eade03933bc523.tar.bz2 gnumach-d565bf2f784ce1203e77306d05eade03933bc523.zip |
ipc: add protected payload
Add a field ip_protected_payload and a flag ip_has_protected_payload
to struct ipc_port.
Clear the protected payload when a receive port is moved from one ipc
space to another. This is done to retain the old behavior of
mach_msg, so that a port name is sent in the msgh_local_port field.
If the new owner of that receive right wishes to use the protected
payload mechanism, it has to be explicitly set again.
* ipc/ipc_port.h (struct ipc_port): Add field ip_protected_payload.
(ipc_port_set_protected_payload): Add function declaration.
(ipc_port_clear_protected_payload): Likewise.
(ipc_port_flag_protected_payload): Add accessor for the protected
payload flag.
(ipc_port_flag_protected_payload_set): Likewise.
(ipc_port_flag_protected_payload_clear): Likewise.
* ipc/ipc_port.c (ipc_port_init): Initialize protected payload.
(ipc_port_print): Print protected_payload.
(ipc_port_set_protected_payload): New function.
(ipc_port_clear_protected_payload): Likewise.
(ipc_port_destroy): Clear the payload when moving a receive port.
* ipc/ipc_right.c (ipc_right_copyin): Likewise.
(ipc_right_copyout): Likewise.
* ipc/ipc_object.c (ipc_object_copyin_from_kernel): Likewise.
* ipc/ipc_object.h (IO_BITS_PROTECTED_PAYLOAD): New bitmask.
(IO_BITS_OTYPE): Adjust accordingly.
Diffstat (limited to 'ipc/ipc_port.h')
-rw-r--r-- | ipc/ipc_port.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ipc/ipc_port.h b/ipc/ipc_port.h index 27d2e496..125fefc0 100644 --- a/ipc/ipc_port.h +++ b/ipc/ipc_port.h @@ -48,6 +48,7 @@ #include <ipc/ipc_mqueue.h> #include <ipc/ipc_table.h> #include <ipc/ipc_thread.h> +#include <ipc/ipc_object.h> #include "ipc_target.h" #include <mach/rpc.h> @@ -96,6 +97,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 +264,12 @@ 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_protected_payload(ipc_port_t); + +extern void ipc_port_clear_receiver(ipc_port_t); extern void @@ -325,4 +333,23 @@ ipc_port_dealloc_special(ipc_port_t, ipc_space_t); #define ipc_port_release(port) \ ipc_object_release(&(port)->ip_object) +extern inline boolean_t +ipc_port_flag_protected_payload(const struct ipc_port *port) +{ + return !! (port->ip_target.ipt_object.io_bits + & IO_BITS_PROTECTED_PAYLOAD); +} + +extern inline void +ipc_port_flag_protected_payload_set(struct ipc_port *port) +{ + port->ip_target.ipt_object.io_bits |= IO_BITS_PROTECTED_PAYLOAD; +} + +extern inline void +ipc_port_flag_protected_payload_clear(struct ipc_port *port) +{ + port->ip_target.ipt_object.io_bits &= ~IO_BITS_PROTECTED_PAYLOAD; +} + #endif /* _IPC_IPC_PORT_H_ */ |