delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/02/06/09:00:40

X-Spam-Check-By: sourceware.org
Message-ID: <43E75678.3000009@byu.net>
Date: Mon, 06 Feb 2006 07:00:24 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: Sudhahar <jsudha80 AT gmail DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: Cygwin fork implementation
References: <46ca01fa0602060433u59a23ea3id3e4ae0da44b6073 AT mail DOT gmail DOT com>
In-Reply-To: <46ca01fa0602060433u59a23ea3id3e4ae0da44b6073@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019