diff --git a/Cargo.toml b/Cargo.toml index bcca102820..ee5c8e6623 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ targets = [ ] [dependencies] -libc = { version = "=0.2.175", features = ["extra_traits"] } +libc = { version = "=0.2.180", features = ["extra_traits"] } bitflags = "2.3.3" cfg-if = "1.0" pin-utils = { version = "0.1.0", optional = true } diff --git a/changelog/2724.changed.md b/changelog/2724.changed.md new file mode 100644 index 0000000000..2317cfa9c4 --- /dev/null +++ b/changelog/2724.changed.md @@ -0,0 +1 @@ +Bumped libc to [0.2.180](https://github.com/rust-lang/libc/releases/tag/0.2.180) diff --git a/changelog/2724.removed.md b/changelog/2724.removed.md new file mode 100644 index 0000000000..1e05aa62d4 --- /dev/null +++ b/changelog/2724.removed.md @@ -0,0 +1 @@ +Removed `IFF_NOTRAILERS` by NetBSD, as it has been removed upstream and from libc diff --git a/src/fcntl.rs b/src/fcntl.rs index 4b439d03ed..a1a800f218 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -1175,16 +1175,20 @@ libc_bitflags! { /// Request that pages be moved instead of copied. /// /// Not applicable to `vmsplice`. + #[cfg(not(target_env = "uclibc"))] SPLICE_F_MOVE; /// Do not block on I/O. + #[cfg(not(target_env = "uclibc"))] SPLICE_F_NONBLOCK; /// Hint that more data will be coming in a subsequent splice. /// /// Not applicable to `vmsplice`. + #[cfg(not(target_env = "uclibc"))] SPLICE_F_MORE; /// Gift the user pages to the kernel. /// /// Not applicable to `splice`. + #[cfg(not(target_env = "uclibc"))] SPLICE_F_GIFT; } } diff --git a/src/net/if_.rs b/src/net/if_.rs index cae6e3f826..1e2085c338 100644 --- a/src/net/if_.rs +++ b/src/net/if_.rs @@ -66,7 +66,6 @@ libc_bitflags!( solarish, apple_targets, target_os = "fuchsia", - target_os = "netbsd", target_os = "cygwin"))] IFF_NOTRAILERS as IflagsType; /// Interface manages own routes. diff --git a/src/sys/event.rs b/src/sys/event.rs index ce3d558312..b93004904f 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -91,11 +91,6 @@ impl Kqueue { } } -#[cfg(any(freebsdlike, apple_targets, target_os = "openbsd"))] -type type_of_udata = *mut libc::c_void; -#[cfg(target_os = "netbsd")] -type type_of_udata = intptr_t; - #[cfg(target_os = "netbsd")] type type_of_event_filter = u32; #[cfg(not(target_os = "netbsd"))] @@ -364,7 +359,7 @@ impl KEvent { fflags: fflags.bits(), // data can be either i64 or intptr_t, depending on platform data: data as _, - udata: udata as type_of_udata, + udata: udata as *mut libc::c_void, ..unsafe { mem::zeroed() } }, } @@ -456,5 +451,5 @@ pub fn ev_set( ev.kevent.flags = flags.bits(); ev.kevent.fflags = fflags.bits(); ev.kevent.data = 0; - ev.kevent.udata = udata as type_of_udata; + ev.kevent.udata = udata as *mut libc::c_void; } diff --git a/src/sys/memfd.rs b/src/sys/memfd.rs index ecf80e1eb1..3203f91233 100644 --- a/src/sys/memfd.rs +++ b/src/sys/memfd.rs @@ -54,34 +54,34 @@ libc_bitflags!( /// See also the hugetlb filesystem in [`memfd_create(2)`]. /// /// [`memfd_create(2)`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_1MB; /// hugetlb size of 2MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_2MB; /// hugetlb size of 8MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_8MB; /// hugetlb size of 16MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_16MB; /// hugetlb size of 32MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_32MB; /// hugetlb size of 256MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_256MB; /// hugetlb size of 512MB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_512MB; /// hugetlb size of 1GB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_1GB; /// hugetlb size of 2GB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_2GB; /// hugetlb size of 16GB. - #[cfg(linux_android)] + #[cfg(all(linux_android, not(target_env = "uclibc")))] MFD_HUGE_16GB; } ); diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index b16c54918b..4faa3010f7 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -1112,7 +1112,10 @@ impl ControlMessageOwned { let (err, addr) = unsafe { Self::recv_err_helper::(p, len) }; ControlMessageOwned::Ipv6RecvErr(err, addr) }, - #[cfg(any(linux_android, target_os = "freebsd"))] + #[cfg(any( + all(linux_android, not(target_env = "uclibc")), + target_os = "freebsd" + ))] #[cfg(feature = "net")] (libc::IPPROTO_IPV6, libc::IPV6_ORIGDSTADDR) => { let dl = unsafe { ptr::read_unaligned(p as *const libc::sockaddr_in6) }; diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index e06dded5bb..03a55d407c 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -563,6 +563,7 @@ sockopt_impl!( ); #[cfg(linux_android)] #[cfg(feature = "net")] +#[cfg(not(target_env = "uclibc"))] sockopt_impl!( #[cfg_attr(docsrs, doc(cfg(feature = "net")))] /// If enabled, the kernel will not reserve an ephemeral port when binding @@ -1243,7 +1244,10 @@ sockopt_impl!( libc::IPV6_RECVHOPLIMIT, bool ); -#[cfg(any(linux_android, target_os = "freebsd"))] +#[cfg(any( + all(linux_android, not(target_env = "uclibc")), + target_os = "freebsd" +))] #[cfg(feature = "net")] sockopt_impl!( #[cfg_attr(docsrs, doc(cfg(feature = "net")))] @@ -1264,7 +1268,10 @@ sockopt_impl!( libc::IP_DONTFRAG, bool ); -#[cfg(any(linux_android, apple_targets))] +#[cfg(any( + all(linux_android, not(target_env = "uclibc")), + apple_targets +))] sockopt_impl!( /// Set "don't fragment packet" flag on the IPv6 packet. Ipv6DontFrag, diff --git a/src/sys/time.rs b/src/sys/time.rs index 7e89c72149..814ecc9394 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -624,6 +624,10 @@ impl TimeVal { }) } + #[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + allow(deprecated) + )] // https://github.com/rust-lang/libc/issues/1848 fn micros_mod_sec(&self) -> suseconds_t { if self.tv_sec() < 0 && self.tv_usec() > 0 { self.tv_usec() - MICROS_PER_SEC as suseconds_t @@ -640,6 +644,10 @@ impl TimeVal { self.0.tv_sec } + #[cfg_attr( + any(target_env = "musl", target_env = "ohos"), + allow(deprecated) + )] // https://github.com/rust-lang/libc/issues/1848 pub const fn tv_usec(&self) -> suseconds_t { self.0.tv_usec } diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 514e28d62b..82ae428e71 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -2108,7 +2108,10 @@ pub fn test_recvif_ipv4() { } } -#[cfg(any(linux_android, target_os = "freebsd"))] +#[cfg(any( + all(linux_android, not(target_env = "uclibc")), + target_os = "freebsd" +))] #[cfg_attr(qemu, ignore)] #[test] pub fn test_recvif_ipv6() { diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index 87ad72a953..5b06a5c13d 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -501,7 +501,7 @@ fn test_dontfrag_opts() { } #[test] -#[cfg(any(linux_android, apple_targets))] +#[cfg(any(all(linux_android, not(target_env = "uclibc")), apple_targets))] // Disable the test under emulation because it fails in Cirrus-CI. Lack // of QEMU support is suspected. #[cfg_attr(qemu, ignore)] @@ -696,7 +696,7 @@ fn test_ts_clock_monotonic() { } #[test] -#[cfg(linux_android)] +#[cfg(all(linux_android, not(target_env = "uclibc")))] // Disable the test under emulation because it fails with ENOPROTOOPT in CI // on cross target. Lack of QEMU support is suspected. #[cfg_attr(qemu, ignore)]