Convert all println to log or todo
This commit is contained in:
@@ -1046,7 +1046,7 @@ pub unsafe extern "C" fn freeaddrinfo(res: *mut addrinfo) {
|
||||
} else if bai.ai_addrlen == mem::size_of::<sockaddr_in6>() as socklen_t {
|
||||
unsafe { Box::from_raw(bai.ai_addr as *mut sockaddr_in6) };
|
||||
} else {
|
||||
eprintln!("freeaddrinfo: unknown ai_addrlen {}", bai.ai_addrlen);
|
||||
todo_skip!(0, "freeaddrinfo: unknown ai_addrlen {}", bai.ai_addrlen);
|
||||
}
|
||||
}
|
||||
ai = bai.ai_next;
|
||||
|
||||
@@ -29,7 +29,7 @@ pub unsafe extern "C" fn pthread_cond_init(
|
||||
|
||||
if attr.clock != CLOCK_REALTIME {
|
||||
// As monotonic clock always smaller than realtime clock, this always result in instant timeout.
|
||||
println!("TODO: pthread_cond_init with monotonic clock");
|
||||
todo_skip!(0, "pthread_cond_init with monotonic clock");
|
||||
}
|
||||
|
||||
unsafe { cond.cast::<RlctCond>().write(RlctCond::new()) };
|
||||
|
||||
@@ -4,6 +4,6 @@ use crate::{header::sys_ioctl::sgttyb, platform::types::c_int};
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn gtty(fd: c_int, out: *mut sgttyb) -> c_int {
|
||||
eprintln!("unimplemented: gtty({}, {:p})", fd, out);
|
||||
todo_skip!(0, "gtty({}, {:p})", fd, out);
|
||||
-1
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ pub unsafe extern "C" fn fileno(stream: *mut FILE) -> c_int {
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn flockfile(file: *mut FILE) {
|
||||
if let Err(e) = unsafe { (*file).lock.lock() } {
|
||||
println!("RELIBC: flockfile error {}", e)
|
||||
todo_error!(0, e, "flockfile error")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,7 +819,7 @@ pub unsafe extern "C" fn ftrylockfile(file: *mut FILE) -> c_int {
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn funlockfile(file: *mut FILE) {
|
||||
if let Err(e) = unsafe { (*file).lock.unlock() } {
|
||||
println!("RELIBC: funlockfile error {}", e)
|
||||
todo_error!(0, e, "RELIBC: funlockfile error")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/abort.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn abort() -> ! {
|
||||
eprintln!("Abort");
|
||||
log::error!("Abort");
|
||||
intrinsics::abort();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,13 @@ pub(super) unsafe fn ioctl(fd: c_int, func: u8, buf: IoctlBuffer) -> Result<c_in
|
||||
},
|
||||
0xCE => unsafe { dev.read_write_ioctl::<drm_mode_fb_cmd2>(buf, MODE_GET_FB2) },
|
||||
_ => {
|
||||
eprintln!("unimplemented DRM ioctl({}, 0x{:02x}, {:?})", fd, func, buf);
|
||||
todo_skip!(
|
||||
0,
|
||||
"unimplemented DRM ioctl({}, 0x{:02x}, {:?})",
|
||||
fd,
|
||||
func,
|
||||
buf
|
||||
);
|
||||
Err(Errno(EINVAL))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ unsafe fn ioctl_inner(fd: c_int, request: c_ulong, out: *mut c_void) -> Result<c
|
||||
dup_write(fd, "flush", &queue)?;
|
||||
}
|
||||
TIOCSCTTY => {
|
||||
eprintln!("TODO: ioctl TIOCSCTTY");
|
||||
todo_skip!(0, "ioctl TIOCSCTTY");
|
||||
}
|
||||
TIOCGPGRP => {
|
||||
let pgrp = unsafe { &mut *(out as *mut pid_t) };
|
||||
@@ -154,19 +154,19 @@ unsafe fn ioctl_inner(fd: c_int, request: c_ulong, out: *mut c_void) -> Result<c
|
||||
dup_write(fd, "winsize", winsize)?;
|
||||
}
|
||||
TIOCGPTLCK => {
|
||||
eprintln!("TODO: ioctl TIOCGPTLCK");
|
||||
todo_skip!(0, "ioctl TIOCGPTLCK");
|
||||
}
|
||||
TIOCSPTLCK => {
|
||||
eprintln!("TODO: ioctl TIOCSPTLCK");
|
||||
todo_skip!(0, "ioctl TIOCSPTLCK");
|
||||
}
|
||||
TCSBRK => {
|
||||
eprintln!("TODO: ioctl TCSBRK");
|
||||
todo_skip!(0, "ioctl TCSBRK");
|
||||
}
|
||||
TCXONC => {
|
||||
eprintln!("TODO: ioctl TCXONC");
|
||||
todo_skip!(0, "ioctl TCXONC");
|
||||
}
|
||||
SIOCATMARK => {
|
||||
eprintln!("TODO: ioctl SIOCATMARK");
|
||||
todo_skip!(0, "ioctl SIOCATMARK");
|
||||
}
|
||||
_ => {
|
||||
// See https://docs.kernel.org/userspace-api/ioctl/ioctl-decoding.html for details
|
||||
|
||||
@@ -409,7 +409,7 @@ pub unsafe extern "C" fn vswprintf(
|
||||
) -> c_int {
|
||||
//TODO: implement vswprintf. This is not as simple as wprintf, since the output is not UTF-8
|
||||
// but instead is a wchar array.
|
||||
eprintln!("vswprintf not implemented");
|
||||
todo_skip!(0, "vswprintf not implemented");
|
||||
-1
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -57,9 +57,9 @@ macro_rules! todo_skip {
|
||||
// Recoverable error todo!(issue, fmt, err)
|
||||
#[macro_export]
|
||||
macro_rules! todo_error {
|
||||
($issue:expr, $($arg:tt)*, $err:expr) => {
|
||||
($issue:expr, $err:expr, $($arg:tt)*) => {
|
||||
if $issue != 0 {
|
||||
log::error!("TODO ({}{}): {}: {:?}", crate::macros::ISSUE_URL, $issue, format_args!($($arg)*), $err)
|
||||
log::error!("TODO ({}{}): {}: {}", crate::macros::ISSUE_URL, $issue, format_args!($($arg)*), $err)
|
||||
} else {
|
||||
log::error!("TODO: {}: {:?}", format_args!($($arg)*), $err)
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ pub unsafe fn init() {
|
||||
|
||||
#[cfg(feature = "no_trace")]
|
||||
if trace_warn {
|
||||
log::error!(
|
||||
"the 'no_trace' feature is enabled but LOG_LEVEL=TRACE, there will be no trace logs"
|
||||
log::warn!(
|
||||
"The 'no_trace' feature is enabled but RELIBC_LOG_LEVEL=TRACE, there will be no trace logs"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,11 @@ fn epoll_to_event_flags(epoll: c_uint) -> syscall::EventFlags {
|
||||
event_flags |= syscall::EventFlags::EVENT_WRITE;
|
||||
}
|
||||
|
||||
/*TODO: support more EPOLL flags
|
||||
/*TODO: support more EPOLL flags */
|
||||
let unsupported = !(EPOLLIN | EPOLLOUT);
|
||||
if epoll & unsupported != 0 {
|
||||
eprintln!("epoll unsupported flags 0x{:X}", epoll & unsupported);
|
||||
log::trace!("epoll unsupported flags 0x{:X}", epoll & unsupported);
|
||||
}
|
||||
*/
|
||||
|
||||
event_flags
|
||||
}
|
||||
|
||||
+25
-34
@@ -218,11 +218,7 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
unsafe fn clock_settime(clk_id: clockid_t, tp: *const timespec) -> Result<()> {
|
||||
// TODO
|
||||
eprintln!(
|
||||
"relibc clock_settime({}, {:p}): not implemented",
|
||||
clk_id, tp
|
||||
);
|
||||
todo_skip!(0, "clock_settime({}, {:p}): not implemented", clk_id, tp);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -511,11 +507,7 @@ impl Pal for Sys {
|
||||
|
||||
fn getgroups(list: Out<[gid_t]>) -> Result<c_int> {
|
||||
// TODO
|
||||
eprintln!(
|
||||
"relibc getgroups({}, {:p}): not implemented",
|
||||
list.len(),
|
||||
list
|
||||
);
|
||||
todo_skip!(0, "getgroups({}, {:p}): not implemented", list.len(), list);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -536,8 +528,7 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
fn getpriority(which: c_int, who: id_t) -> Result<c_int> {
|
||||
// TODO
|
||||
eprintln!("getpriority({}, {}): not implemented", which, who);
|
||||
todo_skip!(0, "getpriority({}, {}): not implemented", which, who);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -599,11 +590,7 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
fn getrlimit(resource: c_int, mut rlim: Out<rlimit>) -> Result<()> {
|
||||
//TODO
|
||||
eprintln!(
|
||||
"relibc getrlimit({}, {:p}): not implemented",
|
||||
resource, rlim
|
||||
);
|
||||
todo_skip!(0, "getrlimit({}, {:p}): not implemented", resource, rlim);
|
||||
rlim.write(rlimit {
|
||||
rlim_cur: RLIM_INFINITY,
|
||||
rlim_max: RLIM_INFINITY,
|
||||
@@ -612,17 +599,12 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
unsafe fn setrlimit(resource: c_int, rlim: *const rlimit) -> Result<()> {
|
||||
// TODO
|
||||
eprintln!(
|
||||
"relibc setrlimit({}, {:p}): not implemented",
|
||||
resource, rlim
|
||||
);
|
||||
todo_skip!(0, "setrlimit({}, {:p}): not implemented", resource, rlim);
|
||||
Err(Errno(EPERM))
|
||||
}
|
||||
|
||||
fn getrusage(who: c_int, r_usage: Out<rusage>) -> Result<()> {
|
||||
//TODO
|
||||
eprintln!("relibc getrusage({}, {:p}): not implemented", who, r_usage);
|
||||
todo_skip!(0, "getrusage({}, {:p}): not implemented", who, r_usage);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -825,9 +807,12 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
unsafe fn msync(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> {
|
||||
eprintln!(
|
||||
"relibc msync({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr, len, flags
|
||||
todo_skip!(
|
||||
0,
|
||||
"msync({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr,
|
||||
len,
|
||||
flags
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
/* TODO
|
||||
@@ -862,9 +847,12 @@ impl Pal for Sys {
|
||||
}
|
||||
|
||||
unsafe fn madvise(addr: *mut c_void, len: usize, flags: c_int) -> Result<()> {
|
||||
eprintln!(
|
||||
"relibc madvise({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr, len, flags
|
||||
todo_skip!(
|
||||
0,
|
||||
"madvise({:p}, 0x{:x}, 0x{:x}): not implemented",
|
||||
addr,
|
||||
len,
|
||||
flags
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
@@ -1112,7 +1100,7 @@ impl Pal for Sys {
|
||||
|
||||
unsafe fn setgroups(size: size_t, list: *const gid_t) -> Result<()> {
|
||||
// TODO
|
||||
eprintln!("relibc setgroups({}, {:p}): not implemented", size, list);
|
||||
todo_skip!(0, "setgroups({}, {:p}): not implemented", size, list);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -1123,9 +1111,12 @@ impl Pal for Sys {
|
||||
|
||||
fn setpriority(which: c_int, who: id_t, prio: c_int) -> Result<()> {
|
||||
// TODO
|
||||
eprintln!(
|
||||
"relibc setpriority({}, {}, {}): not implemented",
|
||||
which, who, prio
|
||||
todo_skip!(
|
||||
0,
|
||||
"setpriority({}, {}, {}): not implemented",
|
||||
which,
|
||||
who,
|
||||
prio
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ impl PalSignal for Sys {
|
||||
// TODO: setitimer is no longer part of POSIX and should not be implemented in Redox
|
||||
// Change the platform-independent implementation to use POSIX timers.
|
||||
// For Redox, the timer should probably use "/scheme/time"
|
||||
eprintln!("relibc: setitimer not implemented");
|
||||
todo_skip!(0, "setitimer not implemented");
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ unsafe fn bind_or_connect(
|
||||
}
|
||||
}
|
||||
AF_UNIX => {
|
||||
eprintln!("bind/connect with AF_UNIX were replaced with SYS_CALL.");
|
||||
log::warn!("bind/connect with AF_UNIX were replaced with SYS_CALL.");
|
||||
return Err(Errno(EAFNOSUPPORT));
|
||||
}
|
||||
_ => return Err(Errno(EAFNOSUPPORT)),
|
||||
@@ -576,9 +576,10 @@ impl PalSocket for Sys {
|
||||
CallFlags::empty(),
|
||||
&[SocketCall::Unbind as u64],
|
||||
) {
|
||||
eprintln!(
|
||||
"bind: CRITICAL: failed to unbind socket after a failed transaction: {:?}",
|
||||
unbind_error
|
||||
todo_error!(
|
||||
0,
|
||||
unbind_error,
|
||||
"bind: CRITICAL: failed to unbind socket after a failed transaction"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -745,9 +746,14 @@ impl PalSocket for Sys {
|
||||
_ => (),
|
||||
}
|
||||
|
||||
eprintln!(
|
||||
todo_skip!(
|
||||
0,
|
||||
"getsockopt({}, {}, {}, {:p}, {:p})",
|
||||
socket, level, option_name, option_value, option_len_ptr
|
||||
socket,
|
||||
level,
|
||||
option_name,
|
||||
option_value,
|
||||
option_len_ptr
|
||||
);
|
||||
Err(Errno(ENOSYS))
|
||||
}
|
||||
@@ -1042,9 +1048,14 @@ impl PalSocket for Sys {
|
||||
_ => (),
|
||||
}
|
||||
|
||||
eprintln!(
|
||||
todo_skip!(
|
||||
0,
|
||||
"setsockopt({}, {}, {}, {:p}, {}) - unknown option",
|
||||
socket, level, option_name, option_value, option_len
|
||||
socket,
|
||||
level,
|
||||
option_name,
|
||||
option_value,
|
||||
option_len
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -1113,7 +1124,8 @@ impl PalSocket for Sys {
|
||||
Ok(())
|
||||
}
|
||||
_ => unsafe {
|
||||
eprintln!(
|
||||
todo_skip!(
|
||||
0,
|
||||
"socketpair({}, {}, {}, {:p})",
|
||||
domain,
|
||||
kind,
|
||||
|
||||
+2
-2
@@ -109,8 +109,8 @@ pub unsafe fn futex_wait_ptr<T: FutexTy>(
|
||||
Ok(()) | Err(Errno(EINTR)) => FutexWaitResult::Waited,
|
||||
Err(Errno(EAGAIN)) => FutexWaitResult::Stale,
|
||||
Err(Errno(ETIMEDOUT)) if deadline_opt.is_some() => FutexWaitResult::TimedOut,
|
||||
Err(other) => {
|
||||
eprintln!("futex failed: {}", other.0);
|
||||
Err(err) => {
|
||||
todo_error!(0, err, "futex failed");
|
||||
FutexWaitResult::Waited
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,15 +62,15 @@ impl RlctMutex {
|
||||
})
|
||||
}
|
||||
pub fn prioceiling(&self) -> Result<c_int, Errno> {
|
||||
println!("TODO: Implement pthread_getprioceiling");
|
||||
todo_skip!(0, "pthread_getprioceiling: not implemented");
|
||||
Ok(0)
|
||||
}
|
||||
pub fn replace_prioceiling(&self, _: c_int) -> Result<c_int, Errno> {
|
||||
println!("TODO: Implement pthread_setprioceiling");
|
||||
todo_skip!(0, "pthread_setprioceiling: not implemented");
|
||||
Ok(0)
|
||||
}
|
||||
pub fn make_consistent(&self) -> Result<(), Errno> {
|
||||
println!("TODO: Implement robust mutexes");
|
||||
todo_skip!(0, "pthread robust mutexes: not implemented");
|
||||
Ok(())
|
||||
}
|
||||
fn lock_inner(&self, deadline: Option<×pec>) -> Result<(), Errno> {
|
||||
|
||||
Reference in New Issue
Block a user