Implemented support for posix_spawn() and (main change): always use vfork() for starting external commands

This commit is contained in:
Jean-Francois Dockes
2015-05-27 16:24:18 +02:00
parent eb79621fcf
commit 9992a6f4f1
10 changed files with 203 additions and 38 deletions
+5
View File
@@ -15,6 +15,11 @@
/* Path to the file program */
#undef FILE_PROG
/* Define to 1 if you have the <spawn.h> header file. */
#undef HAVE_SPAWN_H
#undef HAVE_POSIX_SPAWN
#undef USE_POSIX_SPAWN
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-1
View File
@@ -1 +0,0 @@
autoconfig.h
+10 -9
View File
@@ -149,17 +149,18 @@ RclConfig *recollinit(RclInitFlags flags,
ExecCmd::useVfork(true);
#else
// Keep threads init behind log init, but make sure it's done before
// we do the vfork choice !
// we do the vfork choice ! The latter is not used any more actually,
// we always use vfork except if forbidden by config.
config->initThrConf();
bool intern_noThr = config->getThrConf(RclConfig::ThrIntern).first == -1;
bool split_noThr = config->getThrConf(RclConfig::ThrSplit).first == -1;
bool write_noThr = config->getThrConf(RclConfig::ThrDbWrite).first == -1;
if (intern_noThr && split_noThr && write_noThr) {
LOGDEB0(("rclinit: single-threaded execution: use vfork\n"));
ExecCmd::useVfork(true);
bool novfork;
config->getConfParam("novfork", &novfork);
if (novfork) {
LOGDEB0(("rclinit: will use fork() for starting commands\n"));
ExecCmd::useVfork(false);
} else {
LOGDEB0(("rclinit: multi-threaded execution: do not use vfork\n"));
ExecCmd::useVfork(false);
LOGDEB0(("rclinit: will use vfork() for starting commands\n"));
ExecCmd::useVfork(true);
}
#endif