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
0
votes
1 answer

porting epoll to libevent

I developed a server using epoll. It works fine under Linux. But I want to give macosx support using kqueue. I heard that libevent is a abstraction layer on top of these event based libraries(epoll, kqueue). How can i port this code using epoll to…
yet
  • 773
  • 11
  • 19
0
votes
1 answer

Am I using ioctl correctly?

I'm writing an http server in python3.3, just to learn how to do this sort of thing. In my function that parses a request, I want to use fcntl.ioctl to get the number of bytes that I can read in the socket, and I only do this when I see a kevent in…
Broseph
  • 1,655
  • 1
  • 18
  • 38
0
votes
1 answer

KQUEUE only works for folder path?

I am use the code (actually copy from hereFSEvents C++ Example)as following, but it can only work for a path, can not work for a file. I just want to monitor a specific file. How can I do that? thanks #include // for…
Jet
  • 129
  • 1
  • 8
0
votes
4 answers

What constitutes "readable" (kqueue/epoll)

I know that if the remote host gracefully shuts down a connection, epoll will report EPOLLIN, and calling read or recv will not block, and will return 0 bytes (i.e. end of stream). However, if the connection is not closed gracefully, and a write or…
0
votes
1 answer

File system watching in iOS

I have file tree in my Documents folder. What is the easiest way to watch all changes in Documents folder and in all its subfolders? I've already read about kqueue but it seems that it works only for folder itself(not for its subfolders).
Siarhei Fedartsou
  • 1,843
  • 6
  • 30
  • 44
0
votes
1 answer

Spawned process limit in MacOS X

I am running into an issue spawning a large number of processes (200) under MacOS X Mountain Lion (though I'm sure this issue is not version specific). What I am doing is launching processes (in my test it is /bin/cat) which have their STDIN,…
brettw
  • 10,664
  • 2
  • 42
  • 59
0
votes
1 answer

kevent.ident is unsigned integer while file descriptor is signed?

I have a kevent ev and a int sock = socket(...). When I did ev.ident == sock, the g++47 warned me that warning: comparison between signed and unsigned integer expressions [-Wsign-compare]. What's wrong in my approach??
GuLearn
  • 1,814
  • 2
  • 18
  • 32
0
votes
1 answer

KQueue wrapper for Cocoa

So I want to monitor a single file and as far as I can tell KQueue is the way to do it in Cocoa. I have a partially functioning FSEvents code running, but that monitors the whole folder. Can anyone recommend a good Cocoa wrapper that I might use to…
urbanrider
  • 231
  • 5
  • 14
-1
votes
1 answer

using EVFILT_READ at the same time as EVFILT_WRITE

i am writing a TCP client with kqueue. The events i would like to subscribe to are EVFILT_READ and EVFILT_WRITE. From freebsd, '''Combinations may be made by OR'ing the desired values. For instance, EV_ADD | EV_ENABLE | EV_ONESHOT would translate to…
user18043747
  • 1
  • 1
  • 4
1 2 3
8
9