version 1.53, 2004/03/09 07:18:26 |
version 1.56, 2004/08/18 01:10:59 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* $OpenXM: OpenXM_contrib2/asir2000/io/tcpf.c,v 1.52 2004/03/09 05:33:10 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/tcpf.c,v 1.55 2004/06/15 09:04:41 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 89 if((ind)<0||(ind)>=mpi_nprocs){error("invalid server i |
|
Line 89 if((ind)<0||(ind)>=mpi_nprocs){error("invalid server i |
|
if((ind)<0||(ind)>=mpi_nprocs){(ind)=-1;} |
if((ind)<0||(ind)>=mpi_nprocs){(ind)=-1;} |
#else |
#else |
#define valid_mctab_index(ind)\ |
#define valid_mctab_index(ind)\ |
if((ind)<0||(ind)>=m_c_i||\ |
if((ind)<I_am_server||(ind)>=m_c_i||\ |
((m_c_tab[ind].m<0)&&(m_c_tab[ind].c<0))){error("invalid server id");} |
((m_c_tab[ind].m<0)&&(m_c_tab[ind].c<0))){error("invalid server id");} |
#define check_valid_mctab_index(ind)\ |
#define check_valid_mctab_index(ind)\ |
if((ind)<0||(ind)>=m_c_i||\ |
if((ind)<I_am_server||(ind)>=m_c_i||\ |
((m_c_tab[ind].m<0)&&(m_c_tab[ind].c<0))){(ind)=-1;} |
((m_c_tab[ind].m<0)&&(m_c_tab[ind].c<0))){(ind)=-1;} |
#endif |
#endif |
|
|
Line 490 void Pregister_server(NODE arg,Q *rp) |
|
Line 490 void Pregister_server(NODE arg,Q *rp) |
|
STOQ(ind,*rp); |
STOQ(ind,*rp); |
} |
} |
|
|
|
#if !defined(VISUAL) |
|
#include <sys/file.h> |
|
#include <sys/types.h> |
|
#include <sys/stat.h> |
|
#include <pwd.h> |
|
|
|
static int find_executable(char *); |
|
static int find_executable_main(char *); |
|
|
|
static int find_executable(char *com) |
|
{ |
|
char *c,*s; |
|
int len; |
|
char dir[BUFSIZ],path[BUFSIZ]; |
|
|
|
for ( s = (char *)getenv("PATH"); s; ) { |
|
c = (char *)index(s,':'); |
|
if ( c ) { |
|
len = c-s; |
|
strncpy(dir,s,len); s = c+1; dir[len] = 0; |
|
} else { |
|
strcpy(dir,s); s = 0; |
|
} |
|
sprintf(path,"%s/%s",dir,com); |
|
if ( find_executable_main(path) ) |
|
return 1; |
|
} |
|
return 0; |
|
} |
|
|
|
static int find_executable_main(char *file) |
|
{ |
|
struct stat buf; |
|
|
|
if ( stat(file,&buf) || (buf.st_mode & S_IFDIR) ) |
|
return 0; |
|
if ( access(file,X_OK) ) |
|
return 0; |
|
else |
|
return 1; |
|
} |
|
|
|
#endif |
/* |
/* |
ox_launch_generic(host,launcher,server,use_unix,use_ssh,use_x,conn_to_serv) |
ox_launch_generic(host,launcher,server,use_unix,use_ssh,use_x,conn_to_serv) |
|
|
Line 523 void Pox_launch_generic(NODE arg,Q *rp) |
|
Line 566 void Pox_launch_generic(NODE arg,Q *rp) |
|
*rp = ret; |
*rp = ret; |
} |
} |
|
|
|
#if 0 |
|
void ox_launcher_101_generic(char *host,char *launcher, |
|
int use_unix,int use_ssh,int use_x,int conn_to_serv,Q *rp) |
|
{ |
|
int cs,cn,ind,id; |
|
char control_port_str[BUFSIZ]; |
|
Obj obj; |
|
|
|
#if !defined(VISUAL) |
|
if ( use_unix && !find_executable("xterm") ) use_x = 0; |
|
#endif |
|
control_port_str[0] = 0; |
|
do { |
|
generate_port(use_unix,control_port_str); |
|
if ( conn_to_serv ) { |
|
spawn_server_101(host,launcher, |
|
use_unix,use_ssh,use_x,conn_to_serv, |
|
control_port_str); |
|
cs = try_connect(use_unix,host,control_port_str); |
|
} else { |
|
cs = try_bind_listen(use_unix,control_port_str); |
|
if ( cs < 0 ) continue; |
|
spawn_laucher_101(host,launcher, |
|
use_unix,use_ssh,use_x,conn_to_serv, |
|
control_port_str); |
|
cs = try_accept(use_unix,cs); |
|
} |
|
} while ( cs < 0 ); |
|
|
|
/* client mode */ |
|
cn = get_iofp(cs,control_port_str,0); |
|
|
|
/* register server to the server list */ |
|
ind = register_server_101(use_unix,cn); |
|
|
|
STOQ(ind,*rp); |
|
} |
|
#endif |
|
|
void ox_launch_generic(char *host,char *launcher,char *server, |
void ox_launch_generic(char *host,char *launcher,char *server, |
int use_unix,int use_ssh,int use_x,int conn_to_serv,Q *rp) |
int use_unix,int use_ssh,int use_x,int conn_to_serv,Q *rp) |
{ |
{ |
Line 532 void ox_launch_generic(char *host,char *launcher,char |
|
Line 614 void ox_launch_generic(char *host,char *launcher,char |
|
Obj obj; |
Obj obj; |
MATHCAP server_mathcap; |
MATHCAP server_mathcap; |
|
|
|
#if !defined(VISUAL) |
|
if ( use_unix && !find_executable("xterm") ) use_x = 0; |
|
#endif |
control_port_str[0] = 0; |
control_port_str[0] = 0; |
server_port_str[0] = 0; |
server_port_str[0] = 0; |
do { |
do { |