Skip to content

Add resolv #4618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

// <resolv.h>
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed

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;
Comment on lines +2096 to +2106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to match the definitions linked at #4611: those have data as const and followed by an integer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also few arguments misplacements see above my comment and on linux it should be linked to libresolv.

pub fn res_send(msg: *const c_char, msglen: c_int, answer: *mut c_char, anslen: c_int)
-> c_int;
}

// LFS64 extensions
Expand Down