Luca Dariz, le dim. 03 avril 2022 16:59:54 +0200, a ecrit: > * 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 <l...@orpolo.org>
Applied, thanks! > --- > include/mach/mach_port.defs | 6 ++---- > include/mach/port.h | 36 +++++++++++++++++------------------- > include/mach/std_types.defs | 6 ++---- > kern/thread.c | 4 ++-- > kern/thread.h | 4 ++-- > 5 files changed, 25 insertions(+), 31 deletions(-) > > diff --git a/include/mach/mach_port.defs b/include/mach/mach_port.defs > index c21c34bc..7cb8a659 100644 > --- a/include/mach/mach_port.defs > +++ b/include/mach/mach_port.defs > @@ -53,8 +53,7 @@ subsystem > routine mach_port_names( > task : ipc_space_t; > out names : mach_port_name_array_t = > - ^array[] of mach_port_name_t > - ctype: mach_port_array_t; > + ^array[] of mach_port_name_t; > out types : mach_port_type_array_t = > ^array[] of mach_port_type_t); > > @@ -209,8 +208,7 @@ routine mach_port_get_set_status( > task : ipc_space_t; > name : mach_port_name_t; > out members : mach_port_name_array_t = > - ^array[] of mach_port_name_t > - ctype: mach_port_array_t); > + ^array[] of mach_port_name_t); > > /* > * Puts the member port (the task must have receive rights) > diff --git a/include/mach/port.h b/include/mach/port.h > index e77e5c38..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 */ > @@ -135,22 +151,4 @@ typedef struct mach_port_status { > #define MACH_PORT_QLIMIT_DEFAULT ((mach_port_msgcount_t) 5) > #define MACH_PORT_QLIMIT_MAX ((mach_port_msgcount_t) 16) > > -/* > - * Compatibility definitions, for code written > - * before there was an mps_seqno field. > - * > - * XXX: Remove this before releasing Gnumach 1.6. > - */ > - > -typedef struct old_mach_port_status { > - mach_port_t mps_pset; /* containing port set */ > -/*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? */ > -} old_mach_port_status_t; > - > #endif /* _MACH_PORT_H_ */ > diff --git a/include/mach/std_types.defs b/include/mach/std_types.defs > index 5d95ab42..46987380 100644 > --- a/include/mach/std_types.defs > +++ b/include/mach/std_types.defs > @@ -58,10 +58,8 @@ type mach_port_t = MACH_MSG_TYPE_COPY_SEND > ; > type mach_port_array_t = array[] of mach_port_t; > > -type mach_port_name_t = MACH_MSG_TYPE_PORT_NAME > - ctype: mach_port_t; > -type mach_port_name_array_t = array[] of mach_port_name_t > - ctype: mach_port_array_t; > +type mach_port_name_t = MACH_MSG_TYPE_PORT_NAME; > +type mach_port_name_array_t = array[] of mach_port_name_t; > > type mach_port_right_t = natural_t; > > diff --git a/kern/thread.c b/kern/thread.c > index 0e3cc2c9..82863b38 100644 > --- a/kern/thread.c > +++ b/kern/thread.c > @@ -861,8 +861,8 @@ kern_return_t thread_terminate( > kern_return_t thread_terminate_release( > thread_t thread, > task_t task, > - mach_port_t thread_name, > - mach_port_t reply_port, > + mach_port_name_t thread_name, > + mach_port_name_t reply_port, > vm_offset_t address, > vm_size_t size) > { > diff --git a/kern/thread.h b/kern/thread.h > index f0ed71a8..ddf4e1da 100644 > --- a/kern/thread.h > +++ b/kern/thread.h > @@ -280,8 +280,8 @@ extern kern_return_t thread_terminate( > extern kern_return_t thread_terminate_release( > thread_t thread, > task_t task, > - mach_port_t thread_name, > - mach_port_t reply_port, > + mach_port_name_t thread_name, > + mach_port_name_t reply_port, > vm_offset_t address, > vm_size_t size); > extern kern_return_t thread_suspend( > -- > 2.30.2 > > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.