diff options
author | Itamar <itamar8910@gmail.com> | 2020-03-28 11:47:16 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-28 18:27:18 +0100 |
commit | 6b74d38aab2f9479a8b4f3b9ebfb28dde166a701 (patch) | |
tree | e12ed991d2ffa9dda1bd7e44716b90bd0632aebe /AK | |
parent | c9396be83f67edfbd07a5cd7a5b34e6be7aa81ac (diff) | |
download | serenity-6b74d38aab2f9479a8b4f3b9ebfb28dde166a701.zip |
Kernel: Add 'ptrace' syscall
This commit adds a basic implementation of
the ptrace syscall, which allows one process
(the tracer) to control another process (the tracee).
While a process is being traced, it is stopped whenever a signal is
received (other than SIGCONT).
The tracer can start tracing another thread with PT_ATTACH,
which causes the tracee to stop.
From there, the tracer can use PT_CONTINUE
to continue the execution of the tracee,
or use other request codes (which haven't been implemented yet)
to modify the state of the tracee.
Additional request codes are PT_SYSCALL, which causes the tracee to
continue exection but stop at the next entry or exit from a syscall,
and PT_GETREGS which fethces the last saved register set of the tracee
(can be used to inspect syscall arguments and return value).
A special request code is PT_TRACE_ME, which is issued by the tracee
and causes it to stop when it calls execve and wait for the
tracer to attach.
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Types.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/AK/Types.h b/AK/Types.h index aab08774e5..381b3f8a68 100644 --- a/AK/Types.h +++ b/AK/Types.h @@ -70,6 +70,8 @@ typedef i16 int16_t; typedef i32 int32_t; typedef i64 int64_t; +typedef int pid_t; + #else # include <stdint.h> # include <sys/types.h> @@ -84,9 +86,9 @@ typedef int16_t i16; typedef int32_t i32; typedef int64_t i64; -#ifdef __ptrdiff_t +# ifdef __ptrdiff_t typedef __PTRDIFF_TYPE__ __ptrdiff_t; -#endif +# endif #endif @@ -115,4 +117,6 @@ inline constexpr size_t align_up_to(const size_t value, const size_t alignment) return (value + (alignment - 1)) & ~(alignment - 1); } -enum class TriState : u8 { False, True, Unknown }; +enum class TriState : u8 { False, + True, + Unknown }; |