CMake uses this library for some of its work, but it doesn't compile on
Linux kernels previous to 2.6.27 thanks to a missing epoll_create1 function
introduced in 2.6.26.
I can provide an update that would address this by using preprocessor
directives to test the kernel version and appropriately use epoll_create or
epoll_create1, but in testing, I still see five tests failing (within my
use case):
not ok 48 - fs_copyfile
# exit code 134
# Output from process `fs_copyfile`:
# Assertion failed in test/test-fs-copyfile.c on line 126: r == 0
not ok 63 - fs_event_watch_file_twice
# exit code 134
# Output from process `fs_event_watch_file_twice`:
# Assertion failed in test/test-fs-event.c on line 635: 0 ==
uv_fs_event_start(watchers + 0, fail_cb, path, 0)
not ok 91 - fs_readdir_file
# exit code 134
# Output from process `fs_readdir_file`:
# Assertion failed in test/test-fs-readdir.c on line 244: r == UV_ENOTDIR
not ok 98 - fs_scandir_file
# exit code 134
# Output from process `fs_scandir_file`:
# Assertion failed in test/test-fs.c on line 2541: r == UV_ENOTDIR
not ok 166 - pipe_connect_to_file
# exit code 134
# Output from process `pipe_connect_to_file`:
# Assertion failed in test/test-pipe-connect-error.c on line 53: status ==
UV_ENOTSOCK || status == UV_ECONNREFUSED
I strongly doubt the changes I made caused these failures, though. My
changes look like this:
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
/* epoll_create1 unavailable in these kernels */
#define NO_EPOLL_CREATE1
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
/* epoll_create ignores the size parameter in these kernels */
#define EPOLL_IGNORE_SIZE
#endif
(after the other #includes, followed by):
int uv__platform_loop_init(uv_loop_t* loop) {
int fd;
#ifndef NO_EPOLL_CREATE1
/* It was reported that EPOLL_CLOEXEC is not defined on Android API < 21,
* a.k.a. Lollipop. Since EPOLL_CLOEXEC is an alias for O_CLOEXEC on all
* architectures, we just use that instead.
*/
fd = epoll_create1(O_CLOEXEC);
#elif defined EPOLL_IGNORE_SIZE
fd = epoll_create(1);
#else
fd = -1;
errno = ENOSYS;
#endif
/* epoll_create1() can fail either because it's not implemented (old
kernel)
* or because it doesn't understand the O_CLOEXEC flag.
*/
if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
fd = epoll_create(256);
if (fd != -1)
uv__cloexec(fd, 1);
}
loop->backend_fd = fd;
loop->inotify_fd = -1;
loop->inotify_watchers = NULL;
if (fd == -1)
return UV__ERR(errno);
return 0;
}
I'm hesitant to submit this because of the failures, even though the tests
succeed in a normal use case (building for a current Linux OS with normal
toolkits).
Recommendations?
--
You received this message because you are subscribed to the Google Groups
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
To view this discussion on the web visit
https://groups.google.com/d/msgid/libuv/2248a119-d3c0-4774-8c4d-7a631bd7e2a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.