Compare commits

...

4 Commits

Author SHA1 Message Date
John Nunley cf2d60efca
ci: Use latest stable wine in testing
This works around bugs in Rust v1.78 that introduce incompatibilities
into Wine.

https://github.com/smol-rs/polling/pull/201#issuecomment-2092385046

Signed-off-by: John Nunley <dev@notgull.net>
2024-05-03 17:55:23 -07:00
John Nunley 0b4afcaf0a
ci: Remove +nightly and use default
Previously in the "cross" CI job, checks would use "+nightly" to ensure
that the nightly compiler is used. However this adds a lot of noise. In
order to clean up CI this commit replaces "+nightly" with "rustup
default nightly" at the start of the job.

cc https://github.com/smol-rs/polling/pull/197#discussion_r1573375732

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-22 18:36:07 -07:00
John Nunley eb9d92a2e0
v3.7.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-22 16:33:52 -07:00
Nikolay Arhipov 9e46c8455c
feat: ported to Vita target
Fixes #160
2024-04-20 11:22:46 -07:00
7 changed files with 37 additions and 11 deletions

View File

@ -81,10 +81,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
rust: [nightly, stable]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
- name: Add rust-src
@ -121,11 +122,13 @@ jobs:
cargo check --target x86_64-unknown-redox
- name: HermitOS
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
run: |
cargo -Zbuild-std check --target x86_64-unknown-hermit
run: cargo check -Z build-std --target x86_64-unknown-hermit
- name: Check haiku
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
run: cargo check -Z build-std --target x86_64-unknown-haiku
- name: Check vita
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
run: cargo check -Z build-std --target armv7-sony-vita-newlibeabihf
wine:
runs-on: ubuntu-22.04
@ -136,7 +139,6 @@ jobs:
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: x86_64-pc-windows-gnu
runner: wine@7.13
- run: cargo test --target x86_64-pc-windows-gnu
msrv:

View File

@ -1,3 +1,7 @@
# Version 3.7.0
- Add support for the PS Vita as a platform. (#160)
# Version 3.6.0
- Add an `is_err` method to `Event` to tell when an error has occurred. (#189)

View File

@ -3,7 +3,7 @@ name = "polling"
# When publishing a new version:
# - Update CHANGELOG.md
# - Create "v3.x.y" git tag
version = "3.6.0"
version = "3.7.0"
authors = ["Stjepan Glavina <stjepang@gmail.com>", "John Nunley <dev@notgull.net>"]
edition = "2021"
rust-version = "1.63"
@ -55,4 +55,6 @@ socket2 = "0.5.5"
[target.'cfg(unix)'.dev-dependencies]
libc = "0.2"
[target.'cfg(all(unix, not(target_os="vita")))'.dev-dependencies]
signal-hook = "0.3.17"

View File

@ -402,7 +402,7 @@ impl Event {
/// Tells if this event is the result of a connection failure.
///
/// This function checks if an error exist,particularlly useful in detecting if TCP connection failed. It corresponds to the `EPOLLERR` event in Linux
/// This function checks if an error exist, particularly useful in detecting if TCP connection failed. It corresponds to the `EPOLLERR` event in Linux
/// and `CONNECT_FAILED` event in Windows IOCP.
///
/// ## Caveats

View File

@ -1,4 +1,4 @@
//! Functionality that is only availale for IOCP-based platforms.
//! Functionality that is only available for IOCP-based platforms.
pub use crate::sys::CompletionPacket;

View File

@ -685,7 +685,7 @@ mod notify {
self.read_pipe.as_fd()
}
/// Provides the poll flags to be used when registering the read half of the botify pipe with the `Poller`.
/// Provides the poll flags to be used when registering the read half of the notify pipe with the `Poller`.
pub(super) fn poll_flags(&self) -> PollFlags {
PollFlags::RDNORM
}
@ -699,7 +699,25 @@ mod notify {
/// Pops a notification (if any) from the pipe.
pub(super) fn pop_notification(&self) -> Result<(), io::Error> {
read(&self.read_pipe, &mut [0; 1])?;
// Pipes on Vita do not guarantee that after `write` call succeeds, the
// data becomes immediately available for reading on the other side of the pipe.
// To ensure that the notification is not lost, the read side of the pipe is temporarily
// switched to blocking for a single `read` call.
#[cfg(target_os = "vita")]
rustix::fs::fcntl_setfl(
&self.read_pipe,
rustix::fs::fcntl_getfl(&self.read_pipe)? & !rustix::fs::OFlags::NONBLOCK,
)?;
let result = read(&self.read_pipe, &mut [0; 1]);
#[cfg(target_os = "vita")]
rustix::fs::fcntl_setfl(
&self.read_pipe,
rustix::fs::fcntl_getfl(&self.read_pipe)? | rustix::fs::OFlags::NONBLOCK,
)?;
result?;
Ok(())
}
@ -729,7 +747,7 @@ mod notify {
/// A notification pipe.
///
/// This implementation uses ther `eventfd` syscall to send notifications.
/// This implementation uses the `eventfd` syscall to send notifications.
#[derive(Debug)]
pub(super) struct Notify {
/// The file descriptor of the eventfd object. This is also stored as the first

View File

@ -76,7 +76,7 @@ fn concurrent_modify() -> io::Result<()> {
Ok(())
}
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "vita")))]
#[test]
fn concurrent_interruption() -> io::Result<()> {
struct MakeItSend<T>(T);