Skip to content

Commit 97fd5c4

Browse files
committed
Use env to find bpftrace
1 parent 8ec651e commit 97fd5c4

25 files changed

+26
-25
lines changed

docs/reference_guide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ iscsid is sleeping.
170170
[...]
171171
```
172172

173-
It can also be made executable to run stand-alone. Start by adding an interpreter line at the top (`#!`) with the path to your installed bpftrace (/usr/local/bin is the default):
173+
It can also be made executable to run stand-alone. Start by adding an interpreter line at the top (`#!`) with either the path to your installed bpftrace (/usr/local/bin is the default) or the path to `env` (usually just `/usr/bin/env`) followed by `bpftrace` (so it will find bpftrace in your `$PATH`):
174174

175175
```
176176
1 #!/usr/local/bin/bpftrace
177+
1 #!/usr/bin/env bpftrace
177178
2
178179
3 tracepoint:syscalls:sys_enter_nanosleep
179180
4 {

tools/bashreadline.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* bashreadline Print entered bash commands from all running shells.
44
* For Linux, uses bpftrace and eBPF.

tools/biolatency.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* biolatency.bt Block I/O latency as a histogram.
44
* For Linux, uses bpftrace, eBPF.

tools/biosnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* biosnoop.bt Block I/O tracing tool, showing per I/O latency.
44
* For Linux, uses bpftrace, eBPF.

tools/bitesize.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* bitesize Show disk I/O size as a histogram.
44
* For Linux, uses bpftrace and eBPF.

tools/capable.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* capable Trace security capabilitiy checks (cap_capable()).
44
* For Linux, uses bpftrace and eBPF.

tools/cpuwalk.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* cpuwalk Sample which CPUs are executing processes.
44
* For Linux, uses bpftrace and eBPF.

tools/dcsnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* dcsnoop Trace directory entry cache (dcache) lookups.
44
* For Linux, uses bpftrace and eBPF.

tools/execsnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* execsnoop.bt Trace new processes via exec() syscalls.
44
* For Linux, uses bpftrace and eBPF.

tools/gethostlatency.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* gethostlatency Trace getaddrinfo/gethostbyname[2] calls.
44
* For Linux, uses bpftrace and eBPF.

tools/killsnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* killsnoop Trace signals issued by the kill() syscall.
44
* For Linux, uses bpftrace and eBPF.

tools/loads.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* loads Prints load averages.
44
* For Linux, uses bpftrace and eBPF.

tools/mdflush.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* mdflush Trace md flush events.
44
* For Linux, uses bpftrace and eBPF.

tools/oomkill.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* oomkill Trace OOM killer.
44
* For Linux, uses bpftrace and eBPF.

tools/opensnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* opensnoop Trace open() syscalls.
44
* For Linux, uses bpftrace and eBPF.

tools/pidpersec.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* pidpersec Count new procesess (via fork).
44
* For Linux, uses bpftrace and eBPF.

tools/runqlat.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* runqlat.bt CPU scheduler run queue latency as a histogram.
44
* For Linux, uses bpftrace, eBPF.

tools/runqlen.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* runqlen.bt CPU scheduler run queue length as a histogram.
44
* For Linux, uses bpftrace, eBPF.

tools/statsnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* statsnoop Trace stat() syscalls.
44
* For Linux, uses bpftrace and eBPF.

tools/syncsnoop.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* syncsnoop Trace sync() variety of syscalls.
44
* For Linux, uses bpftrace and eBPF.

tools/syscount.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* syscount.bt Count system callls.
44
* For Linux, uses bpftrace, eBPF.

tools/vfscount.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* vfscount Count VFS calls ("vfs_*").
44
* For Linux, uses bpftrace and eBPF.

tools/vfsstat.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* vfsstat Count some VFS calls, with per-second summaries.
44
* For Linux, uses bpftrace and eBPF.

tools/writeback.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* writeback Trace file system writeback events with details.
44
* For Linux, uses bpftrace and eBPF.

tools/xfsdist.bt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bpftrace
1+
#!/usr/bin/env bpftrace
22
/*
33
* xfsdist Summarize XFS operation latency.
44
* For Linux, uses bpftrace and eBPF.

0 commit comments

Comments
 (0)