Project

General

Profile

Actions

Bug #12250

closed

zonestat_usage(): stderr vs. stdio dilemma

Added by Marcel Telka over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

The zonestat_usage() function in zonestat prints half of the usage to stderr and half of it to stdout:

$ /usr/bin/zonestat 2>/dev/null
    -T    Print timestamp. Valid timestamps are:
              "d"       Date as specifed by date(1) command
              "u"       Unix time as returned by time(2)
              "i"       ISO 8601 timestamp "YYYYMMDDThhmmssZ" 
    -R    Print reports at end or after each report interval.
            Valid reports are:
              "total"   Usage of each zone
              "average" Usage of each zone while running
              "high"    Maximum usage of each zone
    -q    Quiet.  Do not print intervals.  Only print reports.
    -p    Machine parseable output.
    -P    Select desired lines in parseable output.
              "resource"        Lines describing each resource
              "total"   Total usage of each resource
              "system"  System usage of each resource
              "zones"   Per-zone usage of each resource
              "header"  Header lines between intervals and reports
    -S    Sort output by the specified columns:
              "name"    by name alphanumerically
              "used"    by percent of resource used
              "cap"     by configured cap
              "pcap"    by percent of cap used
              "shr"     by shares configured
              "pshru"   by percent of share used
              "cpu"     Sort summary by cpu
              "physical-memory" Sort summary by physical memory
              "virtual-memory"  Sort summary by virtual memory
$

We should make sure that the whole zonestat usage goes consistently either to stderr or stdout.

Actions #1

Updated by Marcel Telka over 1 year ago

  • Description updated (diff)
Actions #3

Updated by Marcel Telka over 1 year ago

Testing Done

Without the fix:

$ /usr/bin/zonestat 2>/dev/null | wc -l
27
$ /usr/bin/zonestat 2>&1 >/dev/null | wc -l
31
$

With the fix:

$ proto/root_i386/usr/bin/zonestat 2>/dev/null | wc -l
0
$ proto/root_i386/usr/bin/zonestat 2>&1 >/dev/null | wc -l
58
$
Actions #4

Updated by Marcel Telka over 1 year ago

  • Status changed from In Progress to Pending RTI
Actions #5

Updated by Electric Monk over 1 year ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit 881f4659ab3a3d7bac3274ca7320c076fcd007de

commit  881f4659ab3a3d7bac3274ca7320c076fcd007de
Author: Marcel Telka <marcel@telka.sk>
Date:   2020-01-27T14:54:00.000Z

    12250 zonestat_usage(): stderr vs. stdio dilemma
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF