android: remove patch code for below 21
PR-URL: https://github.com/libuv/libuv/pull/2880 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
1c22b44380
commit
e50b631daf
@ -79,10 +79,6 @@ extern char** environ;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
# include <dlfcn.h> /* for dlsym */
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
@ -1142,13 +1138,6 @@ int uv__getpwuid_r(uv_passwd_t* pwd) {
|
||||
size_t shell_size;
|
||||
long initsize;
|
||||
int r;
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
int (*getpwuid_r)(uid_t, struct passwd*, char*, size_t, struct passwd**);
|
||||
|
||||
getpwuid_r = dlsym(RTLD_DEFAULT, "getpwuid_r");
|
||||
if (getpwuid_r == NULL)
|
||||
return UV_ENOSYS;
|
||||
#endif
|
||||
|
||||
if (pwd == NULL)
|
||||
return UV_EINVAL;
|
||||
|
||||
@ -229,11 +229,7 @@ static ssize_t uv__fs_futime(uv_fs_t* req) {
|
||||
struct timespec ts[2];
|
||||
ts[0] = uv__fs_to_timespec(req->atime);
|
||||
ts[1] = uv__fs_to_timespec(req->mtime);
|
||||
#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__) \
|
||||
|
||||
@ -85,17 +85,7 @@ static uint64_t read_cpufreq(unsigned int cpunum);
|
||||
|
||||
int uv__platform_loop_init(uv_loop_t* loop) {
|
||||
int fd;
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
#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.
|
||||
@ -293,16 +283,11 @@ 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 {
|
||||
|
||||
@ -709,11 +709,9 @@ int uv_cond_init(uv_cond_t* cond) {
|
||||
if (err)
|
||||
return UV__ERR(err);
|
||||
|
||||
#if !(defined(__ANDROID_API__) && __ANDROID_API__ < 21)
|
||||
err = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
|
||||
if (err)
|
||||
goto error2;
|
||||
#endif
|
||||
|
||||
err = pthread_cond_init(cond, &attr);
|
||||
if (err)
|
||||
@ -805,16 +803,7 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) {
|
||||
#endif
|
||||
ts.tv_sec = timeout / NANOSEC;
|
||||
ts.tv_nsec = timeout % NANOSEC;
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
|
||||
|
||||
/*
|
||||
* The bionic pthread implementation doesn't support CLOCK_MONOTONIC,
|
||||
* but has this alternative function instead.
|
||||
*/
|
||||
r = pthread_cond_timedwait_monotonic_np(cond, mutex, &ts);
|
||||
#else
|
||||
r = pthread_cond_timedwait(cond, mutex, &ts);
|
||||
#endif /* __ANDROID_API__ */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user