about summary refs log tree commit diff
path: root/library/std/src/os/unix/net
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-03-09 02:03:22 +0000
committerChris Denton <chris@chrisdenton.dev>2024-04-14 07:11:51 +0000
commitb1f1039d8bd8ffdda6a58c37f248a247fd9a4e72 (patch)
tree01aa04e96eeecd051b475aab8fc2902dc382a123 /library/std/src/os/unix/net
parentf3c66088610c1b80110297c2d9a8b5f9265b013f (diff)
downloadrust-b1f1039d8bd8ffdda6a58c37f248a247fd9a4e72.tar.gz
rust-b1f1039d8bd8ffdda6a58c37f248a247fd9a4e72.zip
Replace libc::c_int with core::ffi::c_int
And remove the libc crate when it isn't needed
Diffstat (limited to 'library/std/src/os/unix/net')
-rw-r--r--library/std/src/os/unix/net/addr.rs2
-rw-r--r--library/std/src/os/unix/net/ancillary.rs2
-rw-r--r--library/std/src/os/unix/net/datagram.rs4
-rw-r--r--library/std/src/os/unix/net/listener.rs8
4 files changed, 8 insertions, 8 deletions
diff --git a/library/std/src/os/unix/net/addr.rs b/library/std/src/os/unix/net/addr.rs
index 9757653e02c..7b451fec329 100644
--- a/library/std/src/os/unix/net/addr.rs
+++ b/library/std/src/os/unix/net/addr.rs
@@ -11,7 +11,7 @@ use crate::{fmt, io, mem, ptr};
 #[cfg(not(unix))]
 #[allow(non_camel_case_types)]
 mod libc {
-    pub use libc::c_int;
+    pub use core::ffi::c_int;
     pub type socklen_t = u32;
     pub struct sockaddr;
     #[derive(Clone)]
diff --git a/library/std/src/os/unix/net/ancillary.rs b/library/std/src/os/unix/net/ancillary.rs
index 1d279d6adbc..0597fdcbd72 100644
--- a/library/std/src/os/unix/net/ancillary.rs
+++ b/library/std/src/os/unix/net/ancillary.rs
@@ -20,7 +20,7 @@ use crate::sys::net::Socket;
 ))]
 #[allow(non_camel_case_types)]
 mod libc {
-    pub use libc::c_int;
+    pub use core::ffi::c_int;
     pub struct ucred;
     pub struct cmsghdr;
     pub struct sockcred2;
diff --git a/library/std/src/os/unix/net/datagram.rs b/library/std/src/os/unix/net/datagram.rs
index df698c17f6c..b29f9099a11 100644
--- a/library/std/src/os/unix/net/datagram.rs
+++ b/library/std/src/os/unix/net/datagram.rs
@@ -34,7 +34,7 @@ use libc::MSG_NOSIGNAL;
     target_os = "haiku",
     target_os = "nto",
 )))]
-const MSG_NOSIGNAL: libc::c_int = 0x0;
+const MSG_NOSIGNAL: core::ffi::c_int = 0x0;
 
 /// A Unix datagram socket.
 ///
@@ -317,7 +317,7 @@ impl UnixDatagram {
     fn recv_from_flags(
         &self,
         buf: &mut [u8],
-        flags: libc::c_int,
+        flags: core::ffi::c_int,
     ) -> io::Result<(usize, SocketAddr)> {
         let mut count = 0;
         let addr = SocketAddr::new(|addr, len| unsafe {
diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs
index 31286a906ea..7e53acbc387 100644
--- a/library/std/src/os/unix/net/listener.rs
+++ b/library/std/src/os/unix/net/listener.rs
@@ -79,14 +79,14 @@ impl UnixListener {
                 target_os = "espidf",
                 target_os = "horizon"
             ))]
-            const backlog: libc::c_int = 128;
+            const backlog: core::ffi::c_int = 128;
             #[cfg(any(
                 target_os = "linux",
                 target_os = "freebsd",
                 target_os = "openbsd",
                 target_os = "macos"
             ))]
-            const backlog: libc::c_int = -1;
+            const backlog: core::ffi::c_int = -1;
             #[cfg(not(any(
                 target_os = "windows",
                 target_os = "redox",
@@ -138,9 +138,9 @@ impl UnixListener {
         unsafe {
             let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
             #[cfg(target_os = "linux")]
-            const backlog: libc::c_int = -1;
+            const backlog: core::ffi::c_int = -1;
             #[cfg(not(target_os = "linux"))]
-            const backlog: libc::c_int = 128;
+            const backlog: core::ffi::c_int = 128;
             cvt(libc::bind(
                 inner.as_raw_fd(),
                 core::ptr::addr_of!(socket_addr.addr) as *const _,