diff options
author | Dan Albert <danalbert@google.com> | 2014-09-25 22:32:26 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-25 22:32:26 +0000 |
commit | 0df62a7e1511667043ced8f57b2dab072fb88dd5 (patch) | |
tree | 84b2c274a8dac306b6a9499a02396e9a6b13cb46 /adb | |
parent | ecd1d94f14585aceaf86d257f12719b3e6552522 (diff) | |
parent | 8e1e54154bc7a5e9dee206735474186c2276b111 (diff) | |
download | system_core-0df62a7e1511667043ced8f57b2dab072fb88dd5.zip system_core-0df62a7e1511667043ced8f57b2dab072fb88dd5.tar.gz system_core-0df62a7e1511667043ced8f57b2dab072fb88dd5.tar.bz2 |
am 8e1e5415: am 5b4a1767: Merge "Revert "Switch adb to epoll(2).""
* commit '8e1e54154bc7a5e9dee206735474186c2276b111':
Revert "Switch adb to epoll(2)."
Diffstat (limited to 'adb')
-rw-r--r-- | adb/fdevent.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/adb/fdevent.c b/adb/fdevent.c index 57c9c15..43e600c 100644 --- a/adb/fdevent.c +++ b/adb/fdevent.c @@ -93,7 +93,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> @@ -101,16 +102,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) |