Page MenuHomeFreeBSD

ps(1): let J flag list all jailed processes
AcceptedPublic

Authored by rew on Nov 12 2021, 11:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 12:41 AM
Unknown Object (File)
Dec 27 2023, 1:37 AM
Unknown Object (File)
Dec 20 2023, 8:12 AM
Unknown Object (File)
Nov 18 2023, 1:44 PM
Unknown Object (File)
Nov 18 2023, 11:45 AM
Unknown Object (File)
Nov 18 2023, 10:48 AM
Unknown Object (File)
Nov 18 2023, 10:29 AM
Unknown Object (File)
Sep 12 2023, 10:23 PM

Details

Reviewers
bdrewery
pauamma_gundo.com
Group Reviewers
manpages
Summary

Add an argument, -1, to the J flag.

To get a listing of all jailed processes: ps -J -1

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42776
Build 39664: arc lint + arc unit

Event Timeline

rew requested review of this revision.Nov 12 2021, 11:54 PM

Are there other places where -(j|J) -1 is used to list all jails, instead of simply doing -(j|J)?

I don't recall any off hand, and I would think it makes more sense to not require -1 to list all of them if it can be done without.

allanjude added inline comments.
bin/ps/ps.c
798–799

since -1 is what jail_getid() returns on error, it might make more sense to check something like strcmp(elem, "-1") == 0 and if so don't bother calling jail_getid(), to help disambiguate between 'elem was literally -1, and elem was a string that doesn't correspond to a jail name'

skip the call to jail_getid() when listing all jailed processes.

rew marked an inline comment as done.Nov 13 2021, 1:29 AM

Are there other places where -(j|J) -1 is used to list all jails, instead of simply doing -(j|J)?

Not that I'm aware of either, top (next on my list) uses -J 0 (for host processes) and -J $jid (for specified jail)

I don't recall any off hand, and I would think it makes more sense to not require -1 to list all of them if it can be done without.

-J requires an argument, it would have to be a different flag. I'd prefer to stick with -J -1

Any updates on this one?

Minus Dd bump, manual page LGTM. Can't speak for source code or consistency.

bin/ps/ps.1
32

Bump

This revision is now accepted and ready to land.Oct 13 2022, 6:06 PM