opnsense-src/bin/ps
Olivier Certner a2132d9173
ps(1): '-U' to select processes by real user IDs
This is what POSIX mandates for option '-U' and arguably the behavior
that most users actually need in most cases.  Before, '-U' would select
processes by their effective user IDs (which is the behavior mandated by
POSIX for option '-u').

Matching by real user IDs allows to list all processes belonging to the
passed users, including those temporarily having a different effective
user ID, which can happen if launched by a setuid executable or if using
some credentials-changing facility (such as seteuid() for root processes
or mac_do(4)/setcred(2)).  Conversely, processes temporarily assuming
the identity of some of the passed users will not be listed anymore
(they do not "belong" to these users).

This change also makes '-U' consistent with '-G', the latter already
matching on real group IDs.

While here, remove the (non-compiled) code for tentative option '-R' as
its proposed behavior was the one established here for '-U'.  Also, move
the compiled-out old code for '-U' under '-u' for reference, as this is
what the latter should do according to POSIX, even if it seems unlikely
we will want to change the behavior of '-u'.

Reviewed by:    manpages (ziaee)
MFC after:      3 days
Relnotes:       yes
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49622 (code)
Differential Revision:  https://reviews.freebsd.org/D49623 (manual page)

(cherry picked from commit 995b690d1398044dc9d85a6d86ec550cda30b2ac)
2025-05-01 21:42:25 +02:00
..
extern.h ps(1): Remove not-explicitly-requested columns with duplicate data 2025-05-01 21:37:04 +02:00
fmt.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
keyword.c ps(1): Remove not-explicitly-requested columns with duplicate data 2025-05-01 21:37:04 +02:00
Makefile ps(1): Aliases: Resolve once, merge specifications 2025-05-01 21:37:04 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
nlist.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
print.c ps(1): Keywords: New UNSPEC type, rename 'alias', re-order fields 2025-05-01 21:37:03 +02:00
ps.1 ps(1): '-U' to select processes by real user IDs 2025-05-01 21:42:25 +02:00
ps.c ps(1): '-U' to select processes by real user IDs 2025-05-01 21:42:25 +02:00
ps.h ps(1): Remove not-explicitly-requested columns with duplicate data 2025-05-01 21:37:04 +02:00