relibc/header/netdb/redox.rs
1use crate::{
2 error::Errno,
3 fs::File,
4 header::{errno, fcntl},
5 io::Read,
6};
7use alloc::string::String;
8
9pub fn get_dns_server() -> Result<String, Errno> {
10 let mut string = String::new();
11 let mut file = File::open(c"/etc/net/dns".into(), fcntl::O_RDONLY)?;
12 file.read_to_string(&mut string)
13 .map_err(|_| Errno(errno::EIO).sync())?;
14
15 Ok(string)
16}