remove temporary RB_OPEN_DIAG open-failure trace

This commit is contained in:
Red Bear OS
2026-07-15 21:38:38 +09:00
parent f46e2a31a7
commit 9c106e3cea
+1 -45
View File
@@ -4,25 +4,6 @@ use core::{
sync::atomic::{AtomicU32, Ordering},
};
pub(crate) fn format_errno(errno: usize) -> [u8; 6] {
let mut buf = [0u8; 6];
let mut n = errno;
let mut idx = 5;
if n == 0 {
buf[5] = b'0';
return buf;
}
while n > 0 && idx > 0 {
buf[idx] = b'0' + (n % 10) as u8;
n /= 10;
idx -= 1;
}
let start = idx + 1;
let mut result = [0u8; 6];
result[..6 - start].copy_from_slice(&buf[start..]);
result
}
use ioslice::IoSlice;
use syscall::{
Call, CallFlags, EINVAL, ERESTART, StdFsCallKind, TimeSpec,
@@ -611,32 +592,7 @@ pub fn open<T: AsRef<str>>(path: T, flags: usize) -> Result<usize> {
let ns_fd = crate::current_namespace_fd()?;
let fcntl_flags = flags & syscall::O_FCNTL_MASK;
let posix_fd = openat_into_posix(ns_fd, path.as_ref(), flags, fcntl_flags);
if let Err(ref e) = posix_fd {
let p = path.as_ref();
let mut buf = [0u8; 256];
let prefix = b"RB_OPEN_DIAG err=";
let mut len = 0;
buf[..prefix.len()].copy_from_slice(prefix);
len += prefix.len();
let errno_bytes = format_errno(e.errno as usize);
buf[len..len + errno_bytes.len()].copy_from_slice(&errno_bytes);
len += errno_bytes.len();
buf[len] = b' ';
len += 1;
let pfx2 = b"path=";
buf[len..len + pfx2.len()].copy_from_slice(pfx2);
len += pfx2.len();
let copy = (p.len()).min(buf.len() - len - 1);
buf[len..len + copy].copy_from_slice(&p.as_bytes()[..copy]);
len += copy;
buf[len] = b'\n';
len += 1;
let _ = syscall::write(2, &buf[..len]);
}
let posix_fd = posix_fd?;
Ok(posix_fd)
openat_into_posix(ns_fd, path.as_ref(), flags, fcntl_flags)
}
pub fn openat<T: AsRef<str>>(
fd: usize,