Questions tagged [kevent]

The kevent function is a BSD system call, that is used to register for event notification and to wait, or poll, for ready events.

It has the functionality of select, poll and epoll. The function is able to register and notify of many kinds of events: file operations, sockets, processes, POSIX signals, pipes, timers, user defined events.

The kevent function can register for many events, and notify of all registered events, using one system call.

11 questions
4
votes
2 answers

TCP Server workers with kqueue

I recently did some testing with kernel events and I came up with the following: Does it make sense to use a kernel event for accepting sockets? My testing showed that I was only able to handle one accept at once (even if the eventlist array is…
Marco
  • 7,007
  • 2
  • 19
  • 49
3
votes
1 answer

How do "special" epoll flags correspond to kqueue ones?

I'm struggling to draw a parallel between epoll and kqueue flags, specifically EPOLLONESHOT EPOLLET EPOLLEXCLUSIVE and EV_CLEAR/EV_DISPATCH/EV_ONESHOT. I'm investigating the kqueue for the first time; I only had an experience with…
ghostmansd
  • 3,285
  • 5
  • 30
  • 44
1
vote
1 answer

Need an explanation on wording of `kevent` filter

I have following lines for kevent in the man: EVFILT_TIMER Establishes an arbitrary timer identified by ident. When adding a timer, data specifies the moment to fire the timer (for NOTE_ABSTIME) or…
user14063792468
  • 839
  • 12
  • 28
1
vote
1 answer

macOS Monitor new forked processes using kevents

I'm trying to monitor all newly created processes using Kevents by monitoring EVFILT_PROC using launchd pid, which is 1: struct kevent ke = { 0 }; const pid_t pid_of_launchd = 1; EV_SET(&ke, pid_of_launchd, EVFILT_PROC, EV_ENABLE | EV_ADD |…
Ted
  • 11
  • 1
1
vote
2 answers

Is there any way to execute a callback (on Linux) when a file descriptor is closed

I'm working on a kevent/kqueue emulation library for Linux. I'm a new maintainer on this project, and unfortunately, the previous maintainer is not involved much anymore (so I can't pick their brains about this). Under FreeBSD and macOS when you…
Arran Cudbard-Bell
  • 5,912
  • 2
  • 26
  • 48
1
vote
0 answers

Does kevent discard the changelist when interrupted by a signal?

When kevent returns EINTR, which is a likely occurrence because it does not support SA_RESTART behavior, has the changelist been applied or not? I get the impression it has, because signals generate EINTR only after the thread has gone to sleep,…
Potatoswatter
  • 134,909
  • 25
  • 265
  • 421
0
votes
0 answers

Does kevent do round robin among ready file descriptors like epoll when nevents is smaller than the number of ready file descriptors?

In the epoll_wait man page, we see the following in Notes: If more than maxevents file descriptors are ready when epoll_wait() is called, then successive epoll_wait() calls will round robin through the set of ready file descriptors. This behavior…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
0
votes
0 answers

EINTR and epoll_ctl, should I check errno?

I am looking through code for FreeBSD. The code uses kevent programming interface. Now, I find the lines like below: status = kevent(...) if(status < 0){ if(EINTR == errno){ goto l_kevent; } /* ... */ } I need to port the code for Linux, and I…
user14063792468
  • 839
  • 12
  • 28
0
votes
1 answer

libcurl async integration with kevent on macOS Sierra

I'm integrating curl into an asynchronous I/O event loop based on kqueue. libcurl has an excellent API for integrating into the applications event loop. You provide libcurl with two callbacks, one to set a timer (used to limit request/connect…
Arran Cudbard-Bell
  • 5,912
  • 2
  • 26
  • 48
0
votes
0 answers

kevent & USB serial ports

I'm having trouble using kevent on mac with a USB serial console. I've narrowed it down to: #include
0
votes
1 answer

Tornado + kevent on Mac OSX

I've recently run into issues running tornado on Mac OSX Yosemite. When making a request to the tornado server, I get the following traceback: ERROR:tornado.general:Uncaught exception Traceback (most recent call last): File…
Madison May
  • 2,723
  • 3
  • 22
  • 32