authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-14 18:03:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-21 16:25:25-07:00
log4624c635139d7da85a6ee1310adafc3b6ed5840a
tree100e583550bcde44e13b77c572440e6300e43ff0
parent131cbcbdac353477af9ee119a735397ae993a2c4

std.os.linux: add ptrace


1 files changed, 54 insertions(+), 0 deletions(-)

lib/std/os/linux.zig+54
......@@ -1663,6 +1663,23 @@ pub fn perf_event_open(
16631663 );
16641664}
16651665
1666pub fn ptrace(
1667 req: u32,
1668 pid: pid_t,
1669 addr: usize,
1670 data: usize,
1671 addr2: usize,
1672) usize {
1673 return syscall5(
1674 .ptrace,
1675 req,
1676 @bitCast(usize, @as(isize, pid)),
1677 addr,
1678 data,
1679 addr2,
1680 );
1681}
1682
16661683pub const E = switch (native_arch) {
16671684 .mips, .mipsel => @import("linux/errno/mips.zig").E,
16681685 .sparc, .sparcel, .sparcv9 => @import("linux/errno/sparc.zig").E,
......@@ -5365,3 +5382,40 @@ pub const PERF = struct {
53655382
53665383 pub const IOC_FLAG_GROUP = 1;
53675384};
5385
5386pub const PTRACE = struct {
5387 pub const TRACEME = 0;
5388 pub const PEEKTEXT = 1;
5389 pub const PEEKDATA = 2;
5390 pub const PEEKUSER = 3;
5391 pub const POKETEXT = 4;
5392 pub const POKEDATA = 5;
5393 pub const POKEUSER = 6;
5394 pub const CONT = 7;
5395 pub const KILL = 8;
5396 pub const SINGLESTEP = 9;
5397 pub const GETREGS = 12;
5398 pub const SETREGS = 13;
5399 pub const GETFPREGS = 14;
5400 pub const SETFPREGS = 15;
5401 pub const ATTACH = 16;
5402 pub const DETACH = 17;
5403 pub const GETFPXREGS = 18;
5404 pub const SETFPXREGS = 19;
5405 pub const SYSCALL = 24;
5406 pub const SETOPTIONS = 0x4200;
5407 pub const GETEVENTMSG = 0x4201;
5408 pub const GETSIGINFO = 0x4202;
5409 pub const SETSIGINFO = 0x4203;
5410 pub const GETREGSET = 0x4204;
5411 pub const SETREGSET = 0x4205;
5412 pub const SEIZE = 0x4206;
5413 pub const INTERRUPT = 0x4207;
5414 pub const LISTEN = 0x4208;
5415 pub const PEEKSIGINFO = 0x4209;
5416 pub const GETSIGMASK = 0x420a;
5417 pub const SETSIGMASK = 0x420b;
5418 pub const SECCOMP_GET_FILTER = 0x420c;
5419 pub const SECCOMP_GET_METADATA = 0x420d;
5420 pub const GET_SYSCALL_INFO = 0x420e;
5421};