Skip to content

Commit fc5f879

Browse files
committed
Add OpenBSD compatibility to events
1 parent f8406b8 commit fc5f879

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/sys/event.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ pub struct KEvent {
2222
target_os = "dragonfly", target_os = "macos",
2323
target_os = "ios"))]
2424
type type_of_udata = *mut ::c_void;
25-
#[cfg(any(target_os = "openbsd", target_os = "freebsd",
26-
target_os = "dragonfly", target_os = "macos",
27-
target_os = "ios"))]
25+
#[cfg(any(target_os = "freebsd", target_os = "dragonfly",
26+
target_os = "macos", target_os = "ios"))]
2827
type type_of_data = libc::intptr_t;
2928
#[cfg(any(target_os = "netbsd"))]
3029
type type_of_udata = intptr_t;
31-
#[cfg(any(target_os = "netbsd"))]
30+
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
3231
type type_of_data = libc::int64_t;
3332

3433
#[cfg(not(target_os = "netbsd"))]
@@ -79,16 +78,18 @@ pub enum EventFilter {
7978
}
8079

8180
#[cfg(any(target_os = "macos", target_os = "ios",
82-
target_os = "freebsd", target_os = "dragonfly"))]
81+
target_os = "freebsd", target_os = "dragonfly",
82+
target_os = "openbsd"))]
8383
pub type type_of_event_flag = u16;
84-
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
84+
#[cfg(any(target_os = "netbsd"))]
8585
pub type type_of_event_flag = u32;
8686
libc_bitflags!{
8787
pub flags EventFlag: type_of_event_flag {
8888
EV_ADD,
8989
EV_CLEAR,
9090
EV_DELETE,
9191
EV_DISABLE,
92+
#[cfg(not(target_os = "openbsd"))]
9293
EV_DISPATCH,
9394
#[cfg(target_os = "freebsd")]
9495
EV_DROP,
@@ -315,13 +316,13 @@ fn test_struct_kevent() {
315316

316317
let expected = libc::kevent{ident: 0xdeadbeef,
317318
filter: libc::EVFILT_READ,
318-
flags: libc::EV_DISPATCH | libc::EV_ADD,
319+
flags: libc::EV_ONESHOT | libc::EV_ADD,
319320
fflags: libc::NOTE_CHILD | libc::NOTE_EXIT,
320321
data: 0x1337,
321322
udata: udata as type_of_udata};
322323
let actual = KEvent::new(0xdeadbeef,
323324
EventFilter::EVFILT_READ,
324-
EV_DISPATCH | EV_ADD,
325+
EV_ONESHOT | EV_ADD,
325326
NOTE_CHILD | NOTE_EXIT,
326327
0x1337,
327328
udata);

0 commit comments

Comments
 (0)