From 1c77f80a94ddfa72b539102be95f4543d1306a19 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Sat, 11 May 2024 01:51:07 +0300 Subject: [PATCH 1/4] Add IN6ADDR_ANY_INIT, IN6ADDR_LOOPBACK_INIT, in6addr_any, in6addr_loopback (backport ) [ move constants to the align module to support old rustc - Trevor ] (cherry picked from commit 8db9bc7059af69dcde2f6c99892df11a06bfc0e8) --- libc-test/semver/unix.txt | 4 ++++ src/unix/align.rs | 8 ++++++++ src/unix/mod.rs | 5 +++++ src/unix/no_align.rs | 10 ++++++++++ 4 files changed, 27 insertions(+) diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 03248dfec58c7..bb8e319def299 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -152,6 +152,8 @@ IF_NAMESIZE IGNBRK IGNCR IGNPAR +IN6ADDR_ANY_INIT +IN6ADDR_LOOPBACK_INIT INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK @@ -586,6 +588,8 @@ hstrerror if_indextoname if_nametoindex in6_addr +in6addr_any +in6addr_loopback in_addr in_addr_t in_port_t diff --git a/src/unix/align.rs b/src/unix/align.rs index 4fdba9a6aba69..2e7c954ccff7a 100644 --- a/src/unix/align.rs +++ b/src/unix/align.rs @@ -4,3 +4,11 @@ s! { pub s6_addr: [u8; 16], } } + +pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], +}; + +pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], +}; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 8b3d988ae38ae..6bab825b0449b 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -313,6 +313,11 @@ pub const ATF_PERM: ::c_int = 0x04; pub const ATF_PUBL: ::c_int = 0x08; pub const ATF_USETRAILERS: ::c_int = 0x10; +extern "C" { + pub static in6addr_loopback: in6_addr; + pub static in6addr_any: in6_addr; +} + cfg_if! { if #[cfg(any(target_os = "l4re", target_os = "espidf"))] { // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM diff --git a/src/unix/no_align.rs b/src/unix/no_align.rs index f6b9f4c12d4ba..b435d72aa7db0 100644 --- a/src/unix/no_align.rs +++ b/src/unix/no_align.rs @@ -4,3 +4,13 @@ s! { __align: [u32; 0], } } + +pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], + __align: [0u32; 0], +}; + +pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + __align: [0u32; 0], +}; From 33ff229a6760cb529d479684912e7be240e9d0e1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 26 Jul 2024 11:49:17 +0200 Subject: [PATCH 2/4] hurd: Add missing struct __timeval for 64bit support This is the same as linux_like/linux/gnu's __timeval for ut_tv for 64bit architectures. (backport ) (cherry picked from commit c8f2b3c9599affd8d571c244d6f61304a3fded0c) --- src/unix/hurd/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 71f1ac8d98c22..ad422fe718349 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -450,6 +450,11 @@ s! { pub tv_nsec: __syscall_slong_t, } + pub struct __timeval { + pub tv_sec: i32, + pub tv_usec: i32, + } + pub struct __locale_data { pub _address: u8, } From 244f752c2bbff0fd7417cfc028191903bab55da3 Mon Sep 17 00:00:00 2001 From: Nathaniel Date: Fri, 16 Aug 2024 17:33:51 -0400 Subject: [PATCH 3/4] Add missing `NFT_CT_*` constants (backport ) (cherry picked from commit cd63e38273565554d6d4628e13c30851bdc9b7ad) --- libc-test/semver/android.txt | 8 ++++++++ libc-test/semver/linux-gnu.txt | 7 +++++++ src/unix/linux_like/android/mod.rs | 8 ++++++++ src/unix/linux_like/linux/mod.rs | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 945c53e7e0651..ddd651da0d6df 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1503,11 +1503,16 @@ NFT_CMP_LT NFT_CMP_LTE NFT_CMP_NEQ NFT_CONTINUE +NFT_CT_AVGPKT NFT_CT_BYTES NFT_CT_DIRECTION NFT_CT_DST +NFT_CT_DST_IP +NFT_CT_DST_IP6 +NFT_CT_EVENTMASK NFT_CT_EXPIRATION NFT_CT_HELPER +NFT_CT_ID NFT_CT_L3PROTOCOL NFT_CT_LABELS NFT_CT_MARK @@ -1517,8 +1522,11 @@ NFT_CT_PROTO_DST NFT_CT_PROTO_SRC NFT_CT_SECMARK NFT_CT_SRC +NFT_CT_SRC_IP +NFT_CT_SRC_IP6 NFT_CT_STATE NFT_CT_STATUS +NFT_CT_ZONE NFT_DATA_RESERVED_MASK NFT_DATA_VALUE NFT_DATA_VALUE_MAXLEN diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 6fa88e6c77927..60ba5f62673f7 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -191,9 +191,13 @@ NFT_CMP_LT NFT_CMP_LTE NFT_CMP_NEQ NFT_CONTINUE +NFT_CT_AVGPKT NFT_CT_BYTES NFT_CT_DIRECTION NFT_CT_DST +NFT_CT_DST_IP +NFT_CT_DST_IP6 +NFT_CT_EVENTMASK NFT_CT_EXPIRATION NFT_CT_HELPER NFT_CT_L3PROTOCOL @@ -205,8 +209,11 @@ NFT_CT_PROTO_DST NFT_CT_PROTO_SRC NFT_CT_SECMARK NFT_CT_SRC +NFT_CT_SRC_IP +NFT_CT_SRC_IP6 NFT_CT_STATE NFT_CT_STATUS +NFT_CT_ZONE NFT_DATA_RESERVED_MASK NFT_DATA_VALUE NFT_DATA_VALUE_MAXLEN diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 2e2d25903e539..a8e935967c132 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -2572,6 +2572,14 @@ pub const NFT_CT_PROTO_DST: ::c_int = 12; pub const NFT_CT_LABELS: ::c_int = 13; pub const NFT_CT_PKTS: ::c_int = 14; pub const NFT_CT_BYTES: ::c_int = 15; +pub const NFT_CT_AVGPKT: ::c_int = 16; +pub const NFT_CT_ZONE: ::c_int = 17; +pub const NFT_CT_EVENTMASK: ::c_int = 18; +pub const NFT_CT_SRC_IP: ::c_int = 19; +pub const NFT_CT_DST_IP: ::c_int = 20; +pub const NFT_CT_SRC_IP6: ::c_int = 21; +pub const NFT_CT_DST_IP6: ::c_int = 22; +pub const NFT_CT_ID: ::c_int = 23; pub const NFT_LIMIT_PKTS: ::c_int = 0; pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 779faa81ff16e..5d2505a1b2f26 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -3980,6 +3980,13 @@ pub const NFT_CT_PROTO_DST: ::c_int = 12; pub const NFT_CT_LABELS: ::c_int = 13; pub const NFT_CT_PKTS: ::c_int = 14; pub const NFT_CT_BYTES: ::c_int = 15; +pub const NFT_CT_AVGPKT: ::c_int = 16; +pub const NFT_CT_ZONE: ::c_int = 17; +pub const NFT_CT_EVENTMASK: ::c_int = 18; +pub const NFT_CT_SRC_IP: ::c_int = 19; +pub const NFT_CT_DST_IP: ::c_int = 20; +pub const NFT_CT_SRC_IP6: ::c_int = 21; +pub const NFT_CT_DST_IP6: ::c_int = 22; pub const NFT_LIMIT_PKTS: ::c_int = 0; pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; From f90afeff6329792c2578ba174e50e876c925598e Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 17 Aug 2024 20:43:41 +0100 Subject: [PATCH 4/4] adding mq_notify glibc wrapper for SYS_mq_notify syscall. (backport ) (cherry picked from commit 99fb76f8e327a028f087fec55a787e8361a349e0) --- libc-test/semver/linux-gnu.txt | 1 + src/unix/linux_like/linux/gnu/mod.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 60ba5f62673f7..821443c6c385d 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -657,6 +657,7 @@ malloc_info malloc_trim malloc_usable_size mallopt +mq_notify nl_mmap_hdr nl_mmap_req nl_pktinfo diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index d6e5eb69c7fbb..f206693d4af71 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1541,6 +1541,8 @@ extern "C" { // Added in `glibc` 2.34 pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn mq_notify(mqdes: ::mqd_t, sevp: *const ::sigevent) -> ::c_int; } cfg_if! {