Skip to content
Snippets Groups Projects
Commit 716ea87b authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Format

parent f3a832ad
No related branches found
No related tags found
No related merge requests found
Pipeline #1317 failed
...@@ -865,23 +865,24 @@ pub unsafe extern "C" fn getservent() -> *const servent { ...@@ -865,23 +865,24 @@ pub unsafe extern "C" fn getservent() -> *const servent {
let mut iter = r.split_whitespace(); let mut iter = r.split_whitespace();
let mut serv_name = match iter.next() { let mut serv_name = match iter.next() {
Some(serv_name) => serv_name.as_bytes().to_vec(), Some(serv_name) => serv_name.as_bytes().to_vec(),
None => continue None => continue,
}; };
serv_name.push(b'\0'); serv_name.push(b'\0');
let port_proto = match iter.next() { let port_proto = match iter.next() {
Some(port_proto) => port_proto, Some(port_proto) => port_proto,
None => continue None => continue,
}; };
let mut split = port_proto.split("/"); let mut split = port_proto.split("/");
let mut port = match split.next() { let mut port = match split.next() {
Some(port) => port.as_bytes().to_vec(), Some(port) => port.as_bytes().to_vec(),
None => continue None => continue,
}; };
port.push(b'\0'); port.push(b'\0');
SERV_PORT = Some(htons(atoi(port.as_mut_slice().as_mut_ptr() as *mut i8) as u16) as u32 as i32); SERV_PORT =
Some(htons(atoi(port.as_mut_slice().as_mut_ptr() as *mut i8) as u16) as u32 as i32);
let mut proto = match split.next() { let mut proto = match split.next() {
Some(proto) => proto.as_bytes().to_vec(), Some(proto) => proto.as_bytes().to_vec(),
None => continue None => continue,
}; };
proto.push(b'\0'); proto.push(b'\0');
...@@ -922,7 +923,7 @@ pub unsafe extern "C" fn getservent() -> *const servent { ...@@ -922,7 +923,7 @@ pub unsafe extern "C" fn getservent() -> *const servent {
if SERV_STAYOPEN == 0 { if SERV_STAYOPEN == 0 {
endservent(); endservent();
} }
break &SERV_ENTRY as *const servent break &SERV_ENTRY as *const servent;
} }
} }
......
use core::{mem, ptr};
use core::sync::atomic::AtomicBool; use core::sync::atomic::AtomicBool;
use core::{mem, ptr};
use header::errno; use header::errno;
use header::fcntl::*; use header::fcntl::*;
...@@ -67,16 +67,19 @@ pub unsafe fn _fdopen(fd: c_int, mode: *const c_char) -> Option<*mut FILE> { ...@@ -67,16 +67,19 @@ pub unsafe fn _fdopen(fd: c_int, mode: *const c_char) -> Option<*mut FILE> {
if f.is_null() { if f.is_null() {
None None
} else { } else {
ptr::write(f, FILE { ptr::write(
flags: flags, f,
read: None, FILE {
write: None, flags: flags,
fd: fd, read: None,
buf: vec![0u8; BUFSIZ + UNGET], write: None,
buf_char: -1, fd: fd,
unget: UNGET, buf: vec![0u8; BUFSIZ + UNGET],
lock: AtomicBool::new(false) buf_char: -1,
}); unget: UNGET,
lock: AtomicBool::new(false),
},
);
Some(f) Some(f)
} }
} }
......
...@@ -50,24 +50,24 @@ pub extern "C" fn access(path: *const c_char, mode: c_int) -> c_int { ...@@ -50,24 +50,24 @@ pub extern "C" fn access(path: *const c_char, mode: c_int) -> c_int {
#[no_mangle] #[no_mangle]
pub extern "C" fn alarm(seconds: c_uint) -> c_uint { pub extern "C" fn alarm(seconds: c_uint) -> c_uint {
// let mut timer = sys_time::itimerval { // let mut timer = sys_time::itimerval {
// it_value: sys_time::timeval { // it_value: sys_time::timeval {
// tv_sec: seconds as time_t, // tv_sec: seconds as time_t,
// tv_usec: 0, // tv_usec: 0,
// }, // },
// ..Default::default() // ..Default::default()
// }; // };
// let errno_backup = unsafe { platform::errno }; // let errno_backup = unsafe { platform::errno };
// let secs = if sys_time::setitimer(sys_time::ITIMER_REAL, &timer, &mut timer) < 0 { // let secs = if sys_time::setitimer(sys_time::ITIMER_REAL, &timer, &mut timer) < 0 {
// 0 // 0
// } else { // } else {
// timer.it_value.tv_sec as c_uint + if timer.it_value.tv_usec > 0 { 1 } else { 0 } // timer.it_value.tv_sec as c_uint + if timer.it_value.tv_usec > 0 { 1 } else { 0 }
// }; // };
// unsafe { // unsafe {
// platform::errno = errno_backup; // platform::errno = errno_backup;
// } // }
// //
// secs // secs
0 0
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment