Web lists-archives.com

Re: PPID in ps -efW not accurate




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

Attachment: signature.asc
Description: PGP signature