summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2017-11-05 18:48:19 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2017-11-05 18:48:19 +0000
commitba9ee75ec0333f66d25b09d5c18bbaefac23714f (patch)
tree0bd5f0119c29b0fee9de4bc85837f48fd6df3c46 /src/sys
parent1b9d205c472232c18803b8e9375ef2c6b704148c (diff)
parent5a7d5b1f8c836e44efdf6b9fe1d917619ce92e2d (diff)
downloadnix-ba9ee75ec0333f66d25b09d5c18bbaefac23714f.zip
Merge #790
790: Fix netbsd kevent for breakage introduced by libc r=asomers a=Susurrus
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/event.rs75
-rw-r--r--src/sys/mod.rs20
2 files changed, 46 insertions, 49 deletions
diff --git a/src/sys/event.rs b/src/sys/event.rs
index 1f9c1251..a96dd07c 100644
--- a/src/sys/event.rs
+++ b/src/sys/event.rs
@@ -30,51 +30,40 @@ type type_of_udata = intptr_t;
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
type type_of_data = libc::int64_t;
+#[cfg(target_os = "netbsd")]
+type type_of_event_filter = u32;
#[cfg(not(target_os = "netbsd"))]
type type_of_event_filter = i16;
-#[cfg(not(target_os = "netbsd"))]
-#[repr(i16)]
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub enum EventFilter {
- EVFILT_AIO = libc::EVFILT_AIO,
- #[cfg(target_os = "dragonfly")]
- EVFILT_EXCEPT = libc::EVFILT_EXCEPT,
- #[cfg(any(target_os = "macos", target_os = "ios",
- target_os = "dragonfly",
- target_os = "freebsd"))]
- EVFILT_FS = libc::EVFILT_FS,
- #[cfg(target_os = "freebsd")]
- EVFILT_LIO = libc::EVFILT_LIO,
- #[cfg(any(target_os = "macos", target_os = "ios"))]
- EVFILT_MACHPORT = libc::EVFILT_MACHPORT,
- EVFILT_PROC = libc::EVFILT_PROC,
- EVFILT_READ = libc::EVFILT_READ,
- EVFILT_SIGNAL = libc::EVFILT_SIGNAL,
- EVFILT_TIMER = libc::EVFILT_TIMER,
- #[cfg(any(target_os = "macos",
- target_os = "ios",
- target_os = "dragonfly",
- target_os = "freebsd"))]
- EVFILT_USER = libc::EVFILT_USER,
- #[cfg(any(target_os = "macos", target_os = "ios"))]
- EVFILT_VM = libc::EVFILT_VM,
- EVFILT_VNODE = libc::EVFILT_VNODE,
- EVFILT_WRITE = libc::EVFILT_WRITE,
-}
-
-#[cfg(target_os = "netbsd")]
-type type_of_event_filter = libc::uint32_t;
-#[cfg(target_os = "netbsd")]
-#[repr(i32)]
-#[derive(Clone, Copy, Debug, PartialEq)]
-pub enum EventFilter {
- EVFILT_READ = libc::EVFILT_READ,
- EVFILT_WRITE = libc::EVFILT_WRITE,
- EVFILT_AIO = libc::EVFILT_AIO,
- EVFILT_VNODE = libc::EVFILT_VNODE,
- EVFILT_PROC = libc::EVFILT_PROC,
- EVFILT_SIGNAL = libc::EVFILT_SIGNAL,
- EVFILT_TIMER = libc::EVFILT_TIMER,
+libc_enum!{
+ #[cfg_attr(target_os = "netbsd", repr(u32))]
+ #[cfg_attr(not(target_os = "netbsd"), repr(i16))]
+ pub enum EventFilter {
+ EVFILT_AIO,
+ #[cfg(target_os = "dragonfly")]
+ EVFILT_EXCEPT,
+ #[cfg(any(target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "macos"))]
+ EVFILT_FS,
+ #[cfg(target_os = "freebsd")]
+ EVFILT_LIO,
+ #[cfg(any(target_os = "ios", target_os = "macos"))]
+ EVFILT_MACHPORT,
+ EVFILT_PROC,
+ EVFILT_READ,
+ EVFILT_SIGNAL,
+ EVFILT_TIMER,
+ #[cfg(any(target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "macos"))]
+ EVFILT_USER,
+ #[cfg(any(target_os = "ios", target_os = "macos"))]
+ EVFILT_VM,
+ EVFILT_VNODE,
+ EVFILT_WRITE,
+ }
}
#[cfg(any(target_os = "dragonfly", target_os = "freebsd",
diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index c99fe2db..a94b8a06 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -1,12 +1,20 @@
-#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios",
- target_os = "netbsd", target_os = "macos", target_os = "linux"))]
+#[cfg(any(target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "linux",
+ target_os = "macos",
+ target_os = "netbsd"))]
pub mod aio;
-#[cfg(any(target_os = "linux", target_os = "android"))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
pub mod epoll;
-#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd",
- target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))]
+#[cfg(any(target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "netbsd",
+ target_os = "openbsd"))]
pub mod event;
#[cfg(target_os = "linux")]
@@ -46,7 +54,7 @@ pub mod uio;
pub mod time;
-#[cfg(any(target_os = "linux", target_os = "android"))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
pub mod ptrace;
pub mod select;