From 45c53bbc88d6ef0f1a9b7c83557323e3a151a681 Mon Sep 17 00:00:00 2001 From: loongs-zhang <1936978077@qq.com> Date: Sun, 15 Jun 2025 23:00:19 +0800 Subject: [PATCH 1/2] update dependencies --- Cargo.toml | 4 ++-- core/docs/en/work-steal.md | 2 +- core/src/net/operator/windows/mod.rs | 6 +++--- core/src/syscall/windows/SetFilePointerEx.rs | 3 ++- core/src/syscall/windows/WaitOnAddress.rs | 3 ++- core/src/syscall/windows/accept.rs | 2 +- hook/src/syscall/windows.rs | 4 ++-- open-coroutine/build.rs | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 51a3cc60..69bf7570 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ open-coroutine-macros = { path = "macros", version = "0.7.0" } tracing = { version = "0.1", default-features = false } tracing-subscriber = { version = "0.3", default-features = false } tracing-appender = { version = "0.2", default-features = false } -cargo_metadata = { version = "0.19", default-features = false } +cargo_metadata = { version = "0.20", default-features = false } mio = { version = "1.0", default-features = false } cfg-if = "1.0.0" @@ -45,7 +45,7 @@ crossbeam-utils = "0.8" crossbeam-skiplist = "0.1" nix = "0.30" io-uring = "0.7" -windows-sys = "0.59" +windows-sys = "0.60" anyhow = "1.0" slab = "0.4" backtrace = "0.3" diff --git a/core/docs/en/work-steal.md b/core/docs/en/work-steal.md index 4ed004aa..948d3599 100644 --- a/core/docs/en/work-steal.md +++ b/core/docs/en/work-steal.md @@ -23,7 +23,7 @@ better to let them help other threads work. ## What is work steal queue? A work steal queue consists of a global queue and multiple local queues, the global queue is unbounded, while the local -queue has a bounded RingBuffer. To ensure high performance, the number of local queues is usually equal to the number of +queue has a bounded `RingBuffer`. To ensure high performance, the number of local queues is usually equal to the number of threads. I's worth mentioning that if all threads prioritize local tasks, there will be an extreme situation where tasks on the shared queue will never have a chance to be scheduled. To avoid this imbalance, refer to goroutine, every time a thread has scheduled 60 tasks from the local queue, it will be forced to pop a task from the shared queue. diff --git a/core/src/net/operator/windows/mod.rs b/core/src/net/operator/windows/mod.rs index 531fc9c7..42feed67 100644 --- a/core/src/net/operator/windows/mod.rs +++ b/core/src/net/operator/windows/mod.rs @@ -142,7 +142,7 @@ impl<'o> Operator<'o> { self.iocp, uninit.as_mut_ptr().cast(), uninit.len().try_into().expect("overflow"), - &mut recv_count, + &raw mut recv_count, left_ns .saturating_div(1_000_000) .try_into() @@ -242,7 +242,7 @@ impl<'o> Operator<'o> { SOL_SOCKET, SO_PROTOCOL_INFO, std::ptr::from_mut(&mut sock_info).cast(), - &mut sock_info_len, + &raw mut sock_info_len, ) != 0 { return Err(Error::other("get socket info failed")); @@ -252,7 +252,7 @@ impl<'o> Operator<'o> { sock_info.iAddressFamily, sock_info.iSocketType, sock_info.iProtocol, - &sock_info, + &raw const sock_info, 0, WSA_FLAG_OVERLAPPED, ); diff --git a/core/src/syscall/windows/SetFilePointerEx.rs b/core/src/syscall/windows/SetFilePointerEx.rs index a3ff7fec..07f8c7e0 100644 --- a/core/src/syscall/windows/SetFilePointerEx.rs +++ b/core/src/syscall/windows/SetFilePointerEx.rs @@ -1,5 +1,6 @@ use std::ffi::c_longlong; -use windows_sys::Win32::Foundation::{BOOL, HANDLE}; +use windows_sys::core::BOOL; +use windows_sys::Win32::Foundation::HANDLE; use windows_sys::Win32::Storage::FileSystem::SET_FILE_POINTER_MOVE_METHOD; trait SetFilePointerExSyscall { diff --git a/core/src/syscall/windows/WaitOnAddress.rs b/core/src/syscall/windows/WaitOnAddress.rs index f93cdbae..1db0bcbc 100644 --- a/core/src/syscall/windows/WaitOnAddress.rs +++ b/core/src/syscall/windows/WaitOnAddress.rs @@ -1,6 +1,7 @@ use std::ffi::{c_uint, c_void}; use std::time::Duration; -use windows_sys::Win32::Foundation::{BOOL, ERROR_TIMEOUT, FALSE, TRUE}; +use windows_sys::core::BOOL; +use windows_sys::Win32::Foundation::{ERROR_TIMEOUT, FALSE, TRUE}; use crate::common::{get_timeout_time, now}; use crate::net::EventLoops; use crate::syscall::reset_errno; diff --git a/core/src/syscall/windows/accept.rs b/core/src/syscall/windows/accept.rs index f9cfdeb4..2da8ae6e 100644 --- a/core/src/syscall/windows/accept.rs +++ b/core/src/syscall/windows/accept.rs @@ -90,7 +90,7 @@ impl AcceptSyscall for IocpAcceptSyscall { SOL_SOCKET, SO_PROTOCOL_INFO, std::ptr::from_mut(&mut sock_info).cast(), - &mut sock_info_len, + &raw mut sock_info_len, ) != 0 { return INVALID_SOCKET; diff --git a/hook/src/syscall/windows.rs b/hook/src/syscall/windows.rs index 504034a8..a4c4d477 100644 --- a/hook/src/syscall/windows.rs +++ b/hook/src/syscall/windows.rs @@ -1,7 +1,7 @@ use std::ffi::{c_int, c_longlong, c_uint, c_void}; use std::io::Error; -use windows_sys::core::{PCSTR, PCWSTR, PSTR}; -use windows_sys::Win32::Foundation::{BOOL, HANDLE, TRUE}; +use windows_sys::core::{BOOL, PCSTR, PCWSTR, PSTR}; +use windows_sys::Win32::Foundation::{HANDLE, TRUE}; use windows_sys::Win32::Networking::WinSock::{ FD_SET, IPPROTO, LPCONDITIONPROC, LPWSAOVERLAPPED_COMPLETION_ROUTINE, SEND_RECV_FLAGS, SOCKADDR, SOCKET, TIMEVAL, WINSOCK_SHUTDOWN_HOW, WINSOCK_SOCKET_TYPE, WSABUF, WSAPOLLFD, diff --git a/open-coroutine/build.rs b/open-coroutine/build.rs index da654c4a..c9a39723 100644 --- a/open-coroutine/build.rs +++ b/open-coroutine/build.rs @@ -51,7 +51,7 @@ fn main() { metadata .packages .iter() - .find(|pkg| pkg.name.eq("open-coroutine")) + .find(|pkg| pkg.name.as_str().eq("open-coroutine")) .expect("read current package failed") } else { metadata From c08a44db50ea6a0cf2eb5a23e1dd21f98c93ba9c Mon Sep 17 00:00:00 2001 From: loongs-zhang <1936978077@qq.com> Date: Sun, 15 Jun 2025 23:05:05 +0800 Subject: [PATCH 2/2] fix clippy --- core/src/net/operator/linux/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/net/operator/linux/mod.rs b/core/src/net/operator/linux/mod.rs index 271a7de0..f7a542ba 100644 --- a/core/src/net/operator/linux/mod.rs +++ b/core/src/net/operator/linux/mod.rs @@ -93,7 +93,7 @@ impl Operator<'_> { &self, timeout: Option, want: usize, - ) -> std::io::Result<(usize, CompletionQueue, Option)> { + ) -> std::io::Result<(usize, CompletionQueue<'_>, Option)> { if support_io_uring() { if self .entering @@ -113,7 +113,7 @@ impl Operator<'_> { &self, timeout: Option, want: usize, - ) -> std::io::Result<(usize, CompletionQueue, Option)> { + ) -> std::io::Result<(usize, CompletionQueue<'_>, Option)> { let start_time = Instant::now(); self.timeout_add(crate::common::constants::IO_URING_TIMEOUT_USERDATA, timeout)?; let mut cq = unsafe { self.inner.completion_shared() };