The system call getaddrbyname is introduced and expects an array of u8 with the size of in_addr or in6_addr. The result of the DNS request is stored in the array.
Example:
use hermit_abi::in_addr;
let c_string = std::ffi::CString::new("rust-lang.org").expect("CString::new failed");
let name = c_string.into_raw();
let mut inaddr: in_addr = Default::default();
let _ = unsafe {
hermit_abi::getaddrbyname(
name,
&mut inaddr as *mut _ as *mut u8,
std::mem::size_of::<in_addr>(),
)
};
// retake pointer to free memory
let _ = CString::from_raw(name);
The system call
getaddrbyname
is introduced and expects an array of u8 with the size of in_addr or in6_addr. The result of the DNS request is stored in the array.Example:
This PR depends on hermit-os/kernel#1211