Commit ccfb0d408d

David CARLIER <devnexen@gmail.com>
2023-05-19 20:40:59
std.c: adding ptrace for netbsd.
1 parent 447a302
Changed files (1)
lib
lib/std/c/netbsd.zig
@@ -1668,3 +1668,55 @@ pub const sigevent = extern struct {
     sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
     sigev_notify_attributes: ?*pthread_attr_t,
 };
+
+pub const PTRACE = struct {
+    pub const FORK = 0x0001;
+    pub const VFORK = 0x0002;
+    pub const VFORK_DONE = 0x0004;
+    pub const LWP_CREATE = 0x0008;
+    pub const LWP_EXIT = 0x0010;
+    pub const POSIX_SPAWN = 0x0020;
+};
+
+pub const PT = struct {
+    pub const TRACE_ME = 0;
+    pub const READ_I = 1;
+    pub const READ_D = 2;
+    pub const WRITE_I = 4;
+    pub const WRITE_D = 5;
+    pub const CONTINUE = 7;
+    pub const KILL = 8;
+    pub const ATTACH = 9;
+    pub const DETACH = 10;
+    pub const IO = 11;
+    pub const DUMPCORE = 11;
+    pub const LWPINFO = 12;
+};
+
+pub const ptrace_event = extern struct {
+    set_event: c_int,
+};
+
+pub const ptrace_state = extern struct {
+    report_event: c_int,
+    _option: extern union {
+        other_pid: pid_t,
+        lwp: lwpid_t,
+    },
+};
+
+pub const ptrace_io_desc = extern struct {
+    op: c_int,
+    offs: ?*anyopaque,
+    addr: ?*anyopaque,
+    len: usize,
+};
+
+pub const PIOD = struct {
+    pub const READ_D = 1;
+    pub const WRITE_D = 2;
+    pub const READ_I = 3;
+    pub const WRITE_I = 4;
+};
+
+pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int;