Commit 9e3d89b7 authored by petr@mysql.com's avatar petr@mysql.com

Fix Bug#14107 (IM test failures on QNX)

(v.2 with post-review fixes)
parent efe30a1c
...@@ -138,15 +138,25 @@ static int wait_process(My_process_info *pi) ...@@ -138,15 +138,25 @@ static int wait_process(My_process_info *pi)
static int start_process(Instance_options *instance_options, static int start_process(Instance_options *instance_options,
My_process_info *pi) My_process_info *pi)
{ {
#ifndef __QNX__
*pi= fork(); *pi= fork();
#else
/*
On QNX one cannot use fork() in multithreaded environment and we
should use spawn() or one of it's siblings instead.
Here we use spawnv(), which is a combination of fork() and execv()
in one call. It returns the pid of newly created process (>0) or -1
*/
*pi= spawnv(P_NOWAIT, instance_options->mysqld_path, instance_options->argv);
#endif
switch (*pi) { switch (*pi) {
case 0: case 0: /* never happens on QNX */
execv(instance_options->mysqld_path, instance_options->argv); execv(instance_options->mysqld_path, instance_options->argv);
/* exec never returns */ /* exec never returns */
exit(1); exit(1);
case 1: case -1:
log_info("cannot fork() to start instance %s", log_info("cannot create a new process to start instance %s",
instance_options->instance_name); instance_options->instance_name);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment