From 36d7f642e71207d04f5da80530da552e06447337 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:37:33 -0300 Subject: syscalls: what writev's buffers hold is captured, by the debugger and the agent musl's printf and Zig programs write through writev: pardes drawing an image showed nothing of the kitty graphics commands it sends until this. The README says what Lua and pardes were run with and what they showed. --- src/trace/syscalls.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/trace/syscalls.zig') diff --git a/src/trace/syscalls.zig b/src/trace/syscalls.zig index 2bf32b5..7e276bb 100644 --- a/src/trace/syscalls.zig +++ b/src/trace/syscalls.zig @@ -12,14 +12,17 @@ pub fn name(nr: u64) ?[]const u8 { /// A letter an argument: i an int (a descriptor, a pid, a signal), d a /// size, x a pointer or flags, s a NUL-terminated string, b a buffer as long -/// as the next argument says. Six x for a syscall not listed. +/// as the next argument says, v a vector of that many buffers (an iovec). +/// Six x for a syscall not listed. pub fn signature(nr: u64) []const u8 { return switch (std.enums.fromInt(linux.SYS, nr) orelse return "xxxxxx") { .getpid, .gettid, .getppid, .getuid, .geteuid, .getgid, .getegid, .sched_yield, .pause, .fork, .vfork => "", .close, .exit, .exit_group, .dup, .fsync => "i", .brk, .set_tid_address, .uname, .pipe, .time => "x", .chdir, .rmdir, .unlink => "s", - .read, .readv, .writev, .getdents64 => "ixd", + .read, .readv, .getdents64 => "ixd", + .writev => "ivd", + .pwritev, .pwritev2 => "ivdd", .write => "ibd", .pread64 => "ixdd", .pwrite64 => "ibdd", @@ -70,7 +73,7 @@ pub fn formatEnter(w: *std.Io.Writer, ev: *const Event, payload: []const u8) !vo switch (kind) { 'i' => try w.print("{d}", .{@as(i32, @bitCast(@as(u32, @truncate(ev.a[i]))))}), 'd' => try w.print("{d}", .{ev.a[i]}), - 's', 'b' => if (decoded) |text| { + 's', 'b', 'v' => if (decoded) |text| { // Dots, as strace has them, when the buffer was longer than what was captured. try w.print("\"{f}\"{s}", .{ std.zig.fmtString(text), if (kind == 'b' and text.len < ev.a[i + 1]) "..." else "" }); decoded = null; -- cgit v1.3