From 32ef58bf72a7c020f6907435ce9d7ca512772797 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Feb 2017 22:03:11 -0500 Subject: [PATCH] unix: factor out reusable no-fsevents impl On os390 we implement no support for fsevents. Other platforms may not support fsevents either, so provide a dedicated source file to use in this case. PR-URL: https://github.com/libuv/libuv/pull/1312 Reviewed-By: Ben Noordhuis Reviewed-By: Santiago Gimeno --- Makefile.am | 1 + src/unix/no-fsevents.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/unix/os390.c | 22 ---------------------- uv.gyp | 1 + 4 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 src/unix/no-fsevents.c diff --git a/Makefile.am b/Makefile.am index cbabbab4..81bffb87 100644 --- a/Makefile.am +++ b/Makefile.am @@ -425,6 +425,7 @@ libuv_la_CFLAGS += -D_UNIX03_THREADS \ libuv_la_LDFLAGS += -qXPLINK libuv_la_SOURCES += src/unix/pthread-fixes.c \ src/unix/pthread-barrier.c \ + src/unix/no-fsevents.c \ src/unix/os390.c \ src/unix/os390-syscalls.c \ src/unix/proctitle.c diff --git a/src/unix/no-fsevents.c b/src/unix/no-fsevents.c new file mode 100644 index 00000000..38fb6ab0 --- /dev/null +++ b/src/unix/no-fsevents.c @@ -0,0 +1,42 @@ +/* Copyright libuv project contributors. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "uv.h" +#include "internal.h" + +#include + +int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { + return -ENOSYS; +} + +int uv_fs_event_start(uv_fs_event_t* handle, uv_fs_event_cb cb, + const char* filename, unsigned int flags) { + return -ENOSYS; +} + +int uv_fs_event_stop(uv_fs_event_t* handle) { + return -ENOSYS; +} + +void uv__fs_event_close(uv_fs_event_t* handle) { + UNREACHABLE(); +} diff --git a/src/unix/os390.c b/src/unix/os390.c index e9ba90c6..2ba5abf3 100644 --- a/src/unix/os390.c +++ b/src/unix/os390.c @@ -663,28 +663,6 @@ int uv__io_check_fd(uv_loop_t* loop, int fd) { return 0; } - -void uv__fs_event_close(uv_fs_event_t* handle) { - UNREACHABLE(); -} - - -int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) { - return -ENOSYS; -} - - -int uv_fs_event_start(uv_fs_event_t* handle, uv_fs_event_cb cb, - const char* filename, unsigned int flags) { - return -ENOSYS; -} - - -int uv_fs_event_stop(uv_fs_event_t* handle) { - return -ENOSYS; -} - - void uv__io_poll(uv_loop_t* loop, int timeout) { static const int max_safe_timeout = 1789569; struct epoll_event events[1024]; diff --git a/uv.gyp b/uv.gyp index 77312200..8c368638 100644 --- a/uv.gyp +++ b/uv.gyp @@ -317,6 +317,7 @@ 'sources': [ 'src/unix/pthread-fixes.c', 'src/unix/pthread-barrier.c', + 'src/unix/no-fsevents.c', 'src/unix/os390.c', 'src/unix/os390-syscalls.c' ]