Avoid computation of log message arguments in syscall handler

This commit is contained in:
LI Qing
2024-05-09 10:11:06 +08:00
committed by Tate, Hongliang Tian
parent da5873e990
commit 98a2e623e2
2 changed files with 10 additions and 8 deletions

View File

@ -568,12 +568,14 @@ pub fn syscall_dispatch(
#[macro_export]
macro_rules! log_syscall_entry {
($syscall_name: tt) => {
let syscall_name_str = stringify!($syscall_name);
let pid = $crate::current!().pid();
let tid = $crate::current_thread!().tid();
info!(
"[pid={}][tid={}][id={}][{}]",
pid, tid, $syscall_name, syscall_name_str
);
if log_enabled!(log::Level::Info) {
let syscall_name_str = stringify!($syscall_name);
let pid = $crate::current!().pid();
let tid = $crate::current_thread!().tid();
info!(
"[pid={}][tid={}][id={}][{}]",
pid, tid, $syscall_name, syscall_name_str
);
}
};
}