Upgrading
Log lines, exit statuses and the options -p -e -l -c -i -m -v -z are unchanged from the original, so existing scripts keep working. These are the differences a script or an operator can notice.
From 1.0.2 to 1.0.3
- Nothing to change. Options, exit statuses and log text are the same, and the controller is the same.
- FreeBSD:
-inow limits the whole tree. It used to limit only the direct children of the target, so grandchildren ran free. If you relied on that, limit the child you want by pid instead. - New systems: OpenBSD and NetBSD build and run; see Platforms for how far each is tested.
From the original cpulimit (0.2.x, 0.3.2)
| Area | Original | 1.x |
|---|---|---|
| Option values | atoi: -l 5x and -l abc were accepted, and -m could crash | strict parsing with ranges; -c 0 and -c 1000000 or more are rejected instead of spinning or failing in nanosleep |
| Command mode | a separate limiter process that could outlive its parent | one process; the exit status is the command's |
| Two limiters, one target | allowed; they undo each other's SIGSTOP/SIGCONT | the second is refused (exit 1) and names the first; --no-lock restores the old behaviour |
| Process identity | pid only: a reused pid was limited as if it were the target | pid and start time |
| Signals | handled in the handler; a signal could be lost before the wait | flag-only handler; signals blocked except inside pselect() |
| Clock | wall clock | CLOCK_MONOTONIC |
| New options | none | -d, -s, -P, --no-lock, --no-boost, -V, and long options for all |
| Build | recursive Makefiles, Travis CI | one Makefile, GitHub Actions |
Control accuracy is the same: both versions use one controller, and both under-deliver at low limits and overshoot near 50 %. The gain is the lower cost of the limiter itself (measurements).
Checking an upgrade
cpulimit -V # version
cpulimit -l 50 -- sh -c 'exit 7'; echo $? # 7: the command's status is passed through
cpulimit -l 5x -p 1234 ; echo $? # 1: strict option parsing