From c379d1ac997a84c0a2fe96b0f65c3bf244c96c8d Mon Sep 17 00:00:00 2001 From: Nick Pelone Date: Tue, 26 May 2020 15:15:44 -0400 Subject: [PATCH 1/4] Add EV_DISPATCH and EV_RECEIPT EventFlag items for OpenBSD. --- src/sys/event.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/sys/event.rs b/src/sys/event.rs index 7af5ae2b15..7550c2abbc 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -90,14 +90,9 @@ libc_bitflags!{ EV_CLEAR; EV_DELETE; EV_DISABLE; - // No released version of OpenBSD supports EV_DISPATCH or EV_RECEIPT. - // These have been commited to the -current branch though and are - // expected to be part of the OpenBSD 6.2 release in Nov 2017. - // See: https://marc.info/?l=openbsd-tech&m=149621427511219&w=2 - // https://github.com/rust-lang/libc/pull/613 #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "netbsd"))] + target_os = "netbsd", target_os = "openbsd"))] EV_DISPATCH; #[cfg(target_os = "freebsd")] EV_DROP; @@ -116,7 +111,7 @@ libc_bitflags!{ EV_POLL; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "netbsd"))] + target_os = "netbsd", target_os = "openbsd"))] EV_RECEIPT; EV_SYSFLAGS; } From dd0a99001ea2607c9914b882b0b6a10fa22c5375 Mon Sep 17 00:00:00 2001 From: Nick Pelone Date: Tue, 26 May 2020 15:20:39 -0400 Subject: [PATCH 2/4] Fix build on OpenBSD caused by erroneous inclusion in allowed OS list for sendmmsg() / recvmmsg() in #1208. In #1208, sendmmsg() / recvmmsg() were added, but OpenBSD(who doesn't support these) was included on the list of allowed operating systems for sendmmsg() related things. This broke the build on OpenBSD. For more Rust-world examples, see: https://github.com/rust-lang/libc/commit/6f6297301d49ff67b8ca044d651f36a56950298c --- src/sys/socket/mod.rs | 2 -- test/sys/test_socket.rs | 1 - 2 files changed, 3 deletions(-) diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 52768c9351..a3c0d1284e 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -920,7 +920,6 @@ pub fn sendmsg(fd: RawFd, iov: &[IoVec<&[u8]>], cmsgs: &[ControlMessage], target_os = "linux", target_os = "android", target_os = "freebsd", - target_os = "openbsd", target_os = "netbsd", ))] #[derive(Debug)] @@ -956,7 +955,6 @@ pub struct SendMmsgData<'a, I, C> target_os = "linux", target_os = "android", target_os = "freebsd", - target_os = "openbsd", target_os = "netbsd", ))] pub fn sendmmsg<'a, I, C>( diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 9bf458285f..d6c1ec0cbb 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -309,7 +309,6 @@ mod recvfrom { target_os = "linux", target_os = "android", target_os = "freebsd", - target_os = "openbsd", target_os = "netbsd", ))] #[test] From 0f9fcbd4c57d8466446b56c7ee24db73df5f8d3f Mon Sep 17 00:00:00 2001 From: Nick Pelone Date: Tue, 26 May 2020 15:26:22 -0400 Subject: [PATCH 3/4] Fix use of deprecated libc type, needed in order to run the tests successfully. This type was deprecated in libc 0.2.55. --- src/sys/event.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sys/event.rs b/src/sys/event.rs index 7550c2abbc..cf9393bd3a 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -28,7 +28,7 @@ type type_of_data = intptr_t; #[cfg(any(target_os = "netbsd"))] type type_of_udata = intptr_t; #[cfg(any(target_os = "netbsd", target_os = "openbsd"))] -type type_of_data = libc::int64_t; +type type_of_data = i64; #[cfg(target_os = "netbsd")] type type_of_event_filter = u32; From efef981f6642bf7ae6d0f6d69118e5826adc2156 Mon Sep 17 00:00:00 2001 From: Nick Pelone Date: Tue, 26 May 2020 15:36:52 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md now that I have a PR number --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad8aeb2abe..28e2b5ba1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). (#[1216](https://github.com/nix-rust/nix/pull/1216)) - Added `BindToDevice` socket option (sockopt) on Linux (#[1233](https://github.com/nix-rust/nix/pull/1233)) +- Added `EventFilter` bitflags for `EV_DISPATCH` and `EV_RECEIPT` on OpenBSD. + (#[1252](https://github.com/nix-rust/nix/pull/1252)) ### Changed - Changed `fallocate` return type from `c_int` to `()` (#[1201](https://github.com/nix-rust/nix/pull/1201))