mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
net: add cygwin support (#7393)
This commit is contained in:
@@ -30,4 +30,5 @@ unexpected_cfgs = { level = "warn", check-cfg = [
|
||||
'cfg(tokio_taskdump)',
|
||||
'cfg(tokio_unstable)',
|
||||
'cfg(tokio_uring)',
|
||||
'cfg(target_os, values("cygwin"))',
|
||||
] }
|
||||
|
||||
@@ -276,10 +276,20 @@ impl TcpSocket {
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
#[cfg(all(unix, not(target_os = "solaris"), not(target_os = "illumos")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "solaris"),
|
||||
not(target_os = "illumos"),
|
||||
not(target_os = "cygwin"),
|
||||
))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(unix, not(target_os = "solaris"), not(target_os = "illumos"))))
|
||||
doc(cfg(all(
|
||||
unix,
|
||||
not(target_os = "solaris"),
|
||||
not(target_os = "illumos"),
|
||||
not(target_os = "cygwin"),
|
||||
)))
|
||||
)]
|
||||
pub fn set_reuseport(&self, reuseport: bool) -> io::Result<()> {
|
||||
self.inner.set_reuse_port(reuseport)
|
||||
@@ -311,10 +321,20 @@ impl TcpSocket {
|
||||
/// Ok(())
|
||||
/// }
|
||||
/// ```
|
||||
#[cfg(all(unix, not(target_os = "solaris"), not(target_os = "illumos")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "solaris"),
|
||||
not(target_os = "illumos"),
|
||||
not(target_os = "cygwin"),
|
||||
))]
|
||||
#[cfg_attr(
|
||||
docsrs,
|
||||
doc(cfg(all(unix, not(target_os = "solaris"), not(target_os = "illumos"))))
|
||||
doc(cfg(all(
|
||||
unix,
|
||||
not(target_os = "solaris"),
|
||||
not(target_os = "illumos"),
|
||||
not(target_os = "cygwin"),
|
||||
)))
|
||||
)]
|
||||
pub fn reuseport(&self) -> io::Result<bool> {
|
||||
self.inner.reuse_port()
|
||||
|
||||
@@ -36,7 +36,8 @@ impl UCred {
|
||||
target_os = "redox",
|
||||
target_os = "android",
|
||||
target_os = "openbsd",
|
||||
target_os = "haiku"
|
||||
target_os = "haiku",
|
||||
target_os = "cygwin"
|
||||
))]
|
||||
pub(crate) use self::impl_linux::get_peer_cred;
|
||||
|
||||
@@ -69,7 +70,8 @@ pub(crate) use self::impl_noproc::get_peer_cred;
|
||||
target_os = "redox",
|
||||
target_os = "android",
|
||||
target_os = "openbsd",
|
||||
target_os = "haiku"
|
||||
target_os = "haiku",
|
||||
target_os = "cygwin"
|
||||
))]
|
||||
pub(crate) mod impl_linux {
|
||||
use crate::net::unix::{self, UnixStream};
|
||||
@@ -83,7 +85,8 @@ pub(crate) mod impl_linux {
|
||||
target_os = "linux",
|
||||
target_os = "redox",
|
||||
target_os = "android",
|
||||
target_os = "haiku"
|
||||
target_os = "haiku",
|
||||
target_os = "cygwin"
|
||||
))]
|
||||
use libc::ucred;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user