From 5c68929aa1724867eec6b65c0ae50dc8a8d4c589 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 22 Apr 2019 18:44:45 +0200 Subject: Kernel: Add a systrace() syscall and implement /bin/strace using it. Calling systrace(pid) gives you a file descriptor with a stream of the syscalls made by a peer process. The process must be owned by the same UID who calls systrace(). :^) --- LibC/unistd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'LibC/unistd.cpp') diff --git a/LibC/unistd.cpp b/LibC/unistd.cpp index 19f02c034e..5cba9f33ae 100644 --- a/LibC/unistd.cpp +++ b/LibC/unistd.cpp @@ -16,6 +16,12 @@ extern "C" { +int systrace(pid_t pid) +{ + int rc = syscall(SC_systrace, pid); + __RETURN_WITH_ERRNO(rc, rc, -1); +} + int chown(const char* pathname, uid_t uid, gid_t gid) { int rc = syscall(SC_chown, pathname, uid, gid); -- cgit v1.2.3