Date: Sat, 4 Jul 2020 06:34:55 +0000 (UTC) From: Piotr Pawel Stefaniak <pstef@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: r362924 - stable/12/bin/ps Message-ID: <202007040634.0646YtFN033001@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007040634.0646YtFN033001>