Hi. I’m attempting to port an existing QNX 4 application to 6.2.1. I
have a resource manager that spawns other processes as necessary. A
config file can be used to specify which node the process should be
spawned on. As long as I specify the local node, everything works fine.
When I attempt to specify a remote node, however, the spawn fails with
errno 3, or ESRCH. The spawn() documentation doesn’t list this error;
could someone give me some ideas what I should look for?
Both nodes, named dev-1 and dev-2, are visible and browsable in /net/ on
both machines.
Josh
Following up to my own post, if I try to do a ‘shutdown -n dev-2’ from
dev-1, I get the same error:
shutdown -n dev-2
unable to spawn on remote node: No such file or directory
Josh
Josh Hamacher wrote:
Hi. I’m attempting to port an existing QNX 4 application to 6.2.1. I
have a resource manager that spawns other processes as necessary. A
config file can be used to specify which node the process should be
spawned on. As long as I specify the local node, everything works fine.
When I attempt to specify a remote node, however, the spawn fails with
errno 3, or ESRCH. The spawn() documentation doesn’t list this error;
could someone give me some ideas what I should look for?
Both nodes, named dev-1 and dev-2, are visible and browsable in /net/ on
both machines.
Josh
Try:
on -d -n dev-2 shutdown
AFAIK the -n option is currently broken for shutdown.
Jim
“Josh Hamacher” <jh@faac.com> wrote in message
news:baarcd$dm0$1@inn.qnx.com…
Following up to my own post, if I try to do a ‘shutdown -n dev-2’ from
dev-1, I get the same error:
shutdown -n dev-2
unable to spawn on remote node: No such file or directory
Josh
Josh Hamacher wrote:
Hi. I’m attempting to port an existing QNX 4 application to 6.2.1. I
have a resource manager that spawns other processes as necessary. A
config file can be used to specify which node the process should be
spawned on. As long as I specify the local node, everything works fine.
When I attempt to specify a remote node, however, the spawn fails with
errno 3, or ESRCH. The spawn() documentation doesn’t list this error;
could someone give me some ideas what I should look for?
Both nodes, named dev-1 and dev-2, are visible and browsable in /net/ on
both machines.
Josh
It just struck me as an odd coincidence that the shutdown -n failed with
the same error as the spawn() and so I thought they might be related.
But I’m still curious as to why attempting to spawn a process on a
different node causes spawn() to fail with errno ESRCH?
Josh
Jim Douglas wrote:
Try:
on -d -n dev-2 shutdown
AFAIK the -n option is currently broken for shutdown.
Jim
“Josh Hamacher” <> jh@faac.com> > wrote in message
news:baarcd$dm0$> 1@inn.qnx.com> …
Following up to my own post, if I try to do a ‘shutdown -n dev-2’ from
dev-1, I get the same error:
shutdown -n dev-2
unable to spawn on remote node: No such file or directory
Josh
Josh Hamacher wrote:
Hi. I’m attempting to port an existing QNX 4 application to 6.2.1. I
have a resource manager that spawns other processes as necessary. A
config file can be used to specify which node the process should be
spawned on. As long as I specify the local node, everything works fine.
When I attempt to specify a remote node, however, the spawn fails with
errno 3, or ESRCH. The spawn() documentation doesn’t list this error;
could someone give me some ideas what I should look for?
Both nodes, named dev-1 and dev-2, are visible and browsable in /net/ on
both machines.
Josh
\
Josh Hamacher <jh@faac.com> wrote:
Ping?
Wanna post the code you are using to invoke spawn? Be sure to include
how you setup the inheritance structure.
chris
–
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
Sure. I simplified it as much as I could, since most of the settings
come from a configuration file and the parsing code is mixed in. If
you’d prefer, I can post the full block, but I’m pretty certain I didn’t
cut anything important out.
Josh
for ( /* each program to spawn */ ) {
char *argv[3];
char *cmd;
struct inheritance inherit;
char priority[16];
char *tmp;
memset(&inherit, 0, sizeof(inherit));
// Read cmd, priority from the config file.
// cmd will be of form “./bin/program”,
// priority will be “14”.
// Read the node to spawn to into tmp. This will
// be “dev-1” or “dev-2” for now.
inherit.flags |= SPAWN_SETND;
if (netmgr_strtond(tmp, NULL) == -1) {
return -1;
}
inherit.nd = netmgr_strtond(tmp, NULL);
// Read whether the program should be spawned held
// for debugging purposes; it isn’t.
if ( /* spawn program held */ ) {
inherit.flags |= SPAWN_HOLD;
}
argv[0] = strdup(basename(cmd));
argv[1] = strdup(priority);
argv[2] = NULL;
if (spawn(cmd, 0, NULL, &inherit, argv, NULL) == -1) {
return -1;
}
free(argv[0]);
free(argv[1]);
}
Try this out on your network. Takes one arg, the name of the node.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <spawn.h>
#include <libgen.h>
#include <string.h>
int main( int argc, char **argv )
{
char *args[3];
char *cmd = “/bin/uname”;
struct inheritance inherit;
memset(&inherit, 0, sizeof(inherit));
if( argc > 1 ) {
inherit.flags |= SPAWN_SETND;
inherit.nd = netmgr_strtond(argv[1], NULL);
if( inherit.nd == -1 ) {
perror( “netmgr_strtond()” );
return EXIT_FAILURE;
}
}
args[0] = strdup(basename(cmd));
args[1] = “-a”;
args[2] = NULL;
fprintf( stderr, “\n” );
if( spawn( cmd, 0, NULL, &inherit, args, NULL ) == -1 ) {
perror( “spawn()” );
fprintf( stderr, " cmd: %s\n", cmd );
fprintf( stderr, " argv[0]: %s\n", args[0] );
return -1;
}
sleep(1);
fprintf( stderr, “\n” );
return EXIT_SUCCESS;
}
\
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
This program worked fine. So it’s something that I’m doing in my code?
Josh
Chris McKillop wrote:
Try this out on your network. Takes one arg, the name of the node.
#include <stdlib.h
#include <stdio.h
#include <unistd.h
#include <spawn.h
#include <libgen.h
#include <string.h
int main( int argc, char **argv )
{
char *args[3];
char *cmd = “/bin/uname”;
struct inheritance inherit;
memset(&inherit, 0, sizeof(inherit));
if( argc > 1 ) {
inherit.flags |= SPAWN_SETND;
inherit.nd = netmgr_strtond(argv[1], NULL);
if( inherit.nd == -1 ) {
perror( “netmgr_strtond()” );
return EXIT_FAILURE;
}
}
args[0] = strdup(basename(cmd));
args[1] = “-a”;
args[2] = NULL;
fprintf( stderr, “\n” );
if( spawn( cmd, 0, NULL, &inherit, args, NULL ) == -1 ) {
perror( “spawn()” );
fprintf( stderr, " cmd: %s\n", cmd );
fprintf( stderr, " argv[0]: %s\n", args[0] );
return -1;
}
sleep(1);
fprintf( stderr, “\n” );
return EXIT_SUCCESS;
}
Josh Hamacher <jh@faac.com> wrote:
This program worked fine. So it’s something that I’m doing in my code?
That would be the implication. But It is hard to say 100%.
chris
–
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
Simple thing - if I specify ‘./bin/program’, it fails. If I do
‘/path/bin/program’, it works (well, the spawn() works, I have other
problems then). This same code worked under 6.2.0 using a relative
path, so I’m guessing something must have changed in 6.2.1. Thanks for
the help, I should have tried that earlier.
Josh
Chris McKillop wrote:
Josh Hamacher <> jh@faac.com> > wrote:
This program worked fine. So it’s something that I’m doing in my code?
That would be the implication. But It is hard to say 100%.
chris