Never use epoll_create1; fixes trac #5005
authorIan Lynagh <igloo@earth.li>
Sat, 12 Mar 2011 21:14:26 +0000 (21:14 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 12 Mar 2011 21:14:26 +0000 (21:14 +0000)
There is little benefit to using epoll_create1 (especially if we still
have the epoll_create code too), and it cuases problems if people build
a GHC binary on one machine and try to use it on another.

System/Event/EPoll.hsc
configure.ac

index b2311c8..f30c4bd 100644 (file)
@@ -51,9 +51,7 @@ import GHC.Num (Num(..))
 import GHC.Real (ceiling, fromIntegral)
 import GHC.Show (Show)
 import System.Posix.Internals (c_close)
-#if !defined(HAVE_EPOLL_CREATE1)
 import System.Posix.Internals (setCloseOnExec)
-#endif
 import System.Posix.Types (Fd(..))
 
 import qualified System.Event.Array    as A
@@ -163,12 +161,8 @@ newtype EventType = EventType {
 epollCreate :: IO EPollFd
 epollCreate = do
   fd <- throwErrnoIfMinus1 "epollCreate" $
-#if defined(HAVE_EPOLL_CREATE1)
-        c_epoll_create1 (#const EPOLL_CLOEXEC)
-#else
         c_epoll_create 256 -- argument is ignored
   setCloseOnExec fd
-#endif
   let !epollFd' = EPollFd fd
   return epollFd'
 
@@ -200,13 +194,8 @@ fromTimeout :: Timeout -> Int
 fromTimeout Forever     = -1
 fromTimeout (Timeout s) = ceiling $ 1000 * s
 
-#if defined(HAVE_EPOLL_CREATE1)
-foreign import ccall unsafe "sys/epoll.h epoll_create1"
-    c_epoll_create1 :: CInt -> IO CInt
-#else
 foreign import ccall unsafe "sys/epoll.h epoll_create"
     c_epoll_create :: CInt -> IO CInt
-#endif
 
 foreign import ccall unsafe "sys/epoll.h epoll_ctl"
     c_epoll_ctl :: CInt -> CInt -> CInt -> Ptr Event -> IO CInt
index c79c531..dd6c5c6 100644 (file)
@@ -32,7 +32,7 @@ AC_CHECK_FUNCS([lstat])
 AC_CHECK_FUNCS([getclock getrusage times])
 AC_CHECK_FUNCS([_chsize ftruncate])
 
-AC_CHECK_FUNCS([epoll_create1 epoll_ctl eventfd kevent kevent64 kqueue poll])
+AC_CHECK_FUNCS([epoll_ctl eventfd kevent kevent64 kqueue poll])
 
 # event-related fun