[libdispatch-dev] [PATCH] use libkqueue if sys/event.h is missing
jocke at tbricks.com
Wed Nov 18 08:28:23 PST 2009
On 17 nov 2009, at 06.41, Mark Heily wrote:
Joakim Johansson wrote:
>> Of course, I'd like to disable this check on Solaris completely, as the
>> current plan is to use native event ports rather than libkqueue, but that
>> is for a later patch.
> I do plan to add Solaris event port support to libkqueue once the Linux backend is complete and the internal API is stabilized.
That sounds great, I would be happy to try to help out if there is anything I can do to get libkqueue working on Solaris 10 as well.
> I checked the port_create(3C) manpage in Solaris 10 and OpenSolaris, and did not see any way to wait for signals like in EVFILT_SIGNAL. There is no equivalent to EVFILT_PROC that allows you to receive events when a child process calls exit(2). There is also no equivalent to EVFILT_VNODE in Solaris 10, although OpenSolaris has added the PORT_SOURCE_FILE functionality.
You are right, although there might be some good news here;
I've had some discussion offline with one of the Solaris engineers who is on the list who added the PORT_SOURCE_FILE feature - Prakash Sangappa - they (Sun) are interested in getting libdispatch running well on Solaris, and are looking at extending the available types of port events required for supporting libdispatch more natively with event ports (e.g. adding support for signals/process monitoring etc.). Potentially also the pthread_workqueue support.
So with some luck, we'll get proper kernel/OS support for a high-performance implementation also on Solaris.
> On the other hand, the event port interface is very similar to kqueue(2) and kevent(2) so it should be very easy to emulate these system calls under Solaris. I have already started work on a generic POSIX backend for libkqueue to fill in the gaps when the host kernel does not support a particular event source. The Linux backend already falls back to using this generic POSIX backend to emulate the EVFILT_PROC filter, since there is no event-based alternative to the wait(2) family of system calls on Linux.
That would make a lot of sense on Solaris as well, especially if additional port events are added to opensolaris - then falling back on a POSIX backend for Solaris 10, but using native event port notifications on opensolaris would be a nice approach (until hopefully we can see such support folded back into Solaris 10, as Sun does with other major features over time). Some more nice autoconf stuff needed here to make it robust as available facilities change over time :-)
More information about the libdispatch-dev