@@ -22,13 +22,12 @@ pub struct KEvent {
22
22
target_os = "dragonfly" , target_os = "macos" ,
23
23
target_os = "ios" ) ) ]
24
24
type type_of_udata = * mut libc:: 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" ) ) ]
28
27
type type_of_data = libc:: intptr_t ;
29
28
#[ cfg( any( target_os = "netbsd" ) ) ]
30
29
type type_of_udata = intptr_t ;
31
- #[ cfg( any( target_os = "netbsd" ) ) ]
30
+ #[ cfg( any( target_os = "netbsd" , target_os = "openbsd" ) ) ]
32
31
type type_of_data = libc:: int64_t ;
33
32
34
33
#[ cfg( not( target_os = "netbsd" ) ) ]
@@ -79,16 +78,25 @@ pub enum EventFilter {
79
78
}
80
79
81
80
#[ 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" ) ) ]
83
83
pub type type_of_event_flag = u16 ;
84
- #[ cfg( any( target_os = "netbsd" , target_os = "openbsd" ) ) ]
84
+ #[ cfg( any( target_os = "netbsd" ) ) ]
85
85
pub type type_of_event_flag = u32 ;
86
86
libc_bitflags ! {
87
87
pub flags EventFlag : type_of_event_flag {
88
88
EV_ADD ,
89
89
EV_CLEAR ,
90
90
EV_DELETE ,
91
91
EV_DISABLE ,
92
+ // No released version of OpenBSD supports EV_DISPATCH or EV_RECEIPT.
93
+ // These have been commited to the -current branch though and are
94
+ // expected to be part of the OpenBSD 6.2 release in Nov 2017.
95
+ // See: https://marc.info/?l=openbsd-tech&m=149621427511219&w=2
96
+ // https://github.com/rust-lang/libc/pull/613
97
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
98
+ target_os = "freebsd" , target_os = "dragonfly" ,
99
+ target_os = "netbsd" ) ) ]
92
100
EV_DISPATCH ,
93
101
#[ cfg( target_os = "freebsd" ) ]
94
102
EV_DROP ,
@@ -105,7 +113,9 @@ libc_bitflags!{
105
113
EV_OOBAND ,
106
114
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
107
115
EV_POLL ,
108
- #[ cfg( not( target_os = "openbsd" ) ) ]
116
+ #[ cfg( any( target_os = "macos" , target_os = "ios" ,
117
+ target_os = "freebsd" , target_os = "dragonfly" ,
118
+ target_os = "netbsd" ) ) ]
109
119
EV_RECEIPT ,
110
120
EV_SYSFLAGS ,
111
121
}
@@ -315,13 +325,13 @@ fn test_struct_kevent() {
315
325
316
326
let expected = libc:: kevent { ident : 0xdeadbeef ,
317
327
filter : libc:: EVFILT_READ ,
318
- flags : libc:: EV_DISPATCH | libc:: EV_ADD ,
328
+ flags : libc:: EV_ONESHOT | libc:: EV_ADD ,
319
329
fflags : libc:: NOTE_CHILD | libc:: NOTE_EXIT ,
320
330
data : 0x1337 ,
321
331
udata : udata as type_of_udata } ;
322
332
let actual = KEvent :: new ( 0xdeadbeef ,
323
333
EventFilter :: EVFILT_READ ,
324
- EV_DISPATCH | EV_ADD ,
334
+ EV_ONESHOT | EV_ADD ,
325
335
NOTE_CHILD | NOTE_EXIT ,
326
336
0x1337 ,
327
337
udata) ;
0 commit comments