summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibCore/System.cpp8
-rw-r--r--Userland/Libraries/LibCore/System.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp
index 197995e034..5cbae05735 100644
--- a/Userland/Libraries/LibCore/System.cpp
+++ b/Userland/Libraries/LibCore/System.cpp
@@ -8,7 +8,6 @@
#include <AK/String.h>
#include <LibCore/System.h>
#include <LibSystem/syscall.h>
-#include <cstring>
#include <fcntl.h>
#include <stdarg.h>
#include <sys/ioctl.h>
@@ -107,6 +106,13 @@ ErrorOr<void> mount(int source_fd, StringView target, StringView fs_type, int fl
HANDLE_SYSCALL_RETURN_VALUE("mount", rc, {});
}
+ErrorOr<long> ptrace(int request, pid_t tid, void* address, void* data)
+{
+ auto rc = ::ptrace(request, tid, address, data);
+ if (rc < 0)
+ return Error::from_syscall("ptrace"sv, -errno);
+ return rc;
+}
#endif
ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action)
diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h
index 8adef7d2f8..92609212b8 100644
--- a/Userland/Libraries/LibCore/System.h
+++ b/Userland/Libraries/LibCore/System.h
@@ -29,6 +29,7 @@ ErrorOr<int> recvfd(int sockfd, int options);
ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf);
ErrorOr<void> setgroups(Span<gid_t const>);
ErrorOr<void> mount(int source_fd, StringView target, StringView fs_type, int flags);
+ErrorOr<long> ptrace(int request, pid_t tid, void* address, void* data);
#endif
ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action);