@@ -30,51 +30,44 @@ type type_of_udata = intptr_t;
30
30
#[ cfg( any( target_os = "netbsd" , target_os = "openbsd" ) ) ]
31
31
type type_of_data = libc:: int64_t ;
32
32
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
+ }
63
39
}
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
+ #[ derive( Clone , Copy , Debug , PartialEq ) ]
44
+ pub enum EventFilter {
45
+ EVFILT_AIO ,
46
+ #[ cfg( target_os = "dragonfly" ) ]
47
+ EVFILT_EXCEPT ,
48
+ #[ cfg( any( target_os = "dragonfly" ,
49
+ target_os = "freebsd" ,
50
+ target_os = "ios" ,
51
+ target_os = "macos" ) ) ]
52
+ EVFILT_FS ,
53
+ #[ cfg( target_os = "freebsd" ) ]
54
+ EVFILT_LIO ,
55
+ #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
56
+ EVFILT_MACHPORT ,
57
+ EVFILT_PROC ,
58
+ EVFILT_READ ,
59
+ EVFILT_SIGNAL ,
60
+ EVFILT_TIMER ,
61
+ #[ cfg( any( target_os = "dragonfly" ,
62
+ target_os = "freebsd" ,
63
+ target_os = "ios" ,
64
+ target_os = "macos" ) ) ]
65
+ EVFILT_USER ,
66
+ #[ cfg( any( target_os = "ios" , target_os = "macos" ) ) ]
67
+ EVFILT_VM ,
68
+ EVFILT_VNODE ,
69
+ EVFILT_WRITE ,
70
+ }
78
71
}
79
72
80
73
#[ cfg( any( target_os = "dragonfly" , target_os = "freebsd" ,
0 commit comments