@@ -30,51 +30,43 @@ type type_of_udata = intptr_t;
3030#[ cfg( any( target_os = "netbsd" , target_os = "openbsd" ) ) ]
3131type type_of_data = libc:: int64_t ;
3232
33- #[ cfg( not( target_os = "netbsd" ) ) ]
34- type type_of_event_filter = i16 ;
35- #[ cfg( not( target_os = "netbsd" ) ) ]
36- #[ repr( i16 ) ]
37- #[ derive( Clone , Copy , Debug , PartialEq ) ]
38- pub enum EventFilter {
39- EVFILT_AIO = libc:: EVFILT_AIO ,
40- #[ cfg( target_os = "dragonfly" ) ]
41- EVFILT_EXCEPT = libc:: EVFILT_EXCEPT ,
42- #[ cfg( any( target_os = "macos" , target_os = "ios" ,
43- target_os = "dragonfly" ,
44- target_os = "freebsd" ) ) ]
45- EVFILT_FS = libc:: EVFILT_FS ,
46- #[ cfg( target_os = "freebsd" ) ]
47- EVFILT_LIO = libc:: EVFILT_LIO ,
48- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
49- EVFILT_MACHPORT = libc:: EVFILT_MACHPORT ,
50- EVFILT_PROC = libc:: EVFILT_PROC ,
51- EVFILT_READ = libc:: EVFILT_READ ,
52- EVFILT_SIGNAL = libc:: EVFILT_SIGNAL ,
53- EVFILT_TIMER = libc:: EVFILT_TIMER ,
54- #[ cfg( any( target_os = "macos" ,
55- target_os = "ios" ,
56- target_os = "dragonfly" ,
57- target_os = "freebsd" ) ) ]
58- EVFILT_USER = libc:: EVFILT_USER ,
59- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
60- EVFILT_VM = libc:: EVFILT_VM ,
61- EVFILT_VNODE = libc:: EVFILT_VNODE ,
62- EVFILT_WRITE = libc:: EVFILT_WRITE ,
33+ cfg_if ! {
34+ if #[ cfg( target_os = "netbsd" ) ] {
35+ type type_of_event_filter = u32 ;
36+ } else {
37+ type type_of_event_filter = i16 ;
38+ }
6339}
64-
65- #[ cfg( target_os = "netbsd" ) ]
66- type type_of_event_filter = libc:: uint32_t ;
67- #[ cfg( target_os = "netbsd" ) ]
68- #[ repr( i32 ) ]
69- #[ derive( Clone , Copy , Debug , PartialEq ) ]
70- pub enum EventFilter {
71- EVFILT_READ = libc:: EVFILT_READ ,
72- EVFILT_WRITE = libc:: EVFILT_WRITE ,
73- EVFILT_AIO = libc:: EVFILT_AIO ,
74- EVFILT_VNODE = libc:: EVFILT_VNODE ,
75- EVFILT_PROC = libc:: EVFILT_PROC ,
76- EVFILT_SIGNAL = libc:: EVFILT_SIGNAL ,
77- EVFILT_TIMER = libc:: EVFILT_TIMER ,
40+ libc_enum ! {
41+ #[ cfg_attr( target_os = "netbsd" , repr( u32 ) ) ]
42+ #[ cfg_attr( not( target_os = "netbsd" ) , repr( i16 ) ) ]
43+ pub enum EventFilter {
44+ EVFILT_AIO ,
45+ #[ cfg( target_os = "dragonfly" ) ]
46+ EVFILT_EXCEPT ,
47+ #[ cfg( any( target_os = "dragonfly" ,
48+ target_os = "freebsd" ,
49+ target_os = "ios" ,
50+ target_os = "macos" ) ) ]
51+ EVFILT_FS ,
52+ #[ cfg( target_os = "freebsd" ) ]
53+ EVFILT_LIO ,
54+ #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
55+ EVFILT_MACHPORT ,
56+ EVFILT_PROC ,
57+ EVFILT_READ ,
58+ EVFILT_SIGNAL ,
59+ EVFILT_TIMER ,
60+ #[ cfg( any( target_os = "dragonfly" ,
61+ target_os = "freebsd" ,
62+ target_os = "ios" ,
63+ target_os = "macos" ) ) ]
64+ EVFILT_USER ,
65+ #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
66+ EVFILT_VM ,
67+ EVFILT_VNODE ,
68+ EVFILT_WRITE ,
69+ }
7870}
7971
8072#[ cfg( any( target_os = "dragonfly" , target_os = "freebsd" ,
0 commit comments