std.os.linux: add ptrace

This commit is contained in:
Andrew Kelley 2022-01-14 18:03:59 -07:00
parent c641af3cba
commit ee693bfe04

View File

@ -1820,6 +1820,23 @@ pub fn seccomp(operation: u32, flags: u32, args: ?*const anyopaque) usize {
return syscall3(.seccomp, operation, flags, @ptrToInt(args));
}
pub fn ptrace(
req: u32,
pid: pid_t,
addr: usize,
data: usize,
addr2: usize,
) usize {
return syscall5(
.ptrace,
req,
@bitCast(usize, @as(isize, pid)),
addr,
data,
addr2,
);
}
pub const E = switch (native_arch) {
.mips, .mipsel => @import("linux/errno/mips.zig").E,
.sparc, .sparcel, .sparc64 => @import("linux/errno/sparc.zig").E,
@ -5721,3 +5738,40 @@ pub const AUDIT = struct {
}
};
};
pub const PTRACE = struct {
pub const TRACEME = 0;
pub const PEEKTEXT = 1;
pub const PEEKDATA = 2;
pub const PEEKUSER = 3;
pub const POKETEXT = 4;
pub const POKEDATA = 5;
pub const POKEUSER = 6;
pub const CONT = 7;
pub const KILL = 8;
pub const SINGLESTEP = 9;
pub const GETREGS = 12;
pub const SETREGS = 13;
pub const GETFPREGS = 14;
pub const SETFPREGS = 15;
pub const ATTACH = 16;
pub const DETACH = 17;
pub const GETFPXREGS = 18;
pub const SETFPXREGS = 19;
pub const SYSCALL = 24;
pub const SETOPTIONS = 0x4200;
pub const GETEVENTMSG = 0x4201;
pub const GETSIGINFO = 0x4202;
pub const SETSIGINFO = 0x4203;
pub const GETREGSET = 0x4204;
pub const SETREGSET = 0x4205;
pub const SEIZE = 0x4206;
pub const INTERRUPT = 0x4207;
pub const LISTEN = 0x4208;
pub const PEEKSIGINFO = 0x4209;
pub const GETSIGMASK = 0x420a;
pub const SETSIGMASK = 0x420b;
pub const SECCOMP_GET_FILTER = 0x420c;
pub const SECCOMP_GET_METADATA = 0x420d;
pub const GET_SYSCALL_INFO = 0x420e;
};