tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kqueue

On Mon, Jan 18, 2010 at 07:20:44PM +0000, Sad Clouds wrote:
> Linux man page for epoll talks about "edge" or "level" triggered
> behavior. How does kqueue behave in this regard?

Events are aggregated, e.g. if you ask about file changes, you get at
most one event for all such changes since the event was consumed the
last time. Events can be registered as one-shot, in which case the
filter will be removed after it has been triggered.

> 1. Listening socket. Assume the backlog is 5 connections waiting to be 
> accepted. kevent returns on this socket and the process calls accept() 3 
> times. If process now calls kevent, then does it block waiting for 6th 
> connection to arrive, or does kevent return indicating backlog of 2?

kevent will provide only a single read event in this case.

> 2. Connected sockets. Does kevent return when any new data arrives into the 
> socket buffer, or does it always return, provided socket buffer has more than 
> SO_RCVLOWAT bytes of data?

This is documented in kevent(2).


Home | Main Index | Thread Index | Old Index