This is the mail archive of the cygwin-developers 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: Extend faq.using to discuss fork failures


On 8/19/2011 9:43 AM, Ryan Johnson wrote:
> I propose to add an entry to cygwin's faq.using which covers fork
> failures.

Good idea.

> [spawn stuff in /usr/include/process.h]

As described upthread, the declarations in this header are declaring
*cygwin* implementations of spawn() functions.  To get to the native
windows versions, you'd need to
  1) include /usr/i686-pc-mingw32/sys-root/mingw/include/process.h
  2) and link against /usr/i686-pc-mingw32/sys-root/mingw/lib/libmsvcrt.a

-- which is to say, use the mingw compiler.  And that takes you right
out of "cygwin" solutions...

> Why does fork fail so often on my system?
> 
> 2. Rebase your system (see /usr/share/doc/Cygwin/rebase-3.0.1.README).

Don't refer to the file by its version number; it's either going to
change, or disappear as soon as Jason gets back.  Maybe:
	/usr/share/doc/Cygwin/rebase-x.y.z.README
or
	/usr/share/doc/Cygwin/rebase*.README

> 3. With Vista and later, use peflagsall to set the TS-aware bit on all
> cygwin dlls

As Corinna mentioned, you probably mean the dynamic base bit.
But...this usually causes more harm that good IIRC -- see
	http://cygwin.com/ml/cygwin-apps/2011-06/msg00070.html
for a summary and some links to other discussions.

> 4. If you have access to the source code of the offending application
> (this applies to all cygwin packages), consider replacing calls to
> fork() with calls to the spawn family of functions. These are a native
> (= reliable and highly efficient) replacement for fork+exec, which is by
> far the most common usage of fork(), and are documented at
> http://msdn.microsoft.com/en-us/library/20y988d2%28v=VS.100%29.aspx.

As stated earlier, recommending the use of msvcrt spawn*() is very
un-cygwin -- even if it were possible to do so (see above wrt
/usr/i686-pc-mingw32/sys-root/mingw/*).  Simply using *cygwin's*
(deprecated) spawn*() functions won't help much either unless the user
REALLY knows what they are doing; and if THAT were the case, (a) they
wouldn't need this FAQ, and (b) they'd know to use the POSIX *_spawn()
functions instead.

--
Chuck


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