| 37 | } aeApiState; |
| 38 | |
| 39 | static int aeApiCreate(aeEventLoop *eventLoop) { |
| 40 | aeApiState *state = zmalloc(sizeof(aeApiState)); |
| 41 | |
| 42 | if (!state) return -1; |
| 43 | state->events = zmalloc(sizeof(struct epoll_event)*eventLoop->setsize); |
| 44 | if (!state->events) { |
| 45 | zfree(state); |
| 46 | return -1; |
| 47 | } |
| 48 | state->epfd = epoll_create(1024); /* 1024 is just a hint for the kernel */ |
| 49 | if (state->epfd == -1) { |
| 50 | zfree(state->events); |
| 51 | zfree(state); |
| 52 | return -1; |
| 53 | } |
| 54 | anetCloexec(state->epfd); |
| 55 | eventLoop->apidata = state; |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | static int aeApiResize(aeEventLoop *eventLoop, int setsize) { |
| 60 | aeApiState *state = eventLoop->apidata; |
no test coverage detected