Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2020 23:23:08 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r363405 - in stable/12: bin/ps sys/sys
Message-ID:  <202007212323.06LNN8Za055914@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Tue Jul 21 23:23:08 2020
New Revision: 363405
URL: https://svnweb.freebsd.org/changeset/base/363405

Log:
  MFC of 362369 (by Lorenzo Salvadore) and 363192
  
  Refinement of /bin/ps rtprio output

Modified:
  stable/12/bin/ps/print.c
  stable/12/bin/ps/ps.1
  stable/12/sys/sys/rtprio.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/bin/ps/print.c
==============================================================================
--- stable/12/bin/ps/print.c	Tue Jul 21 22:47:02 2020	(r363404)
+++ stable/12/bin/ps/print.c	Tue Jul 21 23:23:08 2020	(r363405)
@@ -717,17 +717,24 @@ priorityr(KINFO *k, VARENT *ve __unused)
 	class = lpri->pri_class;
 	level = lpri->pri_level;
 	switch (class) {
-	case PRI_ITHD:
-		asprintf(&str, "intr:%u", level);
+	case RTP_PRIO_REALTIME:
+	/* alias for PRI_REALTIME */
+		asprintf(&str, "real:%u", level - PRI_MIN_REALTIME);
 		break;
-	case PRI_REALTIME:
-		asprintf(&str, "real:%u", level);
+	case RTP_PRIO_NORMAL:
+	/* alias for PRI_TIMESHARE */
+		if (level >= PRI_MIN_TIMESHARE)
+			asprintf(&str, "normal:%u", level - PRI_MIN_TIMESHARE);
+		else
+			asprintf(&str, "kernel:%u", level - PRI_MIN_KERN);
 		break;
-	case PRI_TIMESHARE:
-		asprintf(&str, "normal");
+	case RTP_PRIO_IDLE:
+	/* alias for PRI_IDLE */
+		asprintf(&str, "idle:%u", level - PRI_MIN_IDLE);
 		break;
-	case PRI_IDLE:
-		asprintf(&str, "idle:%u", level);
+	case RTP_PRIO_ITHD:
+	/* alias for PRI_ITHD */
+		asprintf(&str, "intr:%u", level - PRI_MIN_ITHD);
 		break;
 	default:
 		asprintf(&str, "%u:%u", class, level);

Modified: stable/12/bin/ps/ps.1
==============================================================================
--- stable/12/bin/ps/ps.1	Tue Jul 21 22:47:02 2020	(r363404)
+++ stable/12/bin/ps/ps.1	Tue Jul 21 23:23:08 2020	(r363405)
@@ -649,7 +649,8 @@ group name (from rgid)
 .It Cm rss
 resident set size
 .It Cm rtprio
-realtime priority (101 = not a realtime process)
+realtime priority (see
+.Xr rtprio 1)
 .It Cm ruid
 real user ID
 .It Cm ruser

Modified: stable/12/sys/sys/rtprio.h
==============================================================================
--- stable/12/sys/sys/rtprio.h	Tue Jul 21 22:47:02 2020	(r363404)
+++ stable/12/sys/sys/rtprio.h	Tue Jul 21 23:23:08 2020	(r363405)
@@ -44,6 +44,7 @@
 
 /* priority types.  Start at 1 to catch uninitialized fields. */
 
+#define RTP_PRIO_ITHD		PRI_ITHD	/* Interrupt thread. */
 #define RTP_PRIO_REALTIME	PRI_REALTIME	/* real time process */
 #define RTP_PRIO_NORMAL		PRI_TIMESHARE	/* time sharing process */
 #define RTP_PRIO_IDLE		PRI_IDLE	/* idle process */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007212323.06LNN8Za055914>