Page MenuHomeFreeBSD

proccontrol: use a table for modes
ClosedPublic

Authored by brooks on Aug 23 2024, 8:47 PM.
Tags
None
Referenced Files
F132073944: D46426.id143270.diff
Mon, Oct 13, 10:34 AM
F132073915: D46426.id.diff
Mon, Oct 13, 10:33 AM
F132008404: D46426.diff
Sun, Oct 12, 10:01 PM
Unknown Object (File)
Thu, Oct 9, 8:26 AM
Unknown Object (File)
Fri, Oct 3, 2:58 AM
Unknown Object (File)
Sep 12 2025, 3:13 AM
Unknown Object (File)
Aug 7 2025, 8:30 AM
Unknown Object (File)
Jul 22 2025, 12:10 PM
Subscribers

Details

Summary

Add a central table of modes and loop over it rather than spelling out
10 essentialy identical strcmp if statemnts. Use the stable to generate
usage as well reducing the number of ifdefs.

Disallow multiple -m options. Previouly multiple were allowed, but only
the last one was used and there was no indication this happened.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There might be room for further table use (all the setting cases follow the same pattern), but this seems like a good place to start.

kib added inline comments.
usr.bin/proccontrol/proccontrol.c
56
This revision is now accepted and ready to land.Aug 23 2024, 8:58 PM
This revision was automatically updated to reflect the committed changes.