#include "dynamic-string.h"
#include "fatal-signal.h"
#include "list.h"
+#include "ovs-thread.h"
#include "poll-loop.h"
#include "signals.h"
#include "socket-util.h"
VLOG_DEFINE_THIS_MODULE(process);
-COVERAGE_DEFINE(process_sigchld);
COVERAGE_DEFINE(process_start);
struct process {
/* Initializes the process subsystem (if it is not already initialized). Calls
* exit() if initialization fails.
*
+ * This function may not be called after creating any additional threads.
+ *
* Calling this function is optional; it will be called automatically by
* process_start() if necessary. Calling it explicitly allows the client to
* prevent the process from exiting at an unexpected time. */
static bool inited;
struct sigaction sa;
+ assert_single_threaded();
if (inited) {
return;
}
* argv[0] is used as the name of the process. Searches the PATH environment
* variable to find the program to execute.
*
+ * This function may not be called after creating any additional threads.
+ *
* All file descriptors are closed before executing the subprocess, except for
* fds 0, 1, and 2.
*
pid_t pid;
int error;
+ assert_single_threaded();
+
*pp = NULL;
COVERAGE_INC(process_start);
error = process_prestart(argv);
pid = fork();
if (pid < 0) {
- VLOG_WARN("fork failed: %s", strerror(errno));
+ VLOG_WARN("fork failed: %s", ovs_strerror(errno));
return errno;
} else if (pid) {
/* Running in parent process. */
}
execvp(argv[0], argv);
fprintf(stderr, "execvp(\"%s\") failed: %s\n",
- argv[0], strerror(errno));
+ argv[0], ovs_strerror(errno));
_exit(1);
}
}
p->exited = true;
p->status = status;
} else if (retval < 0) {
- VLOG_WARN("waitpid: %s", strerror(errno));
+ VLOG_WARN("waitpid: %s", ovs_strerror(errno));
p->exited = true;
p->status = -1;
}