diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2021-08-05 16:47:08 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-08-10 22:12:09 +0200 |
commit | cbe5af61970052429388737de19dbc7ad03ffa96 (patch) | |
tree | 6593266852426d9aa6306414044d902e16b8a230 /libports/ports.h | |
parent | 8db6b70ab6a64ea9b0ac313f2816131a046fbd76 (diff) | |
download | hurd-cbe5af61970052429388737de19dbc7ad03ffa96.tar.gz hurd-cbe5af61970052429388737de19dbc7ad03ffa96.tar.bz2 hurd-cbe5af61970052429388737de19dbc7ad03ffa96.zip |
libports: Create a notify_port in each bucket
This notify port will be used to request & receive Mach notifications.
While it is present in the bucket much like any other port, it is not
counted in ports_count_bucket () and is not exposed to the user
callback in ports_bucket_iterate ().
Diffstat (limited to 'libports/ports.h')
-rw-r--r-- | libports/ports.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libports/ports.h b/libports/ports.h index 7295093d..f8ce9b6c 100644 --- a/libports/ports.h +++ b/libports/ports.h @@ -80,6 +80,8 @@ struct port_bucket int flags; int count; struct ports_threadpool threadpool; + /* A port in this bucket used to receive Mach notifications. */ + struct port_info *notify_port; }; /* FLAGS above are the following: */ #define PORT_BUCKET_INHIBITED PORTS_INHIBITED @@ -309,6 +311,17 @@ void ports_port_deref (void *port); /* Drop a weak reference to PORT. */ void ports_port_deref_weak (void *port); +/* Use this port right to request notifications about PORT. */ +#define ports_port_notify_right(port) \ + ((struct port_info *) (port))->bucket->notify_port->port_right + +/* Is PORT the notify port for its bucket? */ +#define ports_port_is_notify(port) \ + ({ \ + struct port_info *__pi = (port); \ + __pi ? (__pi->bucket->notify_port == __pi) : 0; \ + }) + /* The user is responsible for listening for no senders notifications; when one arrives, call this routine for the PORT the message was sent to, providing the MSCOUNT from the notification. */ |