kqueue

How do I tell when a CUPS print jobs has been completed plus info about that job?

I need to know each time a Mac print job is created/completed, plus some information about that job (what was printed, pages, copies, etc). The best method I've come up with thus far is to use kqueue() on /var/spool/cups/ and then parse the c##### files as they're created, but I'm wondering if there's a better way. ...

Using kqueue to poll for exceptional conditions

I'm modifying an app in order to replace its use of select() with kqueue. select() allows one to poll for exceptional conditions: int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, <---- this thing here struct timeval *restrict timeout ); After reading the...

File-level filesystem change notification in Mac OS X

I want my code to be notified when any file under (either directly or indirectly) a given directory is modified. By "modified", I mead I want my code to be notified whenever a file's contents are altered, it's renamed, or it's deleted; or if a new file is added. For my application, there can be thousands of files. I looked as FSEvents...

revisiting "how do you use aio and epoll together"

following the discussion at http://stackoverflow.com/questions/1825621/how-do-you-use-aio-and-epoll-together-in-a-single-event-loop. There are in fact 2 "aio" APIs in linux. There's POSIX aio (the aio_* family of functions), included in glibc and libaio developed I believe by RedHat (?), the io_* family. The first one allows registrat...

serving large file using select, epoll or kqueue

Nginx uses epoll, or other multiplexing techniques(select) for its handling multiple clients, i.e it does not spawn a new thread for every request unlike apache. I tried to replicate the same in my own test program using select. I could accept connections from multiple client by creating a non-blocking socket and using select to decide ...

What is the optimal way to monitor changes in a directory with a kqueue()?

OK: I'm implementing File Sharing in an iPhone OS app, and of course this means filesystem monitoring. Yay! Basically, the OS copies and/or deletes from and to a directory I can access when the user manipulates files into my app's section in iTunes. Thus, I need to monitor the directory for changes presumably via an efficient mechanism ...

kqueue NOTE_EXIT doesn't work

Hi everybody. I am trying to use Apple's example of using kqueue but the callback is never called unless I start observing the kqueue after the process starts. But the lifetime of the process is short and i need the code to work if the process starts before or after I start observing it. ...

triggering kevent by force

Hi everyone, I'm using kqueue for socket synchronization in OS X. I can register an event of interest like the following: struct kevent change; EV_SET(&change, connected_socket, EVFILT_READ, EV_ADD, 0, NULL, NULL); kevent(k_queue_, &change, 1, NULL, 0, NULL); And the question is, is there a way to trigger this event by force so that ...

Use kqueue to determine hangup on the other side of the socket or exceptional state of the socket.

I've read man 2 kqueue but have not found out how I can get notified about a socket hangup or exceptional condition of the socket without registering it with EVFILT_READ or EVFILT_WRITE. Apart from this it is not fully clear how kqueue signals exceptional states of sockets altogether. Thanks for your answer in advance. ...

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 performance that I see under kqueue a decent approximation of what I'll see with epoll? Or...

Is there any way to emulate epoll_wait with kqueue/kevent?

I have a list of a bunch of file descriptors that I have created kevents for, and I'm trying to figure out if there's any way to get the number of them that are ready for read or write access. Is there any way to get a list of "ready" file descriptors, like what epoll_wait provides? ...