summaryrefslogtreecommitdiff
path: root/devel/hs-kqueue/files/patch-src__System__KQueue.chs
blob: 6fb00591089512d7b206b8310925a3ca7768d4a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- src/System/KQueue.chs.orig	2016-05-30 14:31:11 UTC
+++ src/System/KQueue.chs
@@ -19,8 +19,10 @@ module System.KQueue
   , KQueueException
   ) where
 
+#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/event.h>
+#include "MachDeps.h"
 
 #if __GLASGOW_HASKELL__ <= 708
 import Control.Applicative ( (<$>), (<*>) )
@@ -57,6 +59,8 @@ import Foreign.C           ( CInt )
 import Foreign.C           ( CLong
                            , CTime
                            , CULong
+                           , CUInt
+                           , CLLong
                            )
 
 -- | A kernel event queue.
@@ -68,11 +72,23 @@ kqueue = KQueue <$> {#call kqueue as kqueue_ #}
 
 -- | A kernel event.
 data KEvent = KEvent
+#if SIZEOF_HSWORD == 4
+  { ident    :: CUInt   -- ^ The identifier for the event, often a file descriptor.
+#else
   { ident    :: CULong  -- ^ The identifier for the event, often a file descriptor.
+#endif
   , evfilter :: Filter  -- ^ The kernel filter (type of event).
   , flags    :: [Flag]  -- ^ Actions to perform on the event.
   , fflags   :: [FFlag] -- ^ Filter-specific flags.
+#if SIZEOF_HSWORD == 4
+#if __FreeBSD_version >= 1200033
+  , data_    :: CLLong  -- ^ Filter-specific data value.
+#else
+  , data_    :: CInt    -- ^ Filter-specific data value.
+#endif
+#else
   , data_    :: CLong   -- ^ Filter-specific data value.
+#endif
   , udata    :: Ptr ()  -- ^ User-defined data, passed through unchanged.
   } deriving (Show, Eq)
 
@@ -128,8 +144,10 @@ enum FFlag
   , NoteExit   = NOTE_EXIT
   , NoteFork   = NOTE_FORK
   , NoteExec   = NOTE_EXEC
+#ifndef __FreeBSD__
   , NoteSignal = NOTE_SIGNAL
 //  , NoteReap   = NOTE_REAP
+#endif
   };
 #endc