[Toybox] [PATCH] top: differentiate tasks (processes) and threads in the header.

enh enh at google.com
Fri Feb 15 16:32:49 PST 2019


(split out from the unlikely-to-be-accepted patch that tried to
auto-size the PID column. i'll come back to that some day, but may as
well get this trivial change in now.)

On Fri, Feb 15, 2019 at 4:31 PM enh <enh at google.com> wrote:
>
> ---
>  toys/posix/ps.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/toys/posix/ps.c b/toys/posix/ps.c
> index faddf685..ea383bfb 100644
> --- a/toys/posix/ps.c
> +++ b/toys/posix/ps.c
> @@ -1556,8 +1556,8 @@ static void top_common(
>            for (i = 0; i<mix.count; i++)
>              run[1+stridx("RSTZ", *string_field(mix.tb[i], &field))]++;
>            sprintf(toybuf,
> -            "Tasks: %d total,%4ld running,%4ld sleeping,%4ld stopped,"
> -            "%4ld zombie", mix.count, run[1], run[2], run[3], run[4]);
> +            "%ss: %d total,%4ld running,%4ld sleeping,%4ld
> stopped,%4ld zombie",
> +            FLAG(H)?"Thread":"Task", mix.count, run[1], run[2],
> run[3], run[4]);
>            lines = header_line(lines, 0);
>
>            if (readfile("/proc/meminfo", toybuf, sizeof(toybuf))) {
> --
> 2.21.0.rc0.258.g878e2cd30e-goog



More information about the Toybox mailing list