Skip to content

Commit 4e87250

Browse files
committed
Fix compilation errors on macOS and Windows
1 parent ca90bf3 commit 4e87250

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

stdlib/src/socket.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ mod _socket {
3939
pub use winapi::shared::netioapi::{if_indextoname, if_nametoindex};
4040
pub use winapi::shared::ws2def::*;
4141
pub use winapi::shared::ws2ipdef::*;
42-
pub use winapi::shared::ws2tcpip::*;
4342
pub use winapi::um::winsock2::{
4443
SD_BOTH as SHUT_RDWR, SD_RECEIVE as SHUT_RD, SD_SEND as SHUT_WR, SOCK_DGRAM, SOCK_RAW,
4544
SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_LINGER,
4645
SO_OOBINLINE, SO_REUSEADDR, SO_TYPE, *,
4746
};
47+
pub use winapi::um::ws2tcpip::*;
4848
}
4949
// constants
5050
#[pyattr(name = "has_ipv6")]
@@ -529,6 +529,19 @@ mod _socket {
529529
#[pyattr]
530530
use c::{TCP_KEEPCNT, TCP_KEEPINTVL};
531531

532+
#[cfg(any(
533+
target_os = "android",
534+
target_os = "dragonfly",
535+
target_os = "freebsd",
536+
target_os = "fuchsia",
537+
target_os = "linux",
538+
target_os = "netbsd",
539+
target_os = "openbsd",
540+
target_os = "redox"
541+
))]
542+
#[pyattr]
543+
use c::{SOCK_CLOEXEC, SOCK_NONBLOCK};
544+
532545
#[cfg(any(
533546
target_os = "android",
534547
target_os = "dragonfly",
@@ -542,7 +555,7 @@ mod _socket {
542555
#[pyattr]
543556
use c::{
544557
AF_ROUTE, AF_SNA, EAI_OVERFLOW, IPPROTO_GRE, IPPROTO_RSVP, IPPROTO_TP, IPV6_RECVPKTINFO,
545-
MSG_DONTWAIT, SCM_RIGHTS, SOCK_CLOEXEC, SOCK_NONBLOCK, TCP_MAXSEG,
558+
MSG_DONTWAIT, SCM_RIGHTS, TCP_MAXSEG,
546559
};
547560

548561
#[cfg(any(

0 commit comments

Comments
 (0)