Ticket #7242: 0002-FFI-wrapper-for-kevent.patch

File 0002-FFI-wrapper-for-kevent.patch, 1.8 KB (added by iquiw, 3 years ago)

Patch to use kevent FFI wrapper (remove period from commit log)

  • GHC/Event/KQueue.hsc

    From ce7ce3d15d3553258c1f709641b814bb5ee92ca8 Mon Sep 17 00:00:00 2001
    From: Iku Iwasa <[email protected]>
    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 foreign import ccall safe "kevent64" 
    305305    c_kevent64 :: QueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt -> CUInt 
    306306               -> Ptr TimeSpec -> IO CInt 
    307307#elif defined(HAVE_KEVENT) 
    308 foreign import ccall safe "kevent" 
     308foreign import ccall safe "__hscore_kevent" 
    309309    c_kevent :: QueueFd -> Ptr Event -> CInt -> Ptr Event -> CInt 
    310310             -> Ptr TimeSpec -> IO CInt 
    311311#else 
  • include/HsBase.h

    diff --git a/include/HsBase.h b/include/HsBase.h
    index 74ab816..99efde5 100644
    a b extern HsWord64 getMonotonicUSec(void); 
    155155#include <sys/select.h> 
    156156#endif 
    157157 
     158#if HAVE_SYS_EVENT_H 
     159#include <sys/event.h> 
     160#endif 
     161 
    158162/* in inputReady.c */ 
    159163extern int fdReady(int fd, int write, int msecs, int isSock); 
    160164 
    INLINE int __hscore_open(char *file, int how, mode_t mode) { 
    541545} 
    542546#endif 
    543547 
     548#ifdef HAVE_KEVENT 
     549INLINE 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 
    544557#if darwin_HOST_OS 
    545558// You should not access _environ directly on Darwin in a bundle/shared library. 
    546559// See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html