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> 2023-03-15 10:48:12-07:00
logee693bfe04522efe556cb416050326187f168aea
tree907c46c6a1e41a844754e22e6287a15999e6fd21
parentc641af3cba8f0e8e6bba0ba26dce18bd225a832e

std.os.linux: add ptrace


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

lib/std/os/linux.zig+54
......@@ -1820,6 +1820,23 @@ pub fn seccomp(operation: u32, flags: u32, args: ?*const anyopaque) usize {
18201820 return syscall3(.seccomp, operation, flags, @ptrToInt(args));
18211821}
18221822
1823pub fn ptrace(
1824 req: u32,
1825 pid: pid_t,
1826 addr: usize,
1827 data: usize,
1828 addr2: usize,
1829) usize {
1830 return syscall5(
1831 .ptrace,
1832 req,
1833 @bitCast(usize, @as(isize, pid)),
1834 addr,
1835 data,
1836 addr2,
1837 );
1838}
1839
18231840pub const E = switch (native_arch) {
18241841 .mips, .mipsel => @import("linux/errno/mips.zig").E,
18251842 .sparc, .sparcel, .sparc64 => @import("linux/errno/sparc.zig").E,
......@@ -5721,3 +5738,40 @@ pub const AUDIT = struct {
57215738 }
57225739 };
57235740};
5741
5742pub const PTRACE = struct {
5743 pub const TRACEME = 0;
5744 pub const PEEKTEXT = 1;
5745 pub const PEEKDATA = 2;
5746 pub const PEEKUSER = 3;
5747 pub const POKETEXT = 4;
5748 pub const POKEDATA = 5;
5749 pub const POKEUSER = 6;
5750 pub const CONT = 7;
5751 pub const KILL = 8;
5752 pub const SINGLESTEP = 9;
5753 pub const GETREGS = 12;
5754 pub const SETREGS = 13;
5755 pub const GETFPREGS = 14;
5756 pub const SETFPREGS = 15;
5757 pub const ATTACH = 16;
5758 pub const DETACH = 17;
5759 pub const GETFPXREGS = 18;
5760 pub const SETFPXREGS = 19;
5761 pub const SYSCALL = 24;
5762 pub const SETOPTIONS = 0x4200;
5763 pub const GETEVENTMSG = 0x4201;
5764 pub const GETSIGINFO = 0x4202;
5765 pub const SETSIGINFO = 0x4203;
5766 pub const GETREGSET = 0x4204;
5767 pub const SETREGSET = 0x4205;
5768 pub const SEIZE = 0x4206;
5769 pub const INTERRUPT = 0x4207;
5770 pub const LISTEN = 0x4208;
5771 pub const PEEKSIGINFO = 0x4209;
5772 pub const GETSIGMASK = 0x420a;
5773 pub const SETSIGMASK = 0x420b;
5774 pub const SECCOMP_GET_FILTER = 0x420c;
5775 pub const SECCOMP_GET_METADATA = 0x420d;
5776 pub const GET_SYSCALL_INFO = 0x420e;
5777};