Page MenuHomeFreeBSD

D49622.id154146.diff
No OneTemporary

D49622.id154146.diff

diff --git a/RELNOTES b/RELNOTES
--- a/RELNOTES
+++ b/RELNOTES
@@ -10,6 +10,16 @@
Changes to this file should not be MFCed.
+cccdbb57f741:
+ ps(1)'s '-U' option has been changed to select processes by their real
+ user IDs instead of their effective one, in accordance with POSIX and
+ the use case of wanting to list processes launched by some user, which
+ is expected to be more frequent than listing processes having the rights
+ of some user. This only affects the selection of processes whose real
+ and effective user IDs differ. After this change, ps(1)'s '-U' flag
+ behaves differently then in other BSDs but identically to that of
+ Linux's procps and illumos.
+
935ffbe06f1d:
ps(1)'s default list of processes now comes from matching its effective
user ID instead of its real user ID with the effective user ID of all
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -349,20 +349,6 @@
*/
nselectors++;
break;
-#if 0
- case 'R':
- /*-
- * XXX - This un-standard option is still under
- * debate. This is what SUSv3 defines as
- * the `-U' option, and while it would be
- * nice to have, it could cause even more
- * confusion to implement it as `-R'.
- */
- add_list(&ruidlist, optarg);
- xkeep_implied = 1;
- nselectors++;
- break;
-#endif
case 'r':
sortby = SORTCPU;
break;
@@ -394,21 +380,34 @@
nselectors++;
break;
case 'U':
+ add_list(&ruidlist, optarg);
+ xkeep_implied = 1;
+ nselectors++;
+ break;
+ case 'u':
+#if 0
/*
- * POSIX says that '-U' should match on real user IDs,
- * not effective ones as we are doing here, which is
- * normally the behavior of option '-u' according to the
- * standard.
+ * POSIX's '-u' behavior.
+ *
+ * This has not been activated because:
+ * 1. Option '-U' is a substitute for most users, and
+ * those that care seem more likely to want to match
+ * on the real user ID to display all processes
+ * launched by some users.
+ * 2. '-u' has been a canned display on the BSDs for
+ * a very long time (POLA).
*/
add_list(&uidlist, optarg);
xkeep_implied = 1;
nselectors++;
break;
- case 'u':
+#else
+ /* Historical BSD's '-u'. */
parsefmt(ufmt, &varlist, 0);
sortby = SORTCPU;
_fmt = 1;
break;
+#endif
case 'v':
parsefmt(vfmt, &varlist, 0);
sortby = SORTMEM;

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 21, 12:01 PM (5 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31908910
Default Alt Text
D49622.id154146.diff (2 KB)

Event Timeline