diff options
author | Elliott Hughes <enh@google.com> | 2014-09-22 11:29:01 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-09-23 10:40:51 -0700 |
commit | 67de1557b0aa53b07a96d24734f165238f7415b3 (patch) | |
tree | 525cad4f297348fad1db2af68c958a980f38219e /adb | |
parent | 810814d09b7e4da9744fc5991ee49b9d8e7c9755 (diff) | |
download | system_core-67de1557b0aa53b07a96d24734f165238f7415b3.zip system_core-67de1557b0aa53b07a96d24734f165238f7415b3.tar.gz system_core-67de1557b0aa53b07a96d24734f165238f7415b3.tar.bz2 |
Switch adb to epoll(2).
Bug: 17588403
Change-Id: I2590f5e7dd4e178ff4f743609c5ef0155b1015a1
Diffstat (limited to 'adb')
-rw-r--r-- | adb/fdevent.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/adb/fdevent.c b/adb/fdevent.c index 5c374a7..b627817 100644 --- a/adb/fdevent.c +++ b/adb/fdevent.c @@ -102,8 +102,7 @@ static fdevent list_pending = { static fdevent **fd_table = 0; static int fd_table_max = 0; -#ifdef CRAPTASTIC -//HAVE_EPOLL +#ifdef __linux__ #include <sys/epoll.h> @@ -111,32 +110,16 @@ static int epoll_fd = -1; static void fdevent_init() { - /* XXX: what's a good size for the passed in hint? */ - epoll_fd = epoll_create(256); - - if(epoll_fd < 0) { + epoll_fd = epoll_create1(EPOLL_CLOEXEC); + if(epoll_fd == -1) { perror("epoll_create() failed"); exit(1); } - - /* mark for close-on-exec */ - fcntl(epoll_fd, F_SETFD, FD_CLOEXEC); } static void fdevent_connect(fdevent *fde) { - 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 + // Nothing to do here. fdevent_update will handle the EPOLL_CTL_ADD. } static void fdevent_disconnect(fdevent *fde) |