Page MenuHomeFreeBSD

truss: Return child exit code as truss exit code
Needs ReviewPublic

Authored by bdrewery on Oct 24 2025, 12:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 3, 4:59 PM
Unknown Object (File)
Fri, Dec 26, 11:33 AM
Unknown Object (File)
Thu, Dec 25, 1:33 AM
Unknown Object (File)
Dec 13 2025, 8:54 PM
Unknown Object (File)
Nov 7 2025, 3:14 AM
Unknown Object (File)
Nov 3 2025, 12:27 AM
Unknown Object (File)
Oct 31 2025, 3:04 PM
Unknown Object (File)
Oct 30 2025, 4:28 PM
Subscribers

Details

Reviewers
jhb
Test Plan

Been running this locally for years.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 68066
Build 64949: arc lint + arc unit

Event Timeline

Maybe adding a flag for this makes sense? I don't know how important truss status is to people.

usr.bin/truss/setup.c
781

Hmm, so this returns an unusual status if the child exits on a signal? Also, I guess it returns the status of the last child to exit? That's probably fine, but perhaps not very obvious. The semantics are clear if you do a simple 'truss echo foo' that runs a new process that doesn't fork, etc. If you attach to a running daemon that forks (e.g. apache or some such) then detach via Ctrl-C you get the status of whatever child process happened to exit while attached which is less straightforward.

Perhaps consider only returning the status in the case that truss forks a new process (and then have it be the status of that first child process), but when attaching to an existing PID always return 0? Those semantics might be easier to understand.