From 245922a98119dd2743615745a88f30cbba3f3c31 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 4 Jul 2025 12:43:50 +0200 Subject: [PATCH 1/2] Try to get rid of libc::c_int --- Cargo.toml | 2 -- src/sys/unix.rs | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eb31c29b..b661f2e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,8 +70,6 @@ all = [] [package.metadata.cargo_check_external_types] allowed_external_types = [ # Referenced via a type alias. - "libc::c_int", - "libc::primitives::c_int", # libc::c_int isn't always detected. "libc::socklen_t", "libc::*::socklen_t", # libc::socklen_t isn't always detected. "libc::sa_family_t", diff --git a/src/sys/unix.rs b/src/sys/unix.rs index e3ec1da7..8cdf4fb0 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -83,7 +83,7 @@ use crate::{Domain, Protocol, SockAddr, SockAddrStorage, TcpKeepalive, Type}; #[cfg(not(target_os = "redox"))] use crate::{MsgHdr, MsgHdrMut, RecvFlags}; -pub(crate) use libc::c_int; +pub(crate) use core::os::raw::c_int; // Used in `Domain`. pub(crate) use libc::{AF_INET, AF_INET6, AF_UNIX}; @@ -730,7 +730,7 @@ pub(crate) fn set_msghdr_control(msg: &mut msghdr, ptr: *mut libc::c_void, len: } #[cfg(not(target_os = "redox"))] -pub(crate) fn set_msghdr_flags(msg: &mut msghdr, flags: libc::c_int) { +pub(crate) fn set_msghdr_flags(msg: &mut msghdr, flags: c_int) { msg.msg_flags = flags; } @@ -1002,7 +1002,7 @@ pub(crate) fn set_nonblocking(fd: Socket, nonblocking: bool) -> io::Result<()> { fd, libc::SOL_SOCKET, libc::SO_NONBLOCK, - nonblocking as libc::c_int, + nonblocking as c_int, ) } } From 10e616a8a9d23d710276ccdcbf8aeb11360f25cc Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 4 Jul 2025 12:47:23 +0200 Subject: [PATCH 2/2] Fix --- src/sys/unix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 8cdf4fb0..3787ce00 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -83,7 +83,7 @@ use crate::{Domain, Protocol, SockAddr, SockAddrStorage, TcpKeepalive, Type}; #[cfg(not(target_os = "redox"))] use crate::{MsgHdr, MsgHdrMut, RecvFlags}; -pub(crate) use core::os::raw::c_int; +pub(crate) use std::os::raw::c_int; // Used in `Domain`. pub(crate) use libc::{AF_INET, AF_INET6, AF_UNIX};