This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help understanding process tree


Yitzchak Scott-Thoennes wrote:

> > Right.  cmd is a non-cygwin program so it needs a cygwin stub to handle
> > being "execed".  sleep is a cygwin program and does not require any
> > hand holding.
> 
> Now go back and reread the sentence where he says "I'd like help
> understanding why..." :)

I was under the impression that the reason that Cygwin processes often
appear as orphans and not part of the process tree (from the standpoint
of a native win32 app that is) is due to supporting exec().  AFAIK there
is no direct way in the win32 API to replace a process with another, so
in order to exec() the parent must create a new process and then itself
exit - thus leaving the child with no parent process.

This is also the reason why Cygwin must maintain its own PID translation
table, since the above process results in the exec()'d process with a
new PID.  But exec() is supposed to replace a process, and not change
its PID, so Cygwin has to invent the notion of Cygwin PIDs that can
differ from Windows PIDs.

I could be off in my understanding of the above, however.

To the original poster... Try "procps aux --forest" if you want an
accurate picture of the Cygwin process tree, since procps is a Cygwin
program and thus will use Cygwin PIDs.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]