2#include <cosmos/error/ApiError.hxx>
3#include <cosmos/proc/ptrace.hxx>
4#include <cosmos/utils.hxx>
6namespace cosmos::ptrace {
8std::optional<long> trace(
const Request req,
const ProcessID pid,
void *addr,
void *data) {
10 req == Request::PEEKDATA ||
11 req == Request::PEEKTEXT ||
12 req == Request::PEEKUSER;
20 const auto ret = ::ptrace(
21 static_cast<__ptrace_request
>(to_integral(req)),
22 to_integral(pid), addr, data);
30 cosmos_throw (ApiError(
"ptrace()"));
35 if (is_peek || req == Request::SECCOMP_GET_FILTER || req == Request::GET_SYSCALL_INFO) {
45 trace(Request::TRACEME, ProcessID{0},
nullptr,
nullptr);
void reset_errno()
Resets the currently set errno to indicate no error.
bool is_errno_set()
Checks whether currently an errno is set.