Nice work! Re: EXPERIMENTAL: tevent_kqueue support

Simo idra at
Wed Mar 6 13:02:32 MST 2013

On 03/06/2013 02:57 PM, Jeremy Allison wrote:
> On Wed, Mar 06, 2013 at 10:47:05AM -0500, Ira Cooper wrote:
>> On Wed, Mar 6, 2013 at 10:18 AM, Stefan (metze) Metzmacher <metze at>
>>       Solaris/illumos has /dev/poll, correct?
>>       I haven't looked into details, but that should provide the same
>>       features
>>       as poll(),
>>       which means the kernel reports POLLIN and POLLOUT together.
>> In re-reading the doc, for port_associate, I think you are right.  It'll do
>> that.  But it will only give 1 event per fd.
>> 3c.html#scrolltoc
> We should be able to build a tevent backend on top of port_create()/
> port_associate()/port_getn() and friends.
> The only tricky bit I see is re-adding the fd events that have
> fired back (as port_getn() "helpfully" removes them once they've
> triggered :-).
> Same for kqueue I think.

Shouldn't be too difficult you just need an inner wrapping for 
tevent_fd_add and friends so that the callbacks goes first through an 
internal callback that readds the fd once the event has been dealt with 
by the 'real' callback and unless it has been modified by the callback 
of course.

event fires
   \-> internal callback
       | \-> real callback
       \--re-add event


More information about the samba-technical mailing list