Page MenuHomeFreeBSD

pwait: Add an option to print remaining processes
ClosedPublic

Authored by des on Oct 23 2025, 10:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 10, 3:43 AM
Unknown Object (File)
Thu, Dec 18, 3:31 AM
Unknown Object (File)
Nov 29 2025, 12:21 AM
Unknown Object (File)
Nov 9 2025, 4:36 PM
Unknown Object (File)
Nov 7 2025, 4:11 AM
Unknown Object (File)
Nov 7 2025, 2:28 AM
Unknown Object (File)
Nov 1 2025, 1:56 AM
Unknown Object (File)
Oct 31 2025, 9:15 PM
Subscribers

Details

Summary
  • On startup, insert all valid PIDs into a tree.
  • In our main loop, whenever a process terminates, remove its PID from the tree.
  • On exit, if the -p flag was specified, print the remaining PIDs.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68045
Build 64928: arc lint + arc unit

Event Timeline

des requested review of this revision.Oct 23 2025, 10:29 AM
bcr added a subscriber: bcr.

The man page part looks good to me.

This revision is now accepted and ready to land.Oct 23 2025, 6:39 PM
markj added a subscriber: markj.

Rather than using a separate rbtree, can you just make each kevent's udata field point to a structure containing the kevent, the PID, and some state indicating whether the process has already exited?

The tree serves the additional purposes of deduplication (which was previously handled by linear search, making the initialization code quadratic in the numbers of processes watched) and stable ordering.

This revision now requires review to proceed.Oct 27 2025, 7:31 PM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 28 2025, 11:58 AM
This revision was automatically updated to reflect the committed changes.