public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: ming exec forks ???
@ 1999-12-02 19:32 Earnie Boyd
  1999-12-31 13:28 ` Earnie Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Earnie Boyd @ 1999-12-02 19:32 UTC (permalink / raw)
  To: Keraba; +Cc: cygwin

--- Mumit Khan <khan@NanoTech.Wisc.EDU> wrote:
> Keraba <keraba@yahoo.com> writes:
> > Hi,
> > 
> > I'm having trouble with the execv() system call. With the Cygwin
> > gcc and libraries it works fine, but with the Ming equivalents
> > it acts more like fork(), spawning off a child then continuing,
> > without waiting for the child to die first.
> 
> I don't know what the problem is, but under windows, you probably
> want _spawnv[pe] instead. Go to MS web site and search the docs
> -- it's all online.
> 

Typically in UNIX your code would fork() and you would set the child process to
execv() and you set the parent process to wait on the child.  In both unix and
win32 the execv() function replaces the current process with that which is
called so that you no longer have the calling process only the called process. 

When you fork you actually are starting another process of the same binary with
a copy of all of the variables in tact.  The fork in the second process returns
with a value of zero to indicate that this is the child process. The fork in
the first process returns the value of the process id created for the second
process and you then know to wait on the child.

The _spawnv[pe] function differs from the fork function in that it doesn't
create a copy of the current process.  Instead, the created process is used to
execute the process passed in the arguments and you tell it to either WAIT or
NO_WAIT.  If you NO_WAIT, it will return the created process id.  If you WAIT
it will return either zero or non-zero to indicate a valid completion.

Hope this helps,

=====
Earnie Boyd < mailto:earnie_boyd@yahoo.com >
Cygwin Newbies, please visit
< http://www.freeyellow.com/members5/gw32/index.html >
__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread
* ming exec forks ???
@ 1999-12-02 17:42 Keraba
  1999-12-02 18:17 ` Mumit Khan
  1999-12-31 13:28 ` Keraba
  0 siblings, 2 replies; 6+ messages in thread
From: Keraba @ 1999-12-02 17:42 UTC (permalink / raw)
  To: cygwin

Hi,

I'm having trouble with the execv() system call. With the Cygwin
gcc and libraries it works fine, but with the Ming equivalents
it acts more like fork(), spawning off a child then continuing,
without waiting for the child to die first.

I'm sorry, I'd write to the ming-gcc list if I knew of one.

If someone could suggest a replacement function to use, or
direct me towards the ming-gcc mailing list, I'd most
appreciate it.

__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-12-31 13:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-02 19:32 ming exec forks ??? Earnie Boyd
1999-12-31 13:28 ` Earnie Boyd
  -- strict thread matches above, loose matches on Subject: below --
1999-12-02 17:42 Keraba
1999-12-02 18:17 ` Mumit Khan
1999-12-31 13:28   ` Mumit Khan
1999-12-31 13:28 ` Keraba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).