[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [configure.ac/uClinux] Adding code for fork/vfork?
From: |
Bob Friesenhahn |
Subject: |
Re: [configure.ac/uClinux] Adding code for fork/vfork? |
Date: |
Thu, 14 Apr 2011 21:07:07 -0500 (CDT) |
User-agent: |
Alpine 2.01 (GSO 1266 2009-07-14) |
On Thu, 14 Apr 2011, Gilles wrote:
However, some applications use if/else blocks just as this one instead
of eg. "#ifdef HAVE_FOR" conditional compiling:
============
if (uClinux) {
*pid = vfork();
} else {
*pid = fork();
}
============
Is it possible to modify configure.ac so that it goes ahead and
compiles applications that handle fork/vfork without preprocessor
commands?
The proper solution for this is to have configure test for both fork()
and vfork() (and maybe posix_spawn()). Then you have to decide which
one you prefer:
In configure.ac:
AC_CHECK_FUNCS([fork posix_spawnp spawnvp vfork])
In the program:
#if HAVE_VFORK
use vfork
#if HAVE_POSIX_SPAWNP
use posix_spawn
#if HAVE_SPAWNVP
use spawnvp
#elif HAVE_FORK
use fork
#else
#error Need a way to fork a program!
#else
Vfork was supposed to be antique and going away but has been making a
resurgence in heavily-threaded programs, however, posix_spawnp() is
still preferred in that case (when available).
Bob
--
Bob Friesenhahn
address@hidden, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
- [configure.ac/uClinux] Adding code for fork/vfork?, Gilles, 2011/04/14
- Re: [configure.ac/uClinux] Adding code for fork/vfork?,
Bob Friesenhahn <=
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Gilles, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Harlan Stenn, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Gilles, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Mike Frysinger, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Bob Friesenhahn, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Andrew W. Nosenko, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Mike Frysinger, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Bob Friesenhahn, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Mike Frysinger, 2011/04/15
- Re: [configure.ac/uClinux] Adding code for fork/vfork?, Mike Frysinger, 2011/04/15