Skip to content

Commit

Permalink
Update Rustix dependency to 0.38.6 and update to reflect new crate st…
Browse files Browse the repository at this point in the history
…ructure for kqueue
  • Loading branch information
Dag Liodden committed Aug 4, 2023
1 parent c86c389 commit 8a2725c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Empty file added .cargo/config.toml
Empty file.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tracing = { version = "0.1.37", default-features = false }

[target.'cfg(any(unix, target_os = "fuchsia", target_os = "vxworks"))'.dependencies]
libc = "0.2.77"
rustix = { version = "0.37.11", features = ["process", "time", "fs", "std"], default-features = false }
rustix = { version = "0.38.6", features = ["process", "time", "fs", "std", "event"], default-features = false }

[target.'cfg(windows)'.dependencies]
concurrent-queue = "2.2.0"
Expand Down
17 changes: 9 additions & 8 deletions src/epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::time::Duration;

use rustix::fd::OwnedFd;
use rustix::io::{epoll, eventfd, read, write, EventfdFlags};
use rustix::io::{read, write};
use rustix::event::{epoll, eventfd, EventfdFlags};
use rustix::time::{
timerfd_create, timerfd_settime, Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags,
Timespec,
Expand All @@ -31,7 +32,7 @@ impl Poller {
// Create an epoll instance.
//
// Use `epoll_create1` with `EPOLL_CLOEXEC`.
let epoll_fd = epoll::epoll_create(epoll::CreateFlags::CLOEXEC)?;
let epoll_fd = epoll::create(epoll::CreateFlags::CLOEXEC)?;

// Set up eventfd and timerfd.
let event_fd = eventfd(0, EventfdFlags::CLOEXEC | EventfdFlags::NONBLOCK)?;
Expand Down Expand Up @@ -94,10 +95,10 @@ impl Poller {
);
let _enter = span.enter();

epoll::epoll_add(
epoll::add(
&self.epoll_fd,
unsafe { rustix::fd::BorrowedFd::borrow_raw(fd) },
ev.key as u64,
epoll::EventData::new_u64(ev.key as u64),
epoll_flags(&ev, mode),
)?;

Expand All @@ -114,10 +115,10 @@ impl Poller {
);
let _enter = span.enter();

epoll::epoll_mod(
epoll::modify(
&self.epoll_fd,
unsafe { rustix::fd::BorrowedFd::borrow_raw(fd) },
ev.key as u64,
epoll::EventData::new_u64(ev.key as u64),
epoll_flags(&ev, mode),
)?;

Expand All @@ -133,7 +134,7 @@ impl Poller {
);
let _enter = span.enter();

epoll::epoll_del(&self.epoll_fd, unsafe {
epoll::delete(&self.epoll_fd, unsafe {
rustix::fd::BorrowedFd::borrow_raw(fd)
})?;

Expand Down Expand Up @@ -195,7 +196,7 @@ impl Poller {
};

// Wait for I/O events.
epoll::epoll_wait(&self.epoll_fd, &mut events.list, timeout_ms)?;
epoll::wait(&self.epoll_fd, &mut events.list, timeout_ms)?;
tracing::trace!(
epoll_fd = ?self.epoll_fd.as_raw_fd(),
res = ?events.list.len(),
Expand Down
5 changes: 3 additions & 2 deletions src/kqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
use std::time::Duration;

use rustix::fd::OwnedFd;
use rustix::io::{fcntl_setfd, kqueue, Errno, FdFlags};
use rustix::io::{fcntl_setfd, Errno, FdFlags};
use rustix::event::kqueue;

use crate::{Event, PollMode};

Expand Down Expand Up @@ -268,7 +269,7 @@ pub(crate) fn mode_to_flags(mode: PollMode) -> kqueue::EventFlags {
))]
mod notify {
use super::Poller;
use rustix::io::kqueue;
use rustix::event::kqueue;
use std::io;
use std::os::unix::io::RawFd;

Expand Down
4 changes: 2 additions & 2 deletions src/os/kqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::io;
use std::process::Child;
use std::time::Duration;

use rustix::io::kqueue;
use rustix::event::kqueue;

use super::__private::PollerSealed;
use __private::FilterSealed;
Expand Down Expand Up @@ -238,7 +238,7 @@ unsafe impl FilterSealed for Timer {
impl Filter for Timer {}

mod __private {
use rustix::io::kqueue;
use rustix::event::kqueue;

#[doc(hidden)]
pub unsafe trait FilterSealed {
Expand Down

0 comments on commit 8a2725c

Please sign in to comment.