lockstat(8) on Solnix vs Linux and the BSDs
On Solnix, lockstat is the illumos lockstat at /usr/sbin/lockstat, a DTrace-based tool that runs a command and reports kernel lock contention until it exits. FreeBSD's lockstat(1) is nearly the same tool. NetBSD's lockstat(8) uses a different driver and mostly different flags, and Linux has no counterpart with this name (bpftrace is a general tracer).
The manual pages
- Solnix: lockstat(8) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: bpftrace(8) bpftrace-0.25.1 (different command, similar job)
- FreeBSD: lockstat(1) 15.1-RELEASE
- NetBSD: lockstat(8) 11.0
What Solnix runs
A default Solnix system runs the illumos lockstat at /usr/sbin/lockstat. No other variants are shipped. It uses DTrace, so it is restricted to the super-user by default. The administrator can grant other users additional DTrace privileges. The page says the output format and content reflect the current kernel implementation and may change in future releases.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | different tool | Linux has no lockstat in the bundle. The listed counterpart, bpftrace, is a general tracing language, so lock statistics need a bpftrace program (-e or a file). Solnix lockstat has built-in lock event options and takes none of those arguments.Source: Solnix lockstat(8) DESCRIPTION; Linux bpftrace(8) NAME, SYNOPSIS (-e 'program code') |
| Linux | how the run ends | Solnix lockstat takes a trailing command and gathers data until that command completes (for example lockstat sleep 5). bpftrace runs until Ctrl-C or an exit call; -c COMMAND ties its lifetime to a child process.Source: Solnix lockstat(8) SYNOPSIS, DESCRIPTION; Linux bpftrace(8) SYNOPSIS, -c |
| Linux | same letters, different meanings | Solnix -e takes an event list, -l a lock, -d a minimum duration, -f a function, -k coalesces PCs and -p gives parsable output. In bpftrace, -e is program text, -l lists probes, -d is a debug stage, -f is output format, -k enables warnings and -p is a PID.Source: Solnix lockstat(8) -e, -l, -d, -f, -k, -p; Linux bpftrace(8) -e, -l, -d, -f, -k, -p |
| FreeBSD | -V and -c | FreeBSD has -V, which prints the D program used to gather the data; Solnix has no -V. Solnix has -c, which coalesces lock data for lock arrays such as pse_mutex[]; the FreeBSD page has no -c.Source: FreeBSD lockstat(1) -V, SYNOPSIS; Solnix lockstat(8) -c, SYNOPSIS |
| FreeBSD | -g default depth | With -g, the default data gathering mode is -s 50 on Solnix. The FreeBSD page says -s -50, so the two manuals disagree on the default.Source: Solnix lockstat(8) -g; FreeBSD lockstat(1) -g |
| FreeBSD | who may run it | Both restrict lockstat to the super-user by default. The Solnix page adds that the administrator can let other users run it by granting DTrace privileges. The FreeBSD page does not say this. Source: Solnix lockstat(8) DESCRIPTION (last paragraph); FreeBSD lockstat(1) DESCRIPTION (last paragraph) |
| FreeBSD | manual section and references | The page is lockstat(8) on Solnix and NetBSD but lockstat(1) on FreeBSD. -x refers to dtrace(8) documentation on Solnix and to dtrace(1) on FreeBSD. Solnix also points to plockstat(8) and lockstat(4D).Source: Solnix lockstat(8) SEE ALSO; FreeBSD lockstat(1) SEE ALSO, -x |
| NetBSD | implementation and requirements | NetBSD lockstat uses a lockstat pseudo-device driver that must be present in the kernel, and only root can run it. Solnix lockstat relies on DTrace to modify running kernel text. Source: NetBSD lockstat(8) DESCRIPTION; Solnix lockstat(8) DESCRIPTION |
| NetBSD | -c, -d, -e, -t, -x meanings | NetBSD -c reports percentages by count, -d disables lockstat, -e lists event types, -t lists lock types and -x summarizes events. On Solnix these are: -c coalesce lock arrays, -d minimum duration, -e event list, -t timing, -x DTrace option.Source: NetBSD lockstat(8) -c, -d, -e, -t, -x; Solnix lockstat(8) -c, -d, -e, -t, -x |
| NetBSD | filtering flags | NetBSD filters with -E event, -F func, -L lock and -T type, and -f/-l take no argument (report by function only or by lock only). Solnix uses -f func and -l lock as filters, -w/-W to choose lock or caller, and -T to trace instead of sample.Source: NetBSD lockstat(8) -E, -F, -L, -T, -f, -l; Solnix lockstat(8) -f, -l, -w, -W, -T |
| NetBSD | -p and -s meanings | On NetBSD, -p shows per-CPU averages and -s shows per-second averages. On Solnix, -p gives parsable output and -s depth gathers stack traces. Solnix -R shows rates per second.Source: NetBSD lockstat(8) -p, -s; Solnix lockstat(8) -p, -s, -R |
| NetBSD | default report | Solnix by default watches contention events (-C), gathers timing data, and sorts by decreasing frequency. NetBSD by default keys on event timings, and -c switches to sorting by count.Source: Solnix lockstat(8) DESCRIPTION, Event Selection; NetBSD lockstat(8) -c |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | NetBSD |
|---|---|---|---|---|
| gather lock contention stats for a fixed interval | lockstat sleep 5 | — | lockstat sleep 5 | lockstat command (for example with sleep) |
| run a command under tracing and stop when it exits | lockstat command [args] | bpftrace -c COMMAND | lockstat command [args] | lockstat command ... |
| write output to a file | lockstat -o filename command | bpftrace -o FILENAME | lockstat -o filename command | lockstat -o file command |
| list available events | lockstat with no arguments | bpftrace -l | lockstat with no arguments | lockstat -e (events), lockstat -t (lock types) |
Standards
- POSIX: lockstat is not a POSIX.1-2024 utility.
- Solnix: The page has no standards section. It says lockstat is provided on an as-is basis and its output format is subject to change in future releases.
Writing portable scripts
- Do not share lockstat flag strings between Solnix/FreeBSD and NetBSD: most letters mean different things. Check uname first and build the command line per system.
- Do not depend on the output layout of lockstat. The Solnix page says the format may change. If you parse it, use
-pon Solnix or FreeBSD and test on each release.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.