pstree -a gives SEGV

Dave Korn
Mon Jun 12 19:22:00 GMT 2006

    Hi all,

  Dunno about everyone else, but on my system "pstree -a" crashes with a SEGV
everytime.  On looking into it, it turns out to be because the process object
it creates for pid 1 (we don't have a real init process on cygwin) isn't fully
initialised (it works by lazy initialisation, creating the object for a given
pid when it first finds a reference to that pid as ppid of another process,
but it doesn't fill in the details until that pid is subsequently enumerated,
and we don't have a psuedo-entry in /proc/1, even though we use it as the ppid
of top-level cygwin processes, so the entry for pid 1 gets created but never
filled in and we crash when we try and print out its command line, since the
supposed argc is some uninitialised and generally huge/negative hex number).

  Anyway if anyone else wants "pstree -a" to work, I found the attached patch
solved the problem for me.  The first hunk fixes a minor build error, the
second ensures a sane default (i.e. empty) command line if there's no real
/proc entry for the pid.  You also may need to take care of config options and
adding -lintl, as described in the original announcement[*].

dk@rainbow /artimi/chips/tulla> /usr/build/install/bin/cygcheck.exe -c psmisc
Cygwin Package Information
Package              Version        Status
psmisc               21.5-1         OK
dk@rainbow /artimi/chips/tulla>


[*] -
Can't think of a witty .sigline today....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pstree-segv-fix.diff
Type: application/octet-stream
Size: 617 bytes
Desc: not available
URL: <>
-------------- next part --------------
Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list