Skip to content

Commit ef257e0

Browse files
author
Conrad Kramer
committed
Fix build on iOS platform
1 parent 954232c commit ef257e0

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

src/sys/event.rs

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ pub struct KEvent {
1919
}
2020

2121
#[cfg(any(target_os = "openbsd", target_os = "freebsd",
22-
target_os = "dragonfly", target_os = "macos"))]
22+
target_os = "dragonfly", target_os = "macos",
23+
target_os = "ios"))]
2324
type type_of_udata = *mut ::c_void;
2425
#[cfg(any(target_os = "netbsd"))]
2526
type type_of_udata = intptr_t;
@@ -33,23 +34,24 @@ pub enum EventFilter {
3334
EVFILT_AIO = libc::EVFILT_AIO,
3435
#[cfg(target_os = "dragonfly")]
3536
EVFILT_EXCEPT = libc::EVFILT_EXCEPT,
36-
#[cfg(any(target_os = "macos",
37+
#[cfg(any(target_os = "macos", target_os = "ios",
3738
target_os = "dragonfly",
3839
target_os = "freebsd"))]
3940
EVFILT_FS = libc::EVFILT_FS,
4041
#[cfg(target_os = "freebsd")]
4142
EVFILT_LIO = libc::EVFILT_LIO,
42-
#[cfg(target_os = "macos")]
43+
#[cfg(any(target_os = "macos", target_os = "ios"))]
4344
EVFILT_MACHPORT = libc::EVFILT_MACHPORT,
4445
EVFILT_PROC = libc::EVFILT_PROC,
4546
EVFILT_READ = libc::EVFILT_READ,
4647
EVFILT_SIGNAL = libc::EVFILT_SIGNAL,
4748
EVFILT_TIMER = libc::EVFILT_TIMER,
4849
#[cfg(any(target_os = "macos",
50+
target_os = "ios",
4951
target_os = "dragonfly",
5052
target_os = "freebsd"))]
5153
EVFILT_USER = libc::EVFILT_USER,
52-
#[cfg(target_os = "macos")]
54+
#[cfg(any(target_os = "macos", target_os = "ios"))]
5355
EVFILT_VM = libc::EVFILT_VM,
5456
EVFILT_VNODE = libc::EVFILT_VNODE,
5557
EVFILT_WRITE = libc::EVFILT_WRITE,
@@ -70,7 +72,8 @@ pub enum EventFilter {
7072
EVFILT_TIMER = libc::EVFILT_TIMER,
7173
}
7274

73-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly"))]
75+
#[cfg(any(target_os = "macos", target_os = "ios",
76+
target_os = "freebsd", target_os = "dragonfly"))]
7477
pub type type_of_event_flag = u16;
7578
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
7679
pub type type_of_event_flag = u32;
@@ -86,15 +89,15 @@ libc_bitflags!{
8689
EV_ENABLE,
8790
EV_EOF,
8891
EV_ERROR,
89-
#[cfg(target_os = "macos")]
92+
#[cfg(any(target_os = "macos", target_os = "ios"))]
9093
EV_FLAG0,
9194
EV_FLAG1,
9295
#[cfg(target_os = "dragonfly")]
9396
EV_NODATA,
9497
EV_ONESHOT,
95-
#[cfg(target_os = "macos")]
98+
#[cfg(any(target_os = "macos", target_os = "ios"))]
9699
EV_OOBAND,
97-
#[cfg(target_os = "macos")]
100+
#[cfg(any(target_os = "macos", target_os = "ios"))]
98101
EV_POLL,
99102
#[cfg(not(target_os = "openbsd"))]
100103
EV_RECEIPT,
@@ -104,7 +107,7 @@ libc_bitflags!{
104107

105108
bitflags!(
106109
flags FilterFlag: u32 {
107-
#[cfg(target_os = "macos")]
110+
#[cfg(any(target_os = "macos", target_os = "ios"))]
108111
const NOTE_ABSOLUTE = libc::NOTE_ABSOLUTE,
109112
const NOTE_ATTRIB = libc::NOTE_ATTRIB,
110113
const NOTE_CHILD = libc::NOTE_CHILD,
@@ -113,32 +116,38 @@ bitflags!(
113116
const NOTE_EOF = libc::NOTE_EOF,
114117
const NOTE_EXEC = libc::NOTE_EXEC,
115118
const NOTE_EXIT = libc::NOTE_EXIT,
116-
#[cfg(target_os = "macos")]
119+
#[cfg(any(target_os = "macos", target_os = "ios"))]
117120
const NOTE_EXIT_REPARENTED = libc::NOTE_EXIT_REPARENTED,
118-
#[cfg(target_os = "macos")]
121+
#[cfg(any(target_os = "macos", target_os = "ios"))]
119122
const NOTE_EXITSTATUS = libc::NOTE_EXITSTATUS,
120123
const NOTE_EXTEND = libc::NOTE_EXTEND,
121-
#[cfg(any(target_os = "macos",
124+
#[cfg(any(target_os = "macos",
125+
target_os = "ios",
122126
target_os = "freebsd",
123127
target_os = "dragonfly"))]
124128
const NOTE_FFAND = libc::NOTE_FFAND,
125129
#[cfg(any(target_os = "macos",
130+
target_os = "ios",
126131
target_os = "freebsd",
127132
target_os = "dragonfly"))]
128133
const NOTE_FFCOPY = libc::NOTE_FFCOPY,
129134
#[cfg(any(target_os = "macos",
135+
target_os = "ios",
130136
target_os = "freebsd",
131137
target_os = "dragonfly"))]
132138
const NOTE_FFCTRLMASK = libc::NOTE_FFCTRLMASK,
133139
#[cfg(any(target_os = "macos",
140+
target_os = "ios",
134141
target_os = "freebsd",
135142
target_os = "dragonfly"))]
136143
const NOTE_FFLAGSMASK = libc::NOTE_FFLAGSMASK,
137144
#[cfg(any(target_os = "macos",
145+
target_os = "ios",
138146
target_os = "freebsd",
139147
target_os = "dragonfly"))]
140148
const NOTE_FFNOP = libc::NOTE_FFNOP,
141149
#[cfg(any(target_os = "macos",
150+
target_os = "ios",
142151
target_os = "freebsd",
143152
target_os = "dragonfly"))]
144153
const NOTE_FFOR = libc::NOTE_FFOR,
@@ -147,39 +156,40 @@ bitflags!(
147156
const NOTE_LOWAT = libc::NOTE_LOWAT,
148157
#[cfg(target_os = "freebsd")]
149158
const NOTE_MSECONDS = libc::NOTE_MSECONDS,
150-
#[cfg(target_os = "macos")]
159+
#[cfg(any(target_os = "macos", target_os = "ios"))]
151160
const NOTE_NONE = libc::NOTE_NONE,
152-
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
161+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
153162
const NOTE_NSECONDS = libc::NOTE_NSECONDS,
154163
#[cfg(target_os = "dragonfly")]
155164
const NOTE_OOB = libc::NOTE_OOB,
156165
const NOTE_PCTRLMASK = libc::NOTE_PCTRLMASK,
157166
const NOTE_PDATAMASK = libc::NOTE_PDATAMASK,
158-
#[cfg(target_os = "macos")]
167+
#[cfg(any(target_os = "macos", target_os = "ios"))]
159168
const NOTE_REAP = libc::NOTE_REAP,
160169
const NOTE_RENAME = libc::NOTE_RENAME,
161170
const NOTE_REVOKE = libc::NOTE_REVOKE,
162-
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
171+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
163172
const NOTE_SECONDS = libc::NOTE_SECONDS,
164-
#[cfg(target_os = "macos")]
173+
#[cfg(any(target_os = "macos", target_os = "ios"))]
165174
const NOTE_SIGNAL = libc::NOTE_SIGNAL,
166175
const NOTE_TRACK = libc::NOTE_TRACK,
167176
const NOTE_TRACKERR = libc::NOTE_TRACKERR,
168177
#[cfg(any(target_os = "macos",
178+
target_os = "ios",
169179
target_os = "freebsd",
170180
target_os = "dragonfly"))]
171181
const NOTE_TRIGGER = libc::NOTE_TRIGGER,
172182
#[cfg(target_os = "openbsd")]
173183
const NOTE_TRUNCATE = libc::NOTE_TRUNCATE,
174-
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
184+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))]
175185
const NOTE_USECONDS = libc::NOTE_USECONDS,
176-
#[cfg(target_os = "macos")]
186+
#[cfg(any(target_os = "macos", target_os = "ios"))]
177187
const NOTE_VM_ERROR = libc::NOTE_VM_ERROR,
178-
#[cfg(target_os = "macos")]
188+
#[cfg(any(target_os = "macos", target_os = "ios"))]
179189
const NOTE_VM_PRESSURE = libc::NOTE_VM_PRESSURE,
180-
#[cfg(target_os = "macos")]
190+
#[cfg(any(target_os = "macos", target_os = "ios"))]
181191
const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = libc::NOTE_VM_PRESSURE_SUDDEN_TERMINATE,
182-
#[cfg(target_os = "macos")]
192+
#[cfg(any(target_os = "macos", target_os = "ios"))]
183193
const NOTE_VM_PRESSURE_TERMINATE = libc::NOTE_VM_PRESSURE_TERMINATE,
184194
const NOTE_WRITE = libc::NOTE_WRITE,
185195
}
@@ -251,6 +261,7 @@ pub fn kevent(kq: RawFd,
251261
}
252262

253263
#[cfg(any(target_os = "macos",
264+
target_os = "ios",
254265
target_os = "freebsd",
255266
target_os = "dragonfly",
256267
target_os = "openbsd"))]

0 commit comments

Comments
 (0)