diff --git a/event.c b/event.c index 6bf5dde1..9e17ce0c 100644 --- a/event.c +++ b/event.c @@ -128,18 +128,49 @@ int event_queue_wait(int eq, int timeout, int *interesting_fd) { #endif #ifdef UWSGI_EVENT_FILEMONITOR_USE_KQUEUE -int event_queue_add_file_monitor(int eq, int fd) { +int event_queue_add_file_monitor(int eq, char *filename, int *id) { struct kevent kev; + + int fd = open(filename, O_RDONLY); + if (fd < 0) { + uwsgi_error("open()"); + return -1; + } EV_SET(&kev, fd, EVFILT_VNODE, EV_ADD|EV_CLEAR, NOTE_WRITE|NOTE_DELETE|NOTE_EXTEND|NOTE_ATTRIB|NOTE_RENAME|NOTE_REVOKE, 0, 0); if (kevent(eq, &kev, 1, NULL, 0, NULL) < 0) { uwsgi_error("kevent()"); return -1; } + + *id = fd; - return 0; + return fd; } + +struct uwsgi_fmon *event_queue_ack_file_monitor(int id, void hook(char *, uint32_t, char *)) { + + int i; + struct uwsgi_fmon *uf = NULL; + + for(i=0;ivalue, ut->id); + } + + return ut; + +} #endif diff --git a/master.c b/master.c index 1c85dc30..d290beba 100644 --- a/master.c +++ b/master.c @@ -195,13 +195,6 @@ void master_loop(char **argv, char **environ) { } #endif - // add a fake timer - - /* - int fake_timer = 0xFFFF; - event_queue_add_timer(master_queue, &fake_timer, 5); - */ - // add unregistered file monitors for(i=0;iHello World"