Commit 4aa8bc19 authored by iquiw's avatar iquiw Committed by Simon Marlow
Browse files

Adapt to NetBSD's struct kevent

parent 0978d640
......@@ -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
......
......@@ -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
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment