X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..7ddcb079202367355dddccdfa4318e57d50318be:/osfmk/mach/port.h diff --git a/osfmk/mach/port.h b/osfmk/mach/port.h index ff3360297..b09673aba 100644 --- a/osfmk/mach/port.h +++ b/osfmk/mach/port.h @@ -140,13 +140,21 @@ struct ipc_port ; typedef struct ipc_port *ipc_port_t; -#define IPC_PORT_NULL ((ipc_port_t) 0) -#define IPC_PORT_DEAD ((ipc_port_t)~0) +#define IPC_PORT_NULL ((ipc_port_t) 0UL) +#define IPC_PORT_DEAD ((ipc_port_t)~0UL) #define IPC_PORT_VALID(port) \ ((port) != IPC_PORT_NULL && (port) != IPC_PORT_DEAD) typedef ipc_port_t mach_port_t; +/* + * Since the 32-bit and 64-bit representations of ~0 are different, + * explicitly handle MACH_PORT_DEAD + */ + +#define CAST_MACH_PORT_TO_NAME(x) ((mach_port_name_t)(uintptr_t)(x)) +#define CAST_MACH_NAME_TO_PORT(x) ((x) == MACH_PORT_DEAD ? (mach_port_t)IPC_PORT_DEAD : (mach_port_t)(uintptr_t)(x)) + #else /* KERNEL */ /* @@ -269,7 +277,9 @@ typedef mach_port_type_t *mach_port_type_array_t; /* Dummy type bits that mach_port_type/mach_port_names can return. */ -#define MACH_PORT_TYPE_DNREQUEST 0x80000000 +#define MACH_PORT_TYPE_DNREQUEST 0x80000000 +#define MACH_PORT_TYPE_SPREQUEST 0x40000000 +#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000 /* User-references for capabilities. */ @@ -308,6 +318,7 @@ typedef struct mach_port_status { #define MACH_PORT_QLIMIT_BASIC ((mach_port_msgcount_t) 5) #define MACH_PORT_QLIMIT_SMALL ((mach_port_msgcount_t) 16) #define MACH_PORT_QLIMIT_LARGE ((mach_port_msgcount_t) 1024) +#define MACH_PORT_QLIMIT_KERNEL ((mach_port_msgcount_t) 65536) #define MACH_PORT_QLIMIT_MIN MACH_PORT_QLIMIT_ZERO #define MACH_PORT_QLIMIT_DEFAULT MACH_PORT_QLIMIT_BASIC #define MACH_PORT_QLIMIT_MAX MACH_PORT_QLIMIT_LARGE