Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
unix: don't conditionally compile kqueue fs watcher
Always compile in the kqueue-based fs event watcher and handle it at run-time
if the kernel doesn't actually support it.

Works around build issues when -mmacosx-version-min is not set properly.

Fixes nodejs/node-v0.x-archive#3075.
  • Loading branch information
bnoordhuis committed Apr 10, 2012
1 parent 8e6f332 commit 3c41597
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/uv-private/uv-unix.h
Expand Up @@ -222,7 +222,7 @@ typedef void* uv_lib_t;
ev_io read_watcher; \
uv_fs_event_cb cb;

#elif (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) \
#elif defined(__APPLE__) \
|| defined(__FreeBSD__) \
|| defined(__OpenBSD__) \
|| defined(__NetBSD__)
Expand Down
24 changes: 24 additions & 0 deletions src/unix/ev/ev_kqueue.c
Expand Up @@ -43,6 +43,30 @@
#include <string.h>
#include <errno.h>

/* These are the same on OS X and the BSDs. */
#ifndef NOTE_DELETE
# define NOTE_DELETE 0x01
#endif
#ifndef NOTE_WRITE
# define NOTE_WRITE 0x02
#endif
#ifndef NOTE_EXTEND
# define NOTE_EXTEND 0x04
#endif
#ifndef NOTE_ATTRIB
# define NOTE_ATTRIB 0x08
#endif
#ifndef NOTE_LINK
# define NOTE_LINK 0x10
#endif
#ifndef NOTE_RENAME
# define NOTE_RENAME 0x20
#endif
#ifndef NOTE_REVOKE
# define NOTE_REVOKE 0x40
#endif


extern void
uv__kqueue_hack (EV_P_ int fflags, ev_io *w);

Expand Down
2 changes: 1 addition & 1 deletion src/unix/internal.h
Expand Up @@ -57,7 +57,7 @@
#endif

/* FIXME exact copy of the #ifdef guard in uv-unix.h */
#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) \
#if defined(__APPLE__) \
|| defined(__FreeBSD__) \
|| defined(__OpenBSD__) \
|| defined(__NetBSD__)
Expand Down
27 changes: 0 additions & 27 deletions src/unix/kqueue.c
Expand Up @@ -26,8 +26,6 @@
#include <string.h>
#include <errno.h>

#if HAVE_KQUEUE

#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/event.h>
Expand Down Expand Up @@ -127,28 +125,3 @@ void uv__fs_event_close(uv_fs_event_t* handle) {
close(handle->fd);
handle->fd = -1;
}

#else /* !HAVE_KQUEUE */

int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb,
int flags) {
loop->counters.fs_event_init++;
uv__set_sys_error(loop, ENOSYS);
return -1;
}


void uv__fs_event_close(uv_fs_event_t* handle) {
UNREACHABLE();
}


/* Called by libev, don't touch. */
void uv__kqueue_hack(EV_P_ int fflags, ev_io *w) {
UNREACHABLE();
}

#endif /* HAVE_KQUEUE */

0 comments on commit 3c41597

Please sign in to comment.