aboutsummaryrefslogtreecommitdiff
path: root/include/mach/port.h
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2022-04-03 16:59:54 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-27 22:15:07 +0200
commite2f1d502a5a5ab6a8885cc518ed254c79f7ab27c (patch)
tree9349c4ad183944b5430c0134f3f611b9112c7f02 /include/mach/port.h
parent499f154bf12fe15c6aa1740100e4545a71490be1 (diff)
downloadgnumach-e2f1d502a5a5ab6a8885cc518ed254c79f7ab27c.tar.gz
gnumach-e2f1d502a5a5ab6a8885cc518ed254c79f7ab27c.tar.bz2
gnumach-e2f1d502a5a5ab6a8885cc518ed254c79f7ab27c.zip
add port name types
* include/mach/mach_port.defs - use C type mach_port_name_array_t * include/mach/port.h: - add new types mach_port_name_t and mach_port_name_array_t - refine mach_port_t type for user and kernel space - use port names in mach_port_status to allow compilation of 64-bit - use port name to have uniform sizes and remove the old_mach_port_status_t as it's unused * include/mach/std_types.defs - use C type mach_port_name_array_t * kern/thread.{h,c} - fix prototype to use port names. So far it seems the only rpc to cause a conflict between the mig-generated header and the regular header, so compilation fails. Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20220403145955.120742-2-luca@orpolo.org>
Diffstat (limited to 'include/mach/port.h')
-rw-r--r--include/mach/port.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/mach/port.h b/include/mach/port.h
index 7ab3ab7c..3c226f6c 100644
--- a/include/mach/port.h
+++ b/include/mach/port.h
@@ -38,8 +38,24 @@
#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;
+/*
+ * 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;
@@ -121,7 +137,7 @@ 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 */