summaryrefslogtreecommitdiff
path: root/src/cli/probe.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/probe.zig')
-rw-r--r--src/cli/probe.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cli/probe.zig b/src/cli/probe.zig
index f0e2d12..539af5c 100644
--- a/src/cli/probe.zig
+++ b/src/cli/probe.zig
@@ -16,7 +16,7 @@ pub const usage =
\\kernel, into a recording (default out.ztrace). Needs CAP_BPF and
\\CAP_PERFMON, which root has.
\\
- \\ --syscalls every syscall, with the registers at its entry
+ \\ --syscalls every syscall
\\ --sched every switch of a CPU to or from one of its threads
\\ --kprobe FUNCTION
\\ every call of a kernel function it makes: five arguments
@@ -95,7 +95,7 @@ pub fn run(init: std.process.Init, args: []const [:0]const u8) !void {
const maps: bpf.Maps = .{ .ring = 0, .drops = 0 };
std.debug.print("for the process started from {s}:\n", .{path});
if (syscalls) {
- list("raw tracepoint sys_enter: a syscall_enter and the registers", bpf.sysEnter(maps, 0));
+ list("raw tracepoint sys_enter: a syscall_enter", bpf.sysEnter(maps, 0));
list("raw tracepoint sys_exit: a syscall_exit", bpf.sysExit(maps, 0));
}
if (sched) {
@@ -107,7 +107,7 @@ pub fn run(init: std.process.Init, args: []const [:0]const u8) !void {
if (p.usdt) |u| std.debug.print(", semaphore at +{x}, arguments {s}", .{ if (u.semaphore == 0) 0 else p.elf.?.offset(u.semaphore) orelse 0, u.args });
std.debug.print("\n", .{});
const id = zt.perf.stringId(p.name);
- list("its program: a probe and the registers", if (p.usdt) |u| bpf.usdtProgram(maps, 0, id, u.args) catch fail("{s}: an argument of this probe ({s}) is in a form not understood yet\n", .{ p.name, u.args }) else bpf.probe(maps, 0, id, null));
+ list("its program: a probe", if (p.usdt) |u| bpf.usdtProgram(maps, 0, id, u.args) catch fail("{s}: an argument of this probe ({s}) is in a form not understood yet\n", .{ p.name, u.args }) else bpf.probe(maps, 0, id, null, p.kind != .kprobe));
}
std.debug.print("{s}\n", .{if (missing) |m| m else "nothing is missing to attach them"});
return;
@@ -172,6 +172,7 @@ fn refused(err: anyerror, tracer: ?*bpf.Tracer) noreturn {
const log = if (tracer) |t| std.mem.sliceTo(t.log, 0) else "";
switch (err) {
error.PermissionDenied => fail("ztrace probe: bpf() refused though the capabilities are there: inside a user namespace or a container they do not count, the kernel wants them in the initial namespace\n", .{}),
+ error.SystemResources => fail("ztrace probe: the kernel has no memory to spare for a ring that large (--ring)\n", .{}),
error.UnsafeProgram, error.InvalidProgram => fail("ztrace probe: the kernel's verifier refused a program ({t}):\n{s}\n", .{ err, log }),
else => fail("ztrace probe: {t}\n{s}", .{ err, log }),
}