* commit '790e7c0ac46bca5ad511ba8764bbb0e9646c6f2a': Switch adb to epoll(2).
This commit is contained in:
commit
4f3ebaec16
1 changed files with 4 additions and 21 deletions
|
|
@ -93,8 +93,7 @@ static fdevent list_pending = {
|
||||||
static fdevent **fd_table = 0;
|
static fdevent **fd_table = 0;
|
||||||
static int fd_table_max = 0;
|
static int fd_table_max = 0;
|
||||||
|
|
||||||
#ifdef CRAPTASTIC
|
#ifdef __linux__
|
||||||
//HAVE_EPOLL
|
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
|
||||||
|
|
@ -102,32 +101,16 @@ static int epoll_fd = -1;
|
||||||
|
|
||||||
static void fdevent_init()
|
static void fdevent_init()
|
||||||
{
|
{
|
||||||
/* XXX: what's a good size for the passed in hint? */
|
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||||
epoll_fd = epoll_create(256);
|
if(epoll_fd == -1) {
|
||||||
|
|
||||||
if(epoll_fd < 0) {
|
|
||||||
perror("epoll_create() failed");
|
perror("epoll_create() failed");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mark for close-on-exec */
|
|
||||||
fcntl(epoll_fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fdevent_connect(fdevent *fde)
|
static void fdevent_connect(fdevent *fde)
|
||||||
{
|
{
|
||||||
struct epoll_event ev;
|
// Nothing to do here. fdevent_update will handle the EPOLL_CTL_ADD.
|
||||||
|
|
||||||
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)
|
static void fdevent_disconnect(fdevent *fde)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue