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: using spawn functions to avoid fork() errors


On 2/5/2014 7:07 AM, Steven Bardwell wrote:
From reading the Cygwin FAQ ("In most cases, you are better off using the
spawn family of calls if possible.") and
the Cygwin Highlights ("Fortunately, in most circumstances the spawn family
of calls provided by Cygwin can be substituted for a fork/exec pair with
only a little effort."), it sounds like there exists a family of API calls
that may help me avoid the 'Resource temporarily unavailable' errors from calling
fork().

However, I can't find any documentation on these spawn functions. I recoded
my application to use
posix_spawn() but I am getting the same 'Resource temporarily unavailable'
error so I suspect that it
is using fork() as well.

posix_spawn() comes from newlib and uses vfork.  You can take a look
at the code on-line for more info:

<http://cygwin.com/cgi-bin/cvsweb.cgi/src/newlib/libc/posix/posix_spawn.c?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=src>

An alternative that doesn't use fork was discussed here:

<http://cygwin.com/ml/cygwin/2012-01/msg00032.html>

The code referenced isn't part of Cygwin and may or may not work.  I have
no experience with it.  If you choose to use it, forward your comments and
questions directly to the author.

I did try the 'rebaseall' process to remove the error, but without any
success. I also checked the BLODA list.

I have no problem doing some recoding of my application to reliably solve my
issues with fork() -- can you all
point me in the direction of the 'spawn family of calls'?

See spawn.cc -> <http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/spawn.cc?rev=1.353&content-type=text/x-cvsweb-markup&cvsroot=src>


--
Larry

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

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


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