From owner-svn-src-all@freebsd.org Fri Jun 19 09:27:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D94E83457D5; Fri, 19 Jun 2020 09:27:58 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49pD4G5SKnz3YCX; Fri, 19 Jun 2020 09:27:58 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B683918A7A; Fri, 19 Jun 2020 09:27:58 +0000 (UTC) (envelope-from salvadore@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05J9RwTY024272; Fri, 19 Jun 2020 09:27:58 GMT (envelope-from salvadore@FreeBSD.org) Received: (from salvadore@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05J9RwjN024270; Fri, 19 Jun 2020 09:27:58 GMT (envelope-from salvadore@FreeBSD.org) Message-Id: <202006190927.05J9RwjN024270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: salvadore set sender to salvadore@FreeBSD.org using -f From: Lorenzo Salvadore Date: Fri, 19 Jun 2020 09:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362369 - head/bin/ps X-SVN-Group: head X-SVN-Commit-Author: salvadore X-SVN-Commit-Paths: head/bin/ps X-SVN-Commit-Revision: 362369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2020 09:27:58 -0000 Author: salvadore (ports committer) Date: Fri Jun 19 09:27:58 2020 New Revision: 362369 URL: https://svnweb.freebsd.org/changeset/base/362369 Log: bin/ps: Make the rtprio option actually show realtime priorities Fix the rtprio option that for some reason was progessively becoming an option showing the priority class of threads. In particular: - use the constants defined in sys/sys/rtprio.h instead of those defined in sys/sys/priority.h: this helps making clearer that the code actually is about realtime priorities and not standard scheduler priorities; - remove the PRI_ITHD case that has nothing to do with realtime priorities; - convert the priority levels to realtime priority levels using the same formulas used for pri_to_rtp function in sys/kern/kern_resource.c. - remove outdated note "101 = not a realtime process" in the man page and replace it with a more useful reference to man 1 rtprio. Approved by: src (mckusick), manpages (bcr), gerald (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25266 Modified: head/bin/ps/print.c head/bin/ps/ps.1 Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Fri Jun 19 07:07:10 2020 (r362368) +++ head/bin/ps/print.c Fri Jun 19 09:27:58 2020 (r362369) @@ -704,17 +704,17 @@ 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 */ + asprintf(&str, "normal:%u", level - PRI_MIN_TIMESHARE); break; - case PRI_TIMESHARE: - asprintf(&str, "normal"); - break; - case PRI_IDLE: - asprintf(&str, "idle:%u", level); + case RTP_PRIO_IDLE: + /* alias for PRI_IDLE */ + asprintf(&str, "idle:%u", level - PRI_MIN_IDLE); break; default: asprintf(&str, "%u:%u", class, level); Modified: head/bin/ps/ps.1 ============================================================================== --- head/bin/ps/ps.1 Fri Jun 19 07:07:10 2020 (r362368) +++ head/bin/ps/ps.1 Fri Jun 19 09:27:58 2020 (r362369) @@ -648,7 +648,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