OpenSolaris

Printable Version Enter a New Search
Bug ID 4912227
Synopsis ptree call returns zero on failure
State 10-Fix Delivered (Fix available in build)
Category:Subcategory utility:proc
Keywords
Responsible Engineer Eric Schrock
Reported Against 5.8 , 5.10
Duplicate Of
Introduced In
Commit to Fix s10_44
Fixed In s10_44
Release Fixed solaris_10(s10_44) , solaris_9u6(s9u6_06) (Bug ID:2073858)
Related Bugs
Submit Date 26-August-2003
Last Update Date 16-February-2007
Description
When executing /usr/bin/ptree [-a] $pid, where $pid is invalid, /usr/bin/ptree will return 0 as if the call had succeded with no stderr or stdout generated. 

Example output:
---------------
$ ps -A | grep 47824
$ /usr/bin/ptree 47824
$ echo $?
0
$

Below is some of the output of truss with ptree. 
> 
> 
> on execution of ptree with invalid pid:
> -------------------------------------
> open("/proc/105371/psinfo", O_RDONLY)           = 5
> read(5, "\0\0\0\0\0\0\001\0019B9B".., 416)      = 416
> close(5)                                        = 0
> getdents(3, 0x100103178, 8192)                  = 0
> close(3)                                        = 0
> _exit(0)                                            <--We just exit 0
> 							(not correct)
> 
> On execution of ptree with valid pid:
> -------------------------------------
> open("/proc/105373/psinfo", O_RDONLY)           = 5
> read(5, "\0\0\0\0\0\0\001\0019B9D".., 416)      = 416
> close(5)                                        = 0
> getdents(3, 0x100103178, 8192)                  = 0
> close(3)                                        = 0
> ioctl(1, TCGETA, 0xFFFFFFFF7FFFD7E8)            = 0
> fstat(1, 0xFFFFFFFF7FFFD778)                    = 0
> 100321 /usr/dt/bin/dtlogin -daemon
> write(1, " 1 0 0 3 2 1   / u s r /".., 35)      = 35
>    write(1, "    ", 2)                           = 2
> 101805 /usr/dt/bin/dtlogin -daemon
> ....
Work Around
N/A
Comments
N/A