diff --git a/Libraries/LibCore/CSyscallUtils.h b/Libraries/LibCore/CSyscallUtils.h index 9a16901d11..cb65f3f702 100644 --- a/Libraries/LibCore/CSyscallUtils.h +++ b/Libraries/LibCore/CSyscallUtils.h @@ -1,18 +1,21 @@ #pragma once -#include -#include -#include +#include #include +#include +#include +#include namespace CSyscallUtils { -template -inline int safe_syscall(Syscall syscall, Args&& ... args) { +template +inline int safe_syscall(Syscall syscall, Args&&... args) +{ for (;;) { int sysret = syscall(forward(args)...); if (sysret == -1) { - dbgprintf("CSafeSyscall: %d (%d: %s)\n", sysret, errno, strerror(errno)); + int saved_errno = errno; + dbg() << "CSafeSyscall: " << sysret << " (" << saved_errno << ": " << strerror(saved_errno) << ")"; if (errno == EINTR) continue; ASSERT_NOT_REACHED(); @@ -22,4 +25,3 @@ inline int safe_syscall(Syscall syscall, Args&& ... args) { } } -