Skip to content

Commit 4ac15ff

Browse files
authored
Merge pull request #26 from Kestrer/master
Support VxWorks, Fuchsia and other Unix systems by using poll
2 parents 952fccb + e902924 commit 4ac15ff

File tree

8 files changed

+508
-9
lines changed

8 files changed

+508
-9
lines changed

.github/workflows/cross.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ jobs:
4646
if: startsWith(matrix.os, 'ubuntu')
4747
run: cross check --target x86_64-unknown-linux-gnux32
4848

49+
- name: Add fuchsia target
50+
if: startsWith(matrix.os, 'ubuntu')
51+
run: rustup target add x86_64-fuchsia
52+
53+
- name: Fuchsia
54+
if: startsWith(matrix.os, 'ubuntu')
55+
run: cross build --target x86_64-fuchsia
56+
4957
# - name: illumos
5058
# if: startsWith(matrix.os, 'ubuntu')
5159
# run: cross build --target x86_64-unknown-illumos

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ std = []
2222
cfg-if = "1"
2323
log = "0.4.11"
2424

25-
[target."cfg(unix)".dependencies]
25+
[target.'cfg(any(unix, target_os = "fuchsia", target_os = "vxworks"))'.dependencies]
2626
libc = "0.2.77"
2727

2828
[target.'cfg(windows)'.dependencies]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Supported platforms:
1616
- [kqueue](https://en.wikipedia.org/wiki/Kqueue): macOS, iOS, FreeBSD, NetBSD, OpenBSD,
1717
DragonFly BSD
1818
- [event ports](https://illumos.org/man/port_create): illumos, Solaris
19+
- [poll](https://en.wikipedia.org/wiki/Poll_(Unix)): VxWorks, Fuchsia, other Unix systems
1920
- [wepoll](https://github.com/piscisaureus/wepoll): Windows
2021

2122
Polling is done in oneshot mode, which means interest in I/O events needs to be reset after

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! - [kqueue](https://en.wikipedia.org/wiki/Kqueue): macOS, iOS, FreeBSD, NetBSD, OpenBSD,
66
//! DragonFly BSD
77
//! - [event ports](https://illumos.org/man/port_create): illumos, Solaris
8+
//! - [poll](https://en.wikipedia.org/wiki/Poll_(Unix)): VxWorks, Fuchsia, other Unix systems
89
//! - [wepoll](https://github.com/piscisaureus/wepoll): Windows
910
//!
1011
//! Polling is done in oneshot mode, which means interest in I/O events needs to be re-enabled
@@ -92,6 +93,13 @@ cfg_if! {
9293
))] {
9394
mod kqueue;
9495
use kqueue as sys;
96+
} else if #[cfg(any(
97+
target_os = "vxworks",
98+
target_os = "fuchsia",
99+
unix,
100+
))] {
101+
mod poll;
102+
use poll as sys;
95103
} else if #[cfg(target_os = "windows")] {
96104
mod wepoll;
97105
use wepoll as sys;
@@ -104,7 +112,7 @@ cfg_if! {
104112
const NOTIFY_KEY: usize = std::usize::MAX;
105113

106114
/// Indicates that a file descriptor or socket can read or write without blocking.
107-
#[derive(Debug)]
115+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
108116
pub struct Event {
109117
/// Key identifying the file descriptor or socket.
110118
pub key: usize,

0 commit comments

Comments
 (0)