summaryrefslogtreecommitdiff
path: root/src/trace/syscalls.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 12:37:33 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:42:11 -0300
commit36d7f642e71207d04f5da80530da552e06447337 (patch)
tree97277b7180675d46782e513320b5ac4a18de3282 /src/trace/syscalls.zig
parentc0f5bd34d0f5339626d2c28c4012db7be46b55f3 (diff)
downloadcomputeranim-36d7f642e71207d04f5da80530da552e06447337.tar.gz
computeranim-36d7f642e71207d04f5da80530da552e06447337.zip
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.
Diffstat (limited to 'src/trace/syscalls.zig')
-rw-r--r--src/trace/syscalls.zig9
1 files changed, 6 insertions, 3 deletions
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;