From 11e8f42a1f7d4cfa4ad38132e18ad137275cbfa6 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Tue, 5 Aug 2025 16:26:39 +0200 Subject: [PATCH] Add resolv --- libc-test/semver/linux.txt | 6 ++++++ src/unix/linux_like/mod.rs | 44 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index a8806a36f4600..86e5baa885a1a 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -4218,6 +4218,12 @@ regmatch_t regoff_t remap_file_pages removexattr +res_init +res_mkquery +res_query +res_querydomain +res_search +res_send rlim64_t rlimit64 rtentry diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 6128cecbba5f0..ef7426df7a45f 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1263,6 +1263,11 @@ pub const PIPE_BUF: usize = 4096; pub const SI_LOAD_SHIFT: c_uint = 16; +// arpa/nameser.h +pub const T_A: c_int = 1; +pub const T_CNAME: c_int = 5; +pub const C_IN: c_int = 1; + // si_code values pub const SI_USER: c_int = 0; pub const SI_KERNEL: c_int = 0x80; @@ -2062,6 +2067,45 @@ extern "C" { pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int; pub fn setdomainname(name: *const c_char, len: size_t) -> c_int; + + // + #[allow(dead_code)] + pub fn res_init() -> c_int; + pub fn res_query( + dname: *const c_char, + class: c_int, + kind: c_int, + answer: *mut c_uchar, + anslen: c_int, + ) -> c_int; + pub fn res_search( + dname: *const c_char, + class: c_int, + kind: c_int, + answer: *mut c_uchar, + anslen: c_int, + ) -> c_int; + pub fn res_querydomain( + name: *const c_char, + domain: *const c_char, + class: c_int, + kind: c_int, + answer: *mut c_uchar, + anslen: c_int, + ) -> c_int; + pub fn res_mkquery( + op: c_int, + dname: *const c_char, + class: c_int, + kind: c_int, + data: *mut c_char, + newrr: *const c_void, + datalen: c_int, + buf: *mut c_char, + buflen: c_int, + ) -> c_int; + pub fn res_send(msg: *const c_char, msglen: c_int, answer: *mut c_char, anslen: c_int) + -> c_int; } // LFS64 extensions