summaryrefslogtreecommitdiff
path: root/Kernel/Process.h
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 /Kernel/Process.h
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 'Kernel/Process.h')
-rw-r--r--Kernel/Process.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 90b0fc9108..9ade3ef64b 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -18,6 +18,7 @@ class FileDescriptor;
class PageDirectory;
class Region;
class VMObject;
+class ProcessTracer;
void kgettimeofday(timeval&);
@@ -175,6 +176,7 @@ public:
int sys$restore_signal_mask(dword mask);
int sys$create_thread(int(*)(void*), void*);
int sys$rename(const char* oldpath, const char* newpath);
+ int sys$systrace(pid_t);
int sys$create_shared_buffer(pid_t peer_pid, int, void** buffer);
void* sys$get_shared_buffer(int shared_buffer_id);
@@ -194,6 +196,9 @@ public:
const Vector<Retained<Region>>& regions() const { return m_regions; }
void dump_regions();
+ ProcessTracer* tracer() { return m_tracer.ptr(); }
+ ProcessTracer& ensure_tracer();
+
dword m_ticks_in_user { 0 };
dword m_ticks_in_kernel { 0 };
@@ -318,6 +323,8 @@ private:
unsigned m_syscall_count { 0 };
+ RetainPtr<ProcessTracer> m_tracer;
+
Lock m_big_lock;
};