From 38a6cd5359d7130c4beceedd7011a775c497d5f8 Mon Sep 17 00:00:00 2001 From: auronandace Date: Tue, 3 Feb 2026 09:11:29 +0000 Subject: [PATCH] verify arpa_inet includes --- src/header/arpa_inet/cbindgen.toml | 19 ++++++++++++++++++- src/header/bits_socklen-t/cbindgen.toml | 12 ++++++++++++ src/header/bits_socklen-t/mod.rs | 1 + src/header/mod.rs | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/header/bits_socklen-t/cbindgen.toml create mode 100644 src/header/bits_socklen-t/mod.rs diff --git a/src/header/arpa_inet/cbindgen.toml b/src/header/arpa_inet/cbindgen.toml index ce0807a988..a493276286 100644 --- a/src/header/arpa_inet/cbindgen.toml +++ b/src/header/arpa_inet/cbindgen.toml @@ -1,5 +1,22 @@ -sys_includes = ["stddef.h", "sys/socket.h", "netinet/in.h"] +# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/arpa_inet.h.html +# +# Spec quotations relating to includes: +# - "The header shall define the in_port_t and in_addr_t types as described in and the socklen_t type as defined in ." +# - "The header shall define the in_addr structure as described in ." +# - "The header shall define the INET_ADDRSTRLEN [IP6]  and INET6_ADDRSTRLEN  macros as described in ." +# - "The header shall define the uint32_t and uint16_t types as described in ." +# - "Inclusion of the header may also make visible all symbols from and ." +# +# features.h included for #[deprecated] annotation +sys_includes = [ + "inttypes.h", + "netinet/in.h", + "features.h" +] include_guard = "_ARPA_INET_H" +after_includes = """ +#include // for socklen_t +""" language = "C" style = "Tag" no_includes = true diff --git a/src/header/bits_socklen-t/cbindgen.toml b/src/header/bits_socklen-t/cbindgen.toml new file mode 100644 index 0000000000..94a53c8954 --- /dev/null +++ b/src/header/bits_socklen-t/cbindgen.toml @@ -0,0 +1,12 @@ +sys_includes = [] +include_guard = "_RELIBC_BITS_SOCKLEN_T_H" +language = "C" +style = "type" +no_includes = true +cpp_compat = true +[export] +include = [ + "socklen_t" +] +[enum] +prefix_with_name = true diff --git a/src/header/bits_socklen-t/mod.rs b/src/header/bits_socklen-t/mod.rs new file mode 100644 index 0000000000..74de941e6c --- /dev/null +++ b/src/header/bits_socklen-t/mod.rs @@ -0,0 +1 @@ +pub type socklen_t = u32; diff --git a/src/header/mod.rs b/src/header/mod.rs index 1817eead88..df14b5be2f 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -8,6 +8,8 @@ pub mod assert; pub mod bits_locale_t; pub mod bits_pthread; pub mod bits_sched; +#[path = "bits_socklen-t/mod.rs"] +pub mod bits_socklen_t; // complex.h implemented in C // cpio.h implemented in C pub mod crypt;