Applied, thanks! Manolo de Medici, le mar. 01 déc. 2026 00:26:45 +0000, a ecrit: > Move the three helpers into <hurd/ports.h> as ports_-prefixed extern > inlines so MiG servers can use the installed header. Make the private > header delegate to them and switch console, devnode, libmachdev, and > proc to the public declarations. > --- > console/mutations.h | 8 +++---- > devnode/mig-mutate.h | 10 ++++----- > libmachdev/mig-mutate.h | 8 +++---- > libports/mig-decls.h | 7 +++--- > libports/ports.h | 47 ++++++++++++++++++++++++++++++++--------- > proc/mig-mutate.h | 8 +++---- > 6 files changed, 57 insertions(+), 31 deletions(-) > > diff --git a/console/mutations.h b/console/mutations.h > index 87906ccd..49a4fc9f 100644 > --- a/console/mutations.h > +++ b/console/mutations.h > @@ -27,10 +27,10 @@ > #define TIOCTL_IMPORTS import "libnetfs/priv.h"; > > #define NOTIFY_INTRAN \ > - port_info_t begin_using_port_info_port (mach_port_t) > + port_info_t ports_begin_using_port_info_port (mach_port_t) > #define NOTIFY_INTRAN_PAYLOAD \ > - port_info_t begin_using_port_info_payload > + port_info_t ports_begin_using_port_info_payload > #define NOTIFY_DESTRUCTOR \ > - end_using_port_info (port_info_t) > + ports_end_using_port_info (port_info_t) > #define NOTIFY_IMPORTS \ > - import "libports/mig-decls.h"; > + import <hurd/ports.h>; > diff --git a/devnode/mig-mutate.h b/devnode/mig-mutate.h > index c2efa9c0..d60bf7d1 100644 > --- a/devnode/mig-mutate.h > +++ b/devnode/mig-mutate.h > @@ -19,12 +19,12 @@ > along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ > > #define NOTIFY_INTRAN \ > - port_info_t begin_using_port_info_port (mach_port_t) > + port_info_t ports_begin_using_port_info_port (mach_port_t) > #define NOTIFY_INTRAN_PAYLOAD \ > - port_info_t begin_using_port_info_payload > + port_info_t ports_begin_using_port_info_payload > #define NOTIFY_DESTRUCTOR \ > - end_using_port_info (port_info_t) > + ports_end_using_port_info (port_info_t) > #define NOTIFY_IMPORTS \ > - import "libports/mig-decls.h"; > + import <hurd/ports.h>; > #define DEVICE_IMPORTS \ > - import "libports/ports.h"; > + import <hurd/ports.h>; > diff --git a/libmachdev/mig-mutate.h b/libmachdev/mig-mutate.h > index 4ec0c7ab..960c37ca 100644 > --- a/libmachdev/mig-mutate.h > +++ b/libmachdev/mig-mutate.h > @@ -19,13 +19,13 @@ > along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ > > #define NOTIFY_INTRAN \ > - port_info_t begin_using_port_info_port (mach_port_t) > + port_info_t ports_begin_using_port_info_port (mach_port_t) > #define NOTIFY_INTRAN_PAYLOAD \ > - port_info_t begin_using_port_info_payload > + port_info_t ports_begin_using_port_info_payload > #define NOTIFY_DESTRUCTOR \ > - end_using_port_info (port_info_t) > + ports_end_using_port_info (port_info_t) > #define NOTIFY_IMPORTS \ > - import "libports/mig-decls.h"; > + import <hurd/ports.h>; > > #define DEVICE_INTRAN \ > mach_device_t begin_using_device_port (mach_port_t) > diff --git a/libports/mig-decls.h b/libports/mig-decls.h > index 4316e07c..99a46bfc 100644 > --- a/libports/mig-decls.h > +++ b/libports/mig-decls.h > @@ -27,20 +27,19 @@ > static inline struct port_info * __attribute__ ((unused)) > begin_using_port_info_port (mach_port_t port) > { > - return ports_lookup_port (0, port, 0); > + return ports_begin_using_port_info_port (port); > } > > static inline struct port_info * __attribute__ ((unused)) > begin_using_port_info_payload (uintptr_t payload) > { > - return ports_lookup_payload (0, payload, 0); > + return ports_begin_using_port_info_payload (payload); > } > > static inline void __attribute__ ((unused)) > end_using_port_info (struct port_info *p) > { > - if (p) > - ports_port_deref (p); > + ports_end_using_port_info (p); > } > > #endif /* __LIBPORTS_MIG_DECLS_H__ */ > diff --git a/libports/ports.h b/libports/ports.h > index b9466184..59a5c5a6 100644 > --- a/libports/ports.h > +++ b/libports/ports.h > @@ -265,6 +265,26 @@ extern void *ports_lookup_payload (struct port_bucket > *bucket, > structure. */ > extern mach_port_t ports_payload_get_name (uintptr_t payload); > > +/* Allocate another reference to PORT. */ > +void ports_port_ref (void *port); > + > +/* Allocate a weak reference to PORT. */ > +void ports_port_ref_weak (void *port); > + > +/* Drop a reference to PORT. */ > +void ports_port_deref (void *port); > + > +/* Drop a weak reference to PORT. */ > +void ports_port_deref_weak (void *port); > + > +/* MiG input translators that acquire a port reference without restricting > + the lookup to a particular bucket or class. */ > +extern struct port_info *ports_begin_using_port_info_port (mach_port_t port); > +extern struct port_info *ports_begin_using_port_info_payload (uintptr_t > payload); > + > +/* MiG destructor that drops the input translator's reference, if any. */ > +extern void ports_end_using_port_info (struct port_info *port); > + > #if (defined(__USE_EXTERN_INLINES) || defined(PORTS_DEFINE_EI)) && > !defined(__cplusplus) > > PORTS_EI void * > @@ -300,19 +320,26 @@ ports_payload_get_name (uintptr_t payload) > return MACH_PORT_NULL; > } > > -#endif /* Use extern inlines. */ > - > -/* Allocate another reference to PORT. */ > -void ports_port_ref (void *port); > +PORTS_EI struct port_info * > +ports_begin_using_port_info_port (mach_port_t port) > +{ > + return ports_lookup_port (0, port, 0); > +} > > -/* Allocate a weak reference to PORT. */ > -void ports_port_ref_weak (void *port); > +PORTS_EI struct port_info * > +ports_begin_using_port_info_payload (uintptr_t payload) > +{ > + return ports_lookup_payload (0, payload, 0); > +} > > -/* Drop a reference to PORT. */ > -void ports_port_deref (void *port); > +PORTS_EI void > +ports_end_using_port_info (struct port_info *port) > +{ > + if (port) > + ports_port_deref (port); > +} > > -/* Drop a weak reference to PORT. */ > -void ports_port_deref_weak (void *port); > +#endif /* Use extern inlines. */ > > /* Use this port right to request notifications about PORT. */ > #define ports_port_notify_right(port) \ > diff --git a/proc/mig-mutate.h b/proc/mig-mutate.h > index d7cfb4b7..ca5952f1 100644 > --- a/proc/mig-mutate.h > +++ b/proc/mig-mutate.h > @@ -29,10 +29,10 @@ > import "mig-decls.h"; > > #define TASK_NOTIFY_INTRAN \ > - port_info_t begin_using_port_info_port (mach_port_t) > + port_info_t ports_begin_using_port_info_port (mach_port_t) > #define TASK_NOTIFY_INTRAN_PAYLOAD \ > - port_info_t begin_using_port_info_payload > + port_info_t ports_begin_using_port_info_payload > #define TASK_NOTIFY_DESTRUCTOR \ > - end_using_port_info (port_info_t) > + ports_end_using_port_info (port_info_t) > #define TASK_NOTIFY_IMPORTS \ > - import "libports/mig-decls.h"; > + import <hurd/ports.h>; > -- > 2.55.0 > >
-- Samuel * B kicks DW (non mais franchement) * DW was kicked -+- #ens-mim - comment ça hopeless ? -+-
