spawn problem

I’m having problems spawning a task in Neutrino. Here’s the section of
code that’s giving me the problem:

// start up analogIO
pid_t analogIOPid;
spawn_inheritance_type analogIOInherit;
char **argvAnalog = NULL;

analogIOInherit.flags = SPAWN_EXPLICIT_SCHED | SPAWN_SETSTACKMAX;
analogIOInherit.policy = SCHED_FIFO;
analogIOInherit.param.sched_priority = 55;
analogIOInherit.stack_max = 1024;

if ((analogIOPid = spawn("/cryobin/analogIO", 0, 0, &analogIOInherit,
argvAnalog, NULL)) == -1)
printf("\nerror opening analogIO process: errno %d\n", errno);

else printf("\nanalogIO process started succesfully\n");




When I run this code it fails and returns an errno of 22, which is EINVAL
(invalid argument). I can run the executable ‘analogIO’ from the command
prompt without any problems but I can’t start it from code.

Any help is greatly appreciated.

Thanks,
Dan

On Mon, 4 Jun 2001 19:31:58 -0700, “Dan Helmick”
<danielhelmick@earthlink.net> wrote:

The argv param should not be NULL?

ako

I’m having problems spawning a task in Neutrino. Here’s the section of
code that’s giving me the problem:

// start up analogIO
pid_t analogIOPid;
spawn_inheritance_type analogIOInherit;
char **argvAnalog = NULL;

analogIOInherit.flags = SPAWN_EXPLICIT_SCHED | SPAWN_SETSTACKMAX;
analogIOInherit.policy = SCHED_FIFO;
analogIOInherit.param.sched_priority = 55;
analogIOInherit.stack_max = 1024;

if ((analogIOPid = spawn("/cryobin/analogIO", 0, 0, &analogIOInherit,
argvAnalog, NULL)) == -1)
printf("\nerror opening analogIO process: errno %d\n", errno);

else printf("\nanalogIO process started succesfully\n");




When I run this code it fails and returns an errno of 22, which is EINVAL
(invalid argument). I can run the executable ‘analogIO’ from the command
prompt without any problems but I can’t start it from code.

Any help is greatly appreciated.

Thanks,
Dan

That was my problem. Although the documentation left me to believe that it
was possible to pass a NULL pointer:

The argv argument is a pointer to an argument vector. The value in
argv[0] should point to the filename of program being loaded, but can be
NULL if no arguments are being passed. The last member of argv must be a
NULL pointer. The value of argv can’t be NULL.

But here’s whaat worked:

char *argvAnalog[] = {"/cryobin/analogIO", NULL};

and then, spawn( argvAnalog[0], 0, 0, &analogIOInherit, argvAnalog, NULL );

Thanks Julian and Andrzej.

-Dan





“Andrzej Kocon” <ako@box43.gnet.pl> wrote in message
news:3b1e326b.840134@inn.qnx.com

On Mon, 4 Jun 2001 19:31:58 -0700, “Dan Helmick”
danielhelmick@earthlink.net> > wrote:

The argv param should not be NULL?

ako

I’m having problems spawning a task in Neutrino. Here’s the section of
code that’s giving me the problem:

// start up analogIO
pid_t analogIOPid;
spawn_inheritance_type analogIOInherit;
char **argvAnalog = NULL;

analogIOInherit.flags = SPAWN_EXPLICIT_SCHED | SPAWN_SETSTACKMAX;
analogIOInherit.policy = SCHED_FIFO;
analogIOInherit.param.sched_priority = 55;
analogIOInherit.stack_max = 1024;

if ((analogIOPid = spawn("/cryobin/analogIO", 0, 0, &analogIOInherit,
argvAnalog, NULL)) == -1)
printf("\nerror opening analogIO process: errno %d\n", errno);

else printf("\nanalogIO process started succesfully\n");




When I run this code it fails and returns an errno of 22, which is EINVAL
(invalid argument). I can run the executable ‘analogIO’ from the command
prompt without any problems but I can’t start it from code.

Any help is greatly appreciated.

Thanks,
Dan

In article <9fhg6n$rgu$1@inn.qnx.com>, danielhelmick@earthlink.net
says…

I’m having problems spawning a task in Neutrino. Here’s the section of
code that’s giving me the problem:

// start up analogIO
pid_t analogIOPid;
spawn_inheritance_type analogIOInherit;
char **argvAnalog = NULL;
^^^ EINVAL

The first parameter - the name of the process ie “analogIO”