diff options
Diffstat (limited to 'src/ot_event.c')
| -rw-r--r-- | src/ot_event.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ot_event.c b/src/ot_event.c index 6062f70..cc575f6 100644 --- a/src/ot_event.c +++ b/src/ot_event.c | |||
| @@ -143,7 +143,7 @@ void event_deinit(void) { | |||
| 143 | back untouched. */ | 143 | back untouched. */ |
| 144 | static int event_change(int fd, int what, uint32_t generation, int deleting) { | 144 | static int event_change(int fd, int what, uint32_t generation, int deleting) { |
| 145 | struct kevent change[2], result[2]; | 145 | struct kevent change[2], result[2]; |
| 146 | void *udata = (void *)(uintptr_t)(((uint64_t)generation << 32) | (uint32_t)fd); | 146 | void *udata = (void *)(uintptr_t)generation; |
| 147 | int succeeded = 0, count, i; | 147 | int succeeded = 0, count, i; |
| 148 | 148 | ||
| 149 | EV_SET(&change[0], (uintptr_t)fd, EVFILT_READ, | 149 | EV_SET(&change[0], (uintptr_t)fd, EVFILT_READ, |
| @@ -206,11 +206,10 @@ int event_wait(ot_event *out, int max, int timeout_ms) { | |||
| 206 | if ((count = kevent(g_kqueue, NULL, 0, g_ready, max, deadline)) == -1) | 206 | if ((count = kevent(g_kqueue, NULL, 0, g_ready, max, deadline)) == -1) |
| 207 | return errno == EINTR ? 0 : -1; | 207 | return errno == EINTR ? 0 : -1; |
| 208 | for (i = 0; i < count; ++i) { | 208 | for (i = 0; i < count; ++i) { |
| 209 | uint64_t udata = (uint64_t)(uintptr_t)g_ready[i].udata; | 209 | int eof = (g_ready[i].flags & (EV_EOF | EV_ERROR)) != 0; |
| 210 | int eof = (g_ready[i].flags & (EV_EOF | EV_ERROR)) != 0; | ||
| 211 | 210 | ||
| 212 | out[i].fd = (int)(uint32_t)udata; | 211 | out[i].fd = (int)g_ready[i].ident; |
| 213 | out[i].generation = (uint32_t)(udata >> 32); | 212 | out[i].generation = (uint32_t)(uintptr_t)g_ready[i].udata; |
| 214 | out[i].what = ((g_ready[i].filter == EVFILT_READ || eof) ? EVENT_IN : 0) | | 213 | out[i].what = ((g_ready[i].filter == EVFILT_READ || eof) ? EVENT_IN : 0) | |
| 215 | ((g_ready[i].filter == EVFILT_WRITE || eof) ? EVENT_OUT : 0); | 214 | ((g_ready[i].filter == EVFILT_WRITE || eof) ? EVENT_OUT : 0); |
| 216 | } | 215 | } |
