Skip to content

Commit

Permalink
disable signal and oob on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAlphaFox committed Jan 31, 2024
1 parent dd9e92b commit 685701a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/kqueue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ module Null = struct
let useconds = `Not_implemented
let nseconds = `Not_implemented
let lowat = `Not_implemented
[%%ifndef FREEBSD]
let oob = `Not_implemented
[%%endif]
let delete = `Not_implemented
let write = `Not_implemented
let extend = `Not_implemented
Expand All @@ -39,7 +41,9 @@ module Null = struct
let exit = `Not_implemented
let fork = `Not_implemented
let exec = `Not_implemented
[%%ifndef FREEBSD]
let signal = `Not_implemented
[%%endif]

[%%if defined EVFILT_USER_AVAILABLE]

Expand Down Expand Up @@ -169,10 +173,11 @@ module Note = struct

let lowat = lowat ()

[%%ifndef FREEBSD]
external oob : unit -> int = "kqueue_note_oob"

let oob = oob ()

[%%endif]
external delete : unit -> int = "kqueue_note_delete"

let delete = delete ()
Expand Down Expand Up @@ -212,11 +217,11 @@ module Note = struct
external exec : unit -> int = "kqueue_note_exec"

let exec = exec ()

[%%ifndef FREEBSD]
external signal : unit -> int = "kqueue_note_signal"

let signal = signal ()

[%%endif]
[%%if defined EVFILT_USER_AVAILABLE]

external ffnop : unit -> int = "kqueue_note_ffnop"
Expand Down
4 changes: 4 additions & 0 deletions lib/kqueue_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ module type S = sig
val useconds : t
val nseconds : t
val lowat : t
[%%ifndef FREEBSD]
val oob : t
[%%endif]
val delete : t
val write : t
val extend : t
Expand All @@ -50,7 +52,9 @@ module type S = sig
val exit : t
val fork : t
val exec : t
[%%ifndef FREEBSD]
val signal : t
[%%endif]

[%%if defined EVFILT_USER_AVAILABLE]

Expand Down
4 changes: 4 additions & 0 deletions lib/kqueue_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@
Kqueue_constant(kqueue_note_useconds, NOTE_USECONDS)
Kqueue_constant(kqueue_note_nseconds, NOTE_NSECONDS)
Kqueue_constant(kqueue_note_lowat, NOTE_LOWAT)
#ifndef __FreeBSD__
Kqueue_constant(kqueue_note_oob, NOTE_OOB)
#endif
Kqueue_constant(kqueue_note_delete, NOTE_DELETE)
Kqueue_constant(kqueue_note_write, NOTE_WRITE)
Kqueue_constant(kqueue_note_extend, NOTE_EXTEND)
Expand All @@ -138,7 +140,9 @@
Kqueue_constant(kqueue_note_exit, NOTE_EXIT)
Kqueue_constant(kqueue_note_fork, NOTE_FORK)
Kqueue_constant(kqueue_note_exec, NOTE_EXEC)
#ifndef __FreeBSD__
Kqueue_constant(kqueue_note_signal, NOTE_SIGNAL)
#endif
#else
typedef int dummy_definition;
#endif

0 comments on commit 685701a

Please sign in to comment.