summaryrefslogtreecommitdiff
path: root/LibC/unistd.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-22 18:44:45 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-22 18:44:45 +0200
commit5c68929aa1724867eec6b65c0ae50dc8a8d4c589 (patch)
treeee997e95163743f7c92354f87f5fe722f31b1031 /LibC/unistd.cpp
parent6693cfb26acf9d5b53d090be309956456f546239 (diff)
downloadserenity-5c68929aa1724867eec6b65c0ae50dc8a8d4c589.zip
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(). :^)
Diffstat (limited to 'LibC/unistd.cpp')
-rw-r--r--LibC/unistd.cpp6
1 files changed, 6 insertions, 0 deletions
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);