build: fix build error with __ANDROID_API__ < 21
Fix the following undefined symbols error with __ANDROID_API__ < 21: - epoll_create1 - epoll_pwait - futimens
This commit is contained in:
parent
3bff0d3878
commit
e2c0f60c10
@ -216,7 +216,11 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
|
||||
ts[0].tv_nsec = (uint64_t)(req->atime * 1000000) % 1000000 * 1000;
|
||||
ts[1].tv_sec = req->mtime;
|
||||
ts[1].tv_nsec = (uint64_t)(req->mtime * 1000000) % 1000000 * 1000;
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
return utimensat(req->file, NULL, ts, 0);
|
||||
#else
|
||||
return futimens(req->file, ts);
|
||||
#endif
|
||||
#elif defined(__APPLE__) \
|
||||
|| defined(__DragonFly__) \
|
||||
|| defined(__FreeBSD__) \
|
||||
|
||||
@ -90,7 +90,12 @@ int uv__platform_loop_init(uv_loop_t* loop) {
|
||||
* a.k.a. Lollipop. Since EPOLL_CLOEXEC is an alias for O_CLOEXEC on all
|
||||
* architectures, we just use that instead.
|
||||
*/
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
fd = -1;
|
||||
errno = ENOSYS;
|
||||
#else
|
||||
fd = epoll_create1(O_CLOEXEC);
|
||||
#endif
|
||||
|
||||
/* epoll_create1() can fail either because it's not implemented (old kernel)
|
||||
* or because it doesn't understand the O_CLOEXEC flag.
|
||||
@ -288,11 +293,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
abort();
|
||||
|
||||
if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) {
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
nfds = -1;
|
||||
errno = ENOSYS;
|
||||
#else
|
||||
nfds = epoll_pwait(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
timeout,
|
||||
&sigset);
|
||||
#endif
|
||||
if (nfds == -1 && errno == ENOSYS)
|
||||
no_epoll_pwait = 1;
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user