]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ps(1): reuse keyword "cpu" to show CPU number
authorpstef <pstef@FreeBSD.org>
Sat, 27 Jun 2020 19:09:33 +0000 (19:09 +0000)
committerpstef <pstef@FreeBSD.org>
Sat, 27 Jun 2020 19:09:33 +0000 (19:09 +0000)
commiteb1c123d53e1a5fe81d3c3a35481eef1dec9b88b
tree87615f629766a4927a8f6d4f2f7feb70e41d5704
parentc4c379084ce6c6027f77f7484b6d3b570a025c7d
ps(1): reuse keyword "cpu" to show CPU number

This flag will now show the processor number on which a process is running.

This change was inspired by PR129965. Initially I didn't think that the
patch attached to it was correct -- it sacrificed ki_estcpu use in "cpu"
for ki_lastcpu and I thought that the old functionality should be kept and
the new (cpu#) one added to it. But I've since discovered that ki_estcpu is
sched_4bsd-specific. What's worse, it represents the same thing as
ki_pctcpu, except ki_pctcpu is universal -- so "%cpu" has been using it
successfully. Therefore, I've decided to replace information based on
ki_estcpu with information based on ki_oncpu/ki_lastcpu.

Key parts of the code and manual changes were borrowed from top(1).

PR: 129965
Reported by: Nikola Knežević
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25377
bin/ps/extern.h
bin/ps/keyword.c
bin/ps/print.c
bin/ps/ps.1
bin/ps/ps.c