|
Revision ba815f017780c3a855c8afda37cd204684d1ed70, 1.0 kB
(checked in by D.J. Capelis <dev@…>, 22 months ago)
|
|
Fixing what I believe is the first of several small problems within the
epoll() -> kqueue() compatibility code
|
-
Property mode set to
100644
|
| Line | |
|---|
| 1 | /**************************************************************************** |
|---|
| 2 | * epoll() interface around kevent() for BSD-like systems with kqueue() |
|---|
| 3 | * |
|---|
| 4 | * So far compatibility goes as far as I need it to and not much further. |
|---|
| 5 | * Performance may very well be unfortunate. |
|---|
| 6 | * |
|---|
| 7 | * Copyright D.J. Capelis 2009 |
|---|
| 8 | ***************************************************************************/ |
|---|
| 9 | |
|---|
| 10 | #ifndef __linux__ |
|---|
| 11 | #include<sys/event.h> |
|---|
| 12 | |
|---|
| 13 | #ifndef _EPOLL_H_ //TODO: use standard epoll header decl |
|---|
| 14 | #define _EPOLL_H_ |
|---|
| 15 | |
|---|
| 16 | #define EPOLL_CTL_ADD EV_ADD |
|---|
| 17 | #define EPOLL_CTL_MOD EV_ADD |
|---|
| 18 | #define EPOLL_CTL_DEL EV_DELETE |
|---|
| 19 | |
|---|
| 20 | #define EPOLLIN EVFILT_READ |
|---|
| 21 | #define EPOLLOUT EVFILT_WRITE |
|---|
| 22 | |
|---|
| 23 | typedef union epoll_data |
|---|
| 24 | { |
|---|
| 25 | void * ptr; |
|---|
| 26 | int fd; |
|---|
| 27 | __uint32_t u32; |
|---|
| 28 | __uint64_t u64; |
|---|
| 29 | } epoll_data_t; |
|---|
| 30 | |
|---|
| 31 | struct epoll_event |
|---|
| 32 | { |
|---|
| 33 | int events; |
|---|
| 34 | epoll_data_t data; |
|---|
| 35 | }; |
|---|
| 36 | |
|---|
| 37 | int epoll_create(int size); |
|---|
| 38 | int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event); |
|---|
| 39 | int epoll_wait(int epfd, struct epoll_event * events, int maxevents, int timeout); |
|---|
| 40 | |
|---|
| 41 | #endif |
|---|
| 42 | #else |
|---|
| 43 | #include<sys/epoll.h> |
|---|
| 44 | #endif |
|---|