mirror of
https://github.com/containers/youki
synced 2024-11-10 03:31:41 +01:00
75718d7fad
Signed-off-by: utam0k <k0ma@utam0k.jp>
53 lines
1.3 KiB
Plaintext
Executable File
53 lines
1.3 KiB
Plaintext
Executable File
#!/usr/bin/env bpftrace
|
|
|
|
BEGIN
|
|
{
|
|
printf("Tracing Youki syscalls... Hit Ctrl-C to end.\n");
|
|
printf("%-12s %15s %-8s %-9s %s\n", "TIME", "COMMAND", "PID", "EVENT", "CONTENT");
|
|
}
|
|
|
|
tracepoint:syscalls:sys_enter_write
|
|
/comm == "4"|| comm == "youki" || comm == "youki:[1:INTER]" || comm == "youki:[2:INIT]"/
|
|
{
|
|
|
|
$s = str(args->buf, args->count);
|
|
if ($s != "\n") {
|
|
printf("%-12ld %15s %-8d %-9s ", elapsed , comm, pid, "write");
|
|
printf("fd=%d, %s\n", args->fd, $s);
|
|
}
|
|
}
|
|
|
|
tracepoint:syscalls:sys_enter_open,
|
|
tracepoint:syscalls:sys_enter_openat
|
|
/comm == "4"|| comm == "youki" || comm == "youki:[1:INTER]" || comm == "youki:[2:INIT]"/
|
|
{
|
|
@filename[tid] = args->filename;
|
|
}
|
|
|
|
|
|
tracepoint:syscalls:sys_exit_open,
|
|
tracepoint:syscalls:sys_exit_openat
|
|
/@filename[tid]/
|
|
{
|
|
$ret = args->ret;
|
|
$fd = $ret >= 0 ? $ret : -1;
|
|
$errno = $ret >= 0 ? 0 : - $ret;
|
|
|
|
printf("%-12ld %15s %-8d %-9s ", elapsed , comm, pid, "open");
|
|
printf("errno=%d, fd=%d, file=%s\n", $errno, $fd, str(@filename[tid]));
|
|
delete(@filename[tid]);
|
|
}
|
|
|
|
tracepoint:syscalls:sys_enter_clone3
|
|
/comm == "4"|| comm == "youki" || comm == "youki:[1:INTER]" || comm == "youki:[2:INIT]"/
|
|
{
|
|
printf("%-12ld %15s %-8d %-9s ", elapsed , comm, pid, "clone3");
|
|
}
|
|
|
|
END
|
|
{
|
|
clear(@filename);
|
|
printf("Tracing ended.\n");
|
|
}
|
|
|