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

Commit

Permalink
linux: try inotify_init if inotify_init1 returns ENOSYS
Browse files Browse the repository at this point in the history
The kernel may be older than the kernel headers that libuv is compiled against.
  • Loading branch information
bnoordhuis committed Mar 15, 2012
1 parent db413f3 commit 1b6df97
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/unix/linux/inotify.c
Expand Up @@ -156,11 +156,16 @@ static void uv__inotify_read(EV_P_ ev_io* w, int revents);


static int new_inotify_fd(void) {
#if HAVE_INOTIFY_INIT1
return inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
#else
int fd;

#if HAVE_INOTIFY_INIT1
fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (fd != -1)
return fd;
if (errno != ENOSYS)
return -1;
#endif

if ((fd = inotify_init()) == -1)
return -1;

Expand All @@ -170,7 +175,6 @@ static int new_inotify_fd(void) {
}

return fd;
#endif
}


Expand Down

0 comments on commit 1b6df97

Please sign in to comment.