From ce7ce3d15d3553258c1f709641b814bb5ee92ca8 Mon Sep 17 00:00:00 2001
From: Iku Iwasa <iku.iwasa@gmail.com>
Date: Sun, 16 Sep 2012 16:36:52 +0900
Subject: [PATCH 2/2] FFI wrapper for kevent()
---
GHC/Event/KQueue.hsc | 2 +-
include/HsBase.h | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
index 230785a..23e988c 100644
|
a
|
b
|
|
| 305 | 305 | c_kevent64 :: QueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt -> CUInt |
| 306 | 306 | -> Ptr TimeSpec -> IO CInt |
| 307 | 307 | #elif defined(HAVE_KEVENT) |
| 308 | | foreign import ccall safe "kevent" |
| | 308 | foreign import ccall safe "__hscore_kevent" |
| 309 | 309 | c_kevent :: QueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt |
| 310 | 310 | -> Ptr TimeSpec -> IO CInt |
| 311 | 311 | #else |
diff --git a/include/HsBase.h b/include/HsBase.h
index 74ab816..99efde5 100644
|
a
|
b
|
|
| 155 | 155 | #include <sys/select.h> |
| 156 | 156 | #endif |
| 157 | 157 | |
| | 158 | #if HAVE_SYS_EVENT_H |
| | 159 | #include <sys/event.h> |
| | 160 | #endif |
| | 161 | |
| 158 | 162 | /* in inputReady.c */ |
| 159 | 163 | extern int fdReady(int fd, int write, int msecs, int isSock); |
| 160 | 164 | |
| … |
… |
|
| 541 | 545 | } |
| 542 | 546 | #endif |
| 543 | 547 | |
| | 548 | #ifdef HAVE_KEVENT |
| | 549 | INLINE int __hscore_kevent(int kq, const struct kevent *changelist, |
| | 550 | size_t nchanges, struct kevent *eventlist, |
| | 551 | size_t nevents, const struct timespec *timeout) { |
| | 552 | return kevent(kq, changelist, nchanges, eventlist, nevents, timeout); |
| | 553 | } |
| | 554 | #endif |
| | 555 | |
| | 556 | |
| 544 | 557 | #if darwin_HOST_OS |
| 545 | 558 | // You should not access _environ directly on Darwin in a bundle/shared library. |
| 546 | 559 | // See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html |