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: Replacing setup.exe and cygcheck with dpkg (Was: Re: cygcheck typo in both manpage and --help)


On Mar  9 19:08, Sjors Gielen wrote:
> I think I checked how Cygwin implements fork() a while ago, can't really  
> remember though. But on a fork(), do processes inherit all information  
> on dll's, et cetera? Or do they reload the dll and re-check the  
> addresses of entry points and all?

Very basically, the executable is started again via CreateProcess, then
Cygwin copies the parent's data segments into the child.  The important
faxct here is that the actual load process of the child is done by the
Windows loader.  If you changed the Cygwin DLL in the meantime, the new
process will load the new Cygwin DLL, not the old one.  From there it
goes downhill because the data layout of the new DLL is different from
the layout in the old DLL loaded with the parent process.

> I *think* this cygfoo1_2_3.dll system does not work with the Cygwin dll  
> itself, because that all still happens completely outside of Cygwin  
> scope

Yes.  This happens because we're using Windows API and thus Windows
loader to load processes.  The Windows API simply hasn't been designed
to fork.  That's why Cygwin has to do all the tricky and not very
performant stuff before and after loading a process.  Actually the
native NT API is capable to fork a process and that's used, for
instance, in Interix.  However, Interix is its entire self-contained
POSIX subsystem, distinct from Windows, while Cygwin processes are
running inside of the Windows subsystem.  Unfortunately important parts
of the API used to attach a new process to the Windows subsystem are not
documented.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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]