summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-09-26 21:39:37 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-26 21:39:37 +0200
commitb94b25bce9597a672a5f39d2b17d66314e565e61 (patch)
tree85ce8911c868b9f55b4b153123d6f5472197d3e0
parentam 91c27888: am d83e4f15: support for version 2 of block image diffs (diff)
parentam 28ffde5e: Merge "Revert "Copy epoll(2) changes to minadb."" (diff)
downloadandroid_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar.gz
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar.bz2
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar.lz
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar.xz
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.tar.zst
android_bootable_recovery-b94b25bce9597a672a5f39d2b17d66314e565e61.zip
-rw-r--r--minadbd/fdevent.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/minadbd/fdevent.c b/minadbd/fdevent.c
index b62781753..5c374a71b 100644
--- a/minadbd/fdevent.c
+++ b/minadbd/fdevent.c
@@ -102,7 +102,8 @@ static fdevent list_pending = {
static fdevent **fd_table = 0;
static int fd_table_max = 0;
-#ifdef __linux__
+#ifdef CRAPTASTIC
+//HAVE_EPOLL
#include <sys/epoll.h>
@@ -110,16 +111,32 @@ static int epoll_fd = -1;
static void fdevent_init()
{
- epoll_fd = epoll_create1(EPOLL_CLOEXEC);
- if(epoll_fd == -1) {
+ /* XXX: what's a good size for the passed in hint? */
+ epoll_fd = epoll_create(256);
+
+ if(epoll_fd < 0) {
perror("epoll_create() failed");
exit(1);
}
+
+ /* mark for close-on-exec */
+ fcntl(epoll_fd, F_SETFD, FD_CLOEXEC);
}
static void fdevent_connect(fdevent *fde)
{
- // Nothing to do here. fdevent_update will handle the EPOLL_CTL_ADD.
+ struct epoll_event ev;
+
+ memset(&ev, 0, sizeof(ev));
+ ev.events = 0;
+ ev.data.ptr = fde;
+
+#if 0
+ if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
+ perror("epoll_ctl() failed\n");
+ exit(1);
+ }
+#endif
}
static void fdevent_disconnect(fdevent *fde)