| 160 | } |
| 161 | |
| 162 | int aeCreateFileEvent(aeEventLoop *eventLoop, int fd, int mask, |
| 163 | aeFileProc *proc, void *clientData) |
| 164 | { |
| 165 | if (fd >= eventLoop->setsize) { |
| 166 | errno = ERANGE; |
| 167 | return AE_ERR; |
| 168 | } |
| 169 | aeFileEvent *fe = &eventLoop->events[fd]; |
| 170 | |
| 171 | if (aeApiAddEvent(eventLoop, fd, mask) == -1) |
| 172 | return AE_ERR; |
| 173 | fe->mask |= mask; |
| 174 | if (mask & AE_READABLE) fe->rfileProc = proc; |
| 175 | if (mask & AE_WRITABLE) fe->wfileProc = proc; |
| 176 | fe->clientData = clientData; |
| 177 | if (fd > eventLoop->maxfd) |
| 178 | eventLoop->maxfd = fd; |
| 179 | return AE_OK; |
| 180 | } |
| 181 | |
| 182 | void aeDeleteFileEvent(aeEventLoop *eventLoop, int fd, int mask) |
| 183 | { |
no test coverage detected