Questions tagged [kqueue]

Kqueue is a scalable event notification interface introduced in FreeBSD 4.1,[1] also supported in NetBSD, OpenBSD, DragonflyBSD, and Mac OS X.

Kqueue provides efficient input and output event pipelines between the kernel and userland. Thus, it is possible to modify event filters as well as receive pending events while using only a single system call to kevent per main event loop iteration. This contrasts with older traditional polling system calls such as poll and select which are less efficient, especially when polling for events on a large number of file descriptors.

Kqueue does not only handle file descriptor events but is also used for various other notifications such as file modification monitoring, signals, asynchronous I/O events (AIO), child process state change monitoring and timers which support nanosecond resolution.

129 questions
5
votes
1 answer

Is there a kqueue()/kevent() equivalent to select()'s "errorfds" set?

I was porting some code from select() to kqueue() today, and I noticed that kevent() doesn't seem to have an analog for select()'s "exception-set" feature. That is to say, select()'s function-signature is: int select(int nfds, fd_set *restrict…
Jeremy Friesner
  • 70,199
  • 15
  • 131
  • 234
5
votes
1 answer

fs.watch via Node 0.5.9 on Mac OSX

I'm running the following on Node v0.5.9: var fs = require("fs"); fs.watch("/Users/username/testingFsWatcher/",function(event,file) { console.dir(arguments); }); I then do: cd /Users/username/testingFsWatcher/ >file1 --> { '0': 'rename', '1':…
Lite Byte
  • 689
  • 1
  • 6
  • 11
5
votes
1 answer

Is there a good objc library wrapper for File System Events/kqueue that handles recursive watching for me?

I want to write an OSX (Snow Leopard) app that receives notifications when files within a specific directory are changed, and I want access to the path of the specific file that was changed. I know I can do this using either File System Events or…
nfm
  • 19,689
  • 15
  • 60
  • 90
5
votes
2 answers

Where to declare sig_t signal for SIGPIPE

I'm currently using a kqueue to handle multiple Clients per Thread in a Serverprocess so I don't want the thread to be terminated when the Signal SIGPIPE appears, i would just like to remove the according socked id from the kqueue. So My question…
dhein
  • 6,431
  • 4
  • 42
  • 74
5
votes
2 answers

Kqueue returning both EVFILT_READ and EVFILT_WRITE but I installed separate (ident,filt) pairs

I'm running into an issue that I'm not sure if is expected behavior from kqueue or if it's something I'm doing wrong. I need to install separate events with kqueue for a single socket file descriptor. The separate events are one for…
gngrwzrd
  • 5,902
  • 4
  • 43
  • 56
4
votes
3 answers

Choosing a IPC solution for an event-driven application

I am currently working on a rather large single-threaded, event-based, application designed around epoll under Linux and comparable technologies under other platforms. Currently, whenever we wish two instances to communicate, they typically do it…
Yoric
  • 3,348
  • 3
  • 19
  • 26
4
votes
1 answer

Kqueue (edge-triggered): Does a short read mean that read-readiness was lost?

When working with Linux epoll in edge triggered mode (EPOLLET), and a read/write fails with EAGAIN/EWOULDBLOCK, it means that read/write-readiness was lost, and that a new readiness event is guaranteed to be made available via epoll_wait() as soon…
Kristian Spangsege
  • 2,903
  • 1
  • 20
  • 43
4
votes
2 answers

Are there any major performance differences between epoll and kqueue?

My development machine is a MacBook (which of course has kqueue). However, in production we're running Linux (which of course uses epoll). Obviously, to know the performance characteristics of my code I need to run it using epoll. That said, is…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
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
4
votes
2 answers

kQueue directory monitoring

I have a kQueue observer on the Documents directory in my app. I am using the kQueue that triggers a callback when the Documents directory contents changes. here are two of the settings eventToAdd.flags = EV_ADD | EV_CLEAR; eventToAdd.fflags =…
some_id
  • 29,466
  • 62
  • 182
  • 304
4
votes
1 answer

kevent NOTE_DELETE is send when I modify my file

I try to use kqeue and kevent on a file and when my file is modified i will update my software . And when my file is Deleted i delete the link in my software . So i init kqueue void myfct(char * path) { int kq; int event_fd; struct kevent…
kavaliero
  • 389
  • 1
  • 4
  • 22
3
votes
2 answers

How to get folder changes notifications(folder watcher) in cocoa

I am new to Cocoa Application development. I want my application to be notified when any file under a given directory is modified(folder watcher). Modified means deleted, added, content of file is changed. I tried using FSEvents also with using…
Amrinder Singh
  • 205
  • 6
  • 16
3
votes
0 answers

Mac OS X How do I programatically detect if a changed file is still being 'used' by the same process that changed it?

I'm investigating a problem with a utility we've developed. We track a file or a directory and when a change has been made we upload the new version to a central repository. Our utility is similar to dropbox in that you can track changes, but its…
atlasalive
  • 31
  • 1
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
3
votes
1 answer

kqueue on iphone?

I am porting a linux server to ios. It is a single threaded, event driven design that uses kqueue on OSX to handle sockets and other events. Is there something similar on ios? Thanks!
Jacko
  • 12,665
  • 18
  • 75
  • 126
1
2
3
8 9