X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/743345f9a4b36f7e2f9ba37691e70c50baecb56e..4d15aeb193b2c68f1d38666c317f8d3734f5f083:/osfmk/ipc/ipc_mqueue.h diff --git a/osfmk/ipc/ipc_mqueue.h b/osfmk/ipc/ipc_mqueue.h index 2a83023e8..af0a534a4 100644 --- a/osfmk/ipc/ipc_mqueue.h +++ b/osfmk/ipc/ipc_mqueue.h @@ -93,10 +93,10 @@ typedef struct ipc_mqueue { #if MACH_FLIPC struct flipc_port *fport; // Null for local port, or ptr to flipc port #endif - } __attribute__((__packed__)) port; + } port; struct { struct waitq_set setq; - } __attribute__((__packed__)) pset; + } pset; } data; struct klist imq_klist; } *ipc_mqueue_t; @@ -132,6 +132,23 @@ typedef struct ipc_mqueue { #define imq_held(mq) waitq_held(&(mq)->imq_wait_queue) #define imq_valid(mq) waitq_valid(&(mq)->imq_wait_queue) +/* + * Get an ipc_mqueue pointer from a waitq pointer. These are traditionally the + * same pointer, but this conversion makes no assumptions on union structure + * member positions - it should allow the waitq to move around in either the + * port-set mqueue or the port mqueue independently. + */ +#define imq_from_waitq(waitq) (waitq_is_set(waitq) ? \ + ((struct ipc_mqueue *)((void *)( \ + (uintptr_t)(waitq) - \ + __offsetof(struct ipc_mqueue, imq_wait_queue)) \ + )) : \ + ((struct ipc_mqueue *)((void *)( \ + (uintptr_t)(waitq) - \ + __offsetof(struct ipc_mqueue, imq_set_queue)) \ + )) \ + ) + extern void imq_reserve_and_lock(ipc_mqueue_t mq, uint64_t *reserved_prepost);