summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/SyscallUtils.h
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-15 21:46:23 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-22 22:14:30 +0100
commit9229ba0fe9b04a7eab116925ecdee4797815281d (patch)
tree2c9cb9724afebafb545f6e79cfcd62bb0c40f3c5 /Userland/Libraries/LibCore/SyscallUtils.h
parent27bc48e06cf54cb826fd8dd46edd9331650f3a63 (diff)
downloadserenity-9229ba0fe9b04a7eab116925ecdee4797815281d.zip
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
Diffstat (limited to 'Userland/Libraries/LibCore/SyscallUtils.h')
-rw-r--r--Userland/Libraries/LibCore/SyscallUtils.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibCore/SyscallUtils.h b/Userland/Libraries/LibCore/SyscallUtils.h
index 1c24efd9c2..5815fb67cd 100644
--- a/Userland/Libraries/LibCore/SyscallUtils.h
+++ b/Userland/Libraries/LibCore/SyscallUtils.h
@@ -26,6 +26,7 @@
#pragma once
+#include <AK/Debug.h>
#include <AK/LogStream.h>
#include <AK/StdLibExtras.h>
#include <errno.h>
@@ -41,10 +42,11 @@ inline int safe_syscall(Syscall syscall, Args&&... args)
for (;;) {
int sysret = syscall(forward<Args>(args)...);
if (sysret == -1) {
-#ifdef SAFE_SYSCALL_DEBUG
- int saved_errno = errno;
- dbg() << "Core::safe_syscall: " << sysret << " (" << saved_errno << ": " << strerror(saved_errno) << ")";
-#endif
+ if constexpr (debug_safe_syscall) {
+ int saved_errno = errno;
+ dbgln<debug_safe_syscall>("Core::safe_syscall: {} ({}: {})", sysret, saved_errno, strerror(saved_errno));
+ }
+
if (errno == EINTR)
continue;
ASSERT_NOT_REACHED();