From owner-svn-src-all@freebsd.org Sat Jul 4 06:34:57 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 3687C3630B9; Sat, 4 Jul 2020 06:34:57 +0000 (UTC) (envelope-from pstef@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 49zMWj0Jf5z4Fk6; Sat, 4 Jul 2020 06:34:57 +0000 (UTC) (envelope-from pstef@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 C62EA18525; Sat, 4 Jul 2020 06:34:56 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0646Yucq033004; Sat, 4 Jul 2020 06:34:56 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0646YtFN033001; Sat, 4 Jul 2020 06:34:55 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <202007040634.0646YtFN033001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sat, 4 Jul 2020 06:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362924 - stable/12/bin/ps X-SVN-Group: stable-12 X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: stable/12/bin/ps X-SVN-Commit-Revision: 362924 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: Sat, 04 Jul 2020 06:34:57 -0000 Author: pstef Date: Sat Jul 4 06:34:55 2020 New Revision: 362924 URL: https://svnweb.freebsd.org/changeset/base/362924 Log: MFC r362705 and r362707: ps(1): reuse keyword "cpu" to show CPU number ps(1): don't try to handle non-SMP systems Modified: stable/12/bin/ps/extern.h stable/12/bin/ps/keyword.c stable/12/bin/ps/print.c stable/12/bin/ps/ps.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/ps/extern.h ============================================================================== --- stable/12/bin/ps/extern.h Sat Jul 4 06:27:28 2020 (r362923) +++ stable/12/bin/ps/extern.h Sat Jul 4 06:34:55 2020 (r362924) @@ -48,6 +48,7 @@ __BEGIN_DECLS char *arguments(KINFO *, VARENT *); char *command(KINFO *, VARENT *); char *cputime(KINFO *, VARENT *); +char *cpunum(KINFO *, VARENT *); int donlist(void); char *elapsed(KINFO *, VARENT *); char *elapseds(KINFO *, VARENT *); Modified: stable/12/bin/ps/keyword.c ============================================================================== --- stable/12/bin/ps/keyword.c Sat Jul 4 06:27:28 2020 (r362923) +++ stable/12/bin/ps/keyword.c Sat Jul 4 06:34:55 2020 (r362924) @@ -83,8 +83,7 @@ static VAR var[] = { CHAR, NULL, 0}, {"cow", "COW", NULL, "copy-on-write-faults", 0, kvar, KOFF(ki_cow), UINT, "u", 0}, - {"cpu", "CPU", NULL, "cpu-usage", 0, kvar, KOFF(ki_estcpu), UINT, "d", - 0}, + {"cpu", "C", NULL, "on-cpu", 0, cpunum, 0, CHAR, NULL, 0}, {"cputime", "", "time", NULL, 0, NULL, 0, CHAR, NULL, 0}, {"dsiz", "DSIZ", NULL, "data-size", 0, kvar, KOFF(ki_dsize), PGTOK, "ld", 0}, Modified: stable/12/bin/ps/print.c ============================================================================== --- stable/12/bin/ps/print.c Sat Jul 4 06:27:28 2020 (r362923) +++ stable/12/bin/ps/print.c Sat Jul 4 06:34:55 2020 (r362924) @@ -551,6 +551,19 @@ cputime(KINFO *k, VARENT *ve) } char * +cpunum(KINFO *k, VARENT *ve __unused) +{ + char *cpu; + + if (k->ki_p->ki_stat == SRUN && k->ki_p->ki_oncpu != NOCPU) { + asprintf(&cpu, "%d", k->ki_p->ki_oncpu); + } else { + asprintf(&cpu, "%d", k->ki_p->ki_lastcpu); + } + return (cpu); +} + +char * systime(KINFO *k, VARENT *ve) { long secs, psecs; Modified: stable/12/bin/ps/ps.1 ============================================================================== --- stable/12/bin/ps/ps.1 Sat Jul 4 06:27:28 2020 (r362923) +++ stable/12/bin/ps/ps.1 Sat Jul 4 06:34:55 2020 (r362924) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 31, 2018 +.Dd June 27, 2020 .Dt PS 1 .Os .Sh NAME @@ -545,7 +545,8 @@ command and arguments .It Cm cow number of copy-on-write faults .It Cm cpu -short-term CPU usage factor (for scheduling) +The processor number on which the process is executing (visible only on SMP +systems). .It Cm dsiz data size (in Kbytes) .It Cm emul