diff options
Diffstat (limited to 'include/mach/port.h')
-rw-r--r-- | include/mach/port.h | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/include/mach/port.h b/include/mach/port.h index 7ab3ab7c..c9bbcf17 100644 --- a/include/mach/port.h +++ b/include/mach/port.h @@ -38,8 +38,25 @@ #include <mach/boolean.h> #include <mach/machine/vm_types.h> +/* + * Port names are the type used by userspace, they are always 32-bit wide. + */ +typedef unsigned int mach_port_name_t; +typedef mach_port_name_t *mach_port_name_array_t; +typedef const mach_port_name_t *const_mach_port_name_array_t; +/* + * A port is represented + * - by a port name in userspace + * - by a pointer in kernel space + * While in userspace mach_port_name_t and mach_port_name are interchangable, + * in kernelspace they need to be different and appropriately converted. + */ +#ifdef KERNEL typedef vm_offset_t mach_port_t; +#else /* KERNEL */ +typedef mach_port_name_t mach_port_t; +#endif typedef mach_port_t *mach_port_array_t; typedef const mach_port_t *const_mach_port_array_t; typedef int *rpc_signature_info_t; @@ -53,11 +70,15 @@ typedef int *rpc_signature_info_t; * that a port right was present, but it died. */ -#define MACH_PORT_NULL ((mach_port_t) 0) +#define MACH_PORT_NULL 0 /* works with both user and kernel ports */ #define MACH_PORT_DEAD ((mach_port_t) ~0) +#define MACH_PORT_NAME_NULL ((mach_port_name_t) 0) +#define MACH_PORT_NAME_DEAD ((mach_port_name_t) ~0) -#define MACH_PORT_VALID(name) \ - (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD)) +#define MACH_PORT_VALID(port) \ + (((port) != MACH_PORT_NULL) && ((port) != MACH_PORT_DEAD)) +#define MACH_PORT_NAME_VALID(name) \ + (((name) != MACH_PORT_NAME_NULL) && ((name) != MACH_PORT_NAME_DEAD)) /* * These are the different rights a task may have. @@ -121,15 +142,15 @@ typedef unsigned int mach_port_msgcount_t; /* number of msgs */ typedef unsigned int mach_port_rights_t; /* number of rights */ typedef struct mach_port_status { - mach_port_t mps_pset; /* containing port set */ + mach_port_name_t mps_pset; /* containing port set */ mach_port_seqno_t mps_seqno; /* sequence number */ -/*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? */ + mach_port_mscount_t mps_mscount; /* make-send count */ + mach_port_msgcount_t mps_qlimit; /* queue limit */ + mach_port_msgcount_t mps_msgcount; /* number in the queue */ + mach_port_rights_t mps_sorights; /* how many send-once rights */ + boolean_t mps_srights; /* do send rights exist? */ + boolean_t mps_pdrequest; /* port-deleted requested? */ + boolean_t mps_nsrequest; /* no-senders requested? */ } mach_port_status_t; #define MACH_PORT_QLIMIT_DEFAULT ((mach_port_msgcount_t) 5) |