Bug #12037


ptree zone handling is broken

Added by John Levon about 3 years ago. Updated almost 3 years ago.

Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:
External Bug:



11906 Add line drawing characters to ptree(1)

ptree zone handling is broken.
The problem is that proc_walk is defined not to iterate on SSYS procs. But this
means we don't include zone's "zsched" processes. As a result, all zone processes
end up as orphaned children of proc0, and are therefore ignored unless -a is also specified.

This can hopefully be fixed by adding a PROC_WALK_SYS flag to proc_walk().

Related issues

Related to illumos gate - Feature #11906: Add line drawing characters to ptree(1)ClosedJason King

Actions #2

Updated by Jason King about 3 years ago

  • Related to Feature #11906: Add line drawing characters to ptree(1) added
Actions #3

Updated by Jason King about 3 years ago

To test, I built new versions of libproc and ptree w/ the changes. I then ran ptree, setting LD_LIBRARY_PATH so ptree used the updated libproc (verified by running ldd after setting LD_LIBRARY_PATH), and then compared the output to a copy of ptree from prior to #11906 (without LD_LIBRARY_PATH set as well). Aside from the pid for each respective ptree invocation, the output was identical (ignoring minor whitespace differences).

I then preformed the same test, but on a SmartOS zone that was up and running (ptree -z zonename). The output from both the older ptree and the new ptree were identical (ignoring minor whitespace differences).

Actions #4

Updated by Jason King almost 3 years ago

To expound, the whitespace differences are that the #11906 changed PIDWIDTH from 5 to 6 to match the value of PID_MAX which causes the spacing between the pid value and the psargs output to differ. ptree -g formatting gets messed up with 6 digit pids without the that change. The output of ptree is unstable, so it seemed both sensible and permissible to make the PIDWIDTH agree with PID_MAX.

Actions #5

Updated by Jason King almost 3 years ago

I also tested the man page update by manually running mandoc on the new man page and examining the output to make sure the formatting and content all looked correct.

Actions #6

Updated by Electric Monk almost 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit a63fed2a0384be5aa3f2ff7a38aac1153c549e87

commit  a63fed2a0384be5aa3f2ff7a38aac1153c549e87
Author: Jason King <>
Date:   2019-12-12T01:05:00.000Z

    12037 ptree zone handling is broken
    Reviewed by: John Levon <>
    Reviewed by: Andy Fiddaman <>
    Reviewed by: Robert Mustacchi <>
    Approved by: Dan McDonald <>


Also available in: Atom PDF