Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/1bc8270f086ee634e6f399272accc934495ad350

>---------------------------------------------------------------

commit 1bc8270f086ee634e6f399272accc934495ad350
Author: Iku Iwasa <[email protected]>
Date:   Sun Sep 16 16:36:25 2012 +0900

    Adapt to NetBSD's struct kevent

>---------------------------------------------------------------

 GHC/Event/KQueue.hsc     |   14 ++++++++++++++
 configure.ac             |    6 ++++++
 include/EventConfig.h.in |    6 ++++++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
index 68aade3..230785a 100644
--- a/GHC/Event/KQueue.hsc
+++ b/GHC/Event/KQueue.hsc
@@ -50,6 +50,8 @@ import qualified GHC.Event.Array as A
 #if defined(HAVE_KEVENT64)
 import Data.Int (Int64)
 import Data.Word (Word64)
+#elif defined(netbsd_HOST_OS)
+import Data.Int (Int64)
 #endif
 
 #include <sys/types.h>
@@ -172,7 +174,11 @@ data Event = KEvent {
     , filter :: {-# UNPACK #-} !Filter
     , flags  :: {-# UNPACK #-} !Flag
     , fflags :: {-# UNPACK #-} !FFlag
+#ifdef netbsd_HOST_OS
+    , data_  :: {-# UNPACK #-} !Int64
+#else
     , data_  :: {-# UNPACK #-} !CIntPtr
+#endif
     , udata  :: {-# UNPACK #-} !(Ptr ())
     } deriving Show
 
@@ -210,7 +216,11 @@ newtype FFlag = FFlag Word32
  , noteEOF = NOTE_EOF
  }
 
+#if SIZEOF_KEV_FLAGS == 4 /* kevent.flag: uint32_t or uint16_t. */
+newtype Flag = Flag Word32
+#else
 newtype Flag = Flag Word16
+#endif
     deriving (Eq, Show, Storable)
 
 #{enum Flag, Flag
@@ -218,7 +228,11 @@ newtype Flag = Flag Word16
  , flagDelete  = EV_DELETE
  }
 
+#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: uint32_t or uint16_t. */
+newtype Filter = Filter Word32
+#else
 newtype Filter = Filter Word16
+#endif
     deriving (Bits, Eq, Num, Show, Storable)
 
 #{enum Filter, Filter
diff --git a/configure.ac b/configure.ac
index 0ce53b7..b679520 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,12 @@ fi
 
 if test "$ac_cv_header_sys_event_h" = yes -a "$ac_cv_func_kqueue" = yes; then
   AC_DEFINE([HAVE_KQUEUE], [1], [Define if you have kqueue support.])
+
+  AC_CHECK_SIZEOF([kev.filter], [], [#include <sys/event.h>
+struct kevent kev;])
+
+  AC_CHECK_SIZEOF([kev.flags], [], [#include <sys/event.h>
+struct kevent kev;])
 fi
 
 if test "$ac_cv_header_poll_h" = yes -a "$ac_cv_func_poll" = yes; then
diff --git a/include/EventConfig.h.in b/include/EventConfig.h.in
index 032ceb1..061b6ac 100644
--- a/include/EventConfig.h.in
+++ b/include/EventConfig.h.in
@@ -83,3 +83,9 @@
 
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
+
+/* The size of `kev.filter', as computed by sizeof. */
+#undef SIZEOF_KEV_FILTER
+
+/* The size of `kev.flags', as computed by sizeof. */
+#undef SIZEOF_KEV_FLAGS



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to