
22 Feb
2013
22 Feb
'13
9:42 p.m.
Hello, I'm now looking into a bug of the poll backend. base/GHC/Event/Poll.hsc declares FFI to poll() as follows: foreign import ccall safe "poll.h poll" c_poll :: Ptr PollFd -> CULong -> CInt -> IO CInt The second argument is defined unsigned long on Linux. However, it is unsigned int on Mac and FreeBSD. I think this is a source of the bug which I'm looking into. A simple fix is like this: #if defined(freebsd_HOST_OS) || defined(darwin_HOST_OS) foreign import ccall safe "poll.h poll" c_poll :: Ptr PollFd -> CUInt -> CInt -> IO CInt #else foreign import ccall safe "poll.h poll" c_poll :: Ptr PollFd -> CULong -> CInt -> IO CInt #endif But this is not generic enough. Any suggestions to fix this? --Kazu