PPID in ps -efW not accurate

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Jun 7 17:31:00 GMT 2017


On Jun  7 13:10, Erik Soderquist wrote:
> The information exists in Windows somewhere, but either does not seem
> to be available to ps, or is not fetched by ps, and I don't know
> enough to know which...
> 
> I tested with both elevated and non-elevated bash sessions, and ps
> -efW shows 0 (zero) as the PPID for all Windows processes

This is accurate because Windows does not maintain a parent-child
relationship between processes.  That's why there's no Windows functions
to fetch a parent process PID or handle.

The only information available is the PID of a process this process
inherits handles from.  In the POSIX context that's equivalent with a
parent process, but not on Windows.  Therefore this info is only
available in the lower NT API(*).

Worse, given the fact that Windows reuses PIDs quickly after a process
died, this information can be totally wrong.


Corinna

(*) NtQueryInformationProcess(ProcessBasicInformation)

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170607/56c7a0b2/attachment.sig>


More information about the Cygwin mailing list