Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 790e7c0a authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files

am 3772545c: Merge "Switch adb to epoll(2)."

* commit '3772545c':
  Switch adb to epoll(2).
parents fbb4188c 3772545c
Loading
Loading
Loading
Loading
+4 −21
Original line number Diff line number Diff line
@@ -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)