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: Cygwin fork implementation


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Sudhahar on 2/6/2006 5:33 AM:
> Hi,
>    In Cygwin fork code the statement
> 
> int res = setjmp (grouped.ch.jmp);
>   if (res)
>     res = fork_child (grouped.ch.parent, grouped.first_dll, grouped.load_dlls);
>   else
>     res = fork_parent (grouped.ch.parent, grouped.first_dll,
> grouped.load_dlls, esp, grouped.ch);
> 
> avoids the fork being called repeatedly by the created process of
> parent. Can anyone tell me how this actually happens. Thanks in
> advance for your time and comments.

If you are asking how setjmp works, it is not cygwin specific.  Any good
systems C programming book should give you more details, or you can read
what POSIX says:
http://www.opengroup.org/onlinepubs/009695399/functions/setjmp.html.

setjmp() is one of those MAGIC functions, that when paired with the
longjmp() in fork_parent(), returns 2 distinct values at different points
during execution.

You may also be interested in
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/how-cygheap-works.txt?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=src

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD51Z484KuGfSFAYARAvXNAJ0cgMN8AqYiOFeY7oVKQcHe5EvJ/ACgpFfU
l4KjZDRVF39JKEI41g/mYAc=
=yYHr
-----END PGP SIGNATURE-----

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