Samuel Thibault, le lun. 08 juin 2026 00:27:13 +0200, a ecrit: > I tried to think how select() could be taught to do this, but > to be able to wait on several fds at the same time, it will consume the > message anyway, since that's how it works for the io_select() protocol. > Another way could be to add along mach_msg() a variant that only waits > and does not dequeue anything. We'd however want a way to efficiently > express which port(s) have some message available.
Actually, hurdselect.c already uses a polling loop to check for remaining messages. One could just explicitly poll the mach-raw ports with MACH_RCV_LARGE and a zero size (we probably won't have many of them), then remove those mach-raw ports from the port set, and then perform the existing reception-poll loop. And we can make select() use the non-dequeueing mach_msg() variant only when at least one raw mach port is passed, so that in most cases we'd use the dequeueing variant, reducing the number of mach_msg() calls. Samuel
