[BACK]Return to tcpf.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / io

Diff for /OpenXM_contrib2/asir2000/io/tcpf.c between version 1.44 and 1.51

version 1.44, 2003/12/09 03:07:45 version 1.51, 2004/03/05 06:14:50
Line 44 
Line 44 
  * 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.43 2003/12/03 09:32:36 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/tcpf.c,v 1.50 2003/12/13 08:03:56 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 131  void Pnd_exec_f4_red();
Line 131  void Pnd_exec_f4_red();
 void Pox_tcp_accept_102(),Pox_tcp_connect_102();  void Pox_tcp_accept_102(),Pox_tcp_connect_102();
 void Pox_send_102(),Pox_recv_102();  void Pox_send_102(),Pox_recv_102();
 void Pox_set_rank_102();  void Pox_set_rank_102();
   void Pox_get_rank_102();
 void Pox_reset_102();  void Pox_reset_102();
   void Pox_bcast_102();
   void Pox_reduce_102();
   
 void ox_launch_generic();  void ox_launch_generic();
   
Line 143  struct ftab tcp_tab[] = {
Line 146  struct ftab tcp_tab[] = {
         {"ox_get_serverinfo",Pox_get_serverinfo,-1},          {"ox_get_serverinfo",Pox_get_serverinfo,-1},
         {"generate_port",Pgenerate_port,-1},          {"generate_port",Pgenerate_port,-1},
   
           /* from master to client */
         {"ox_set_rank_102",Pox_set_rank_102,3},          {"ox_set_rank_102",Pox_set_rank_102,3},
           {"ox_tcp_accept_102",Pox_tcp_accept_102,3},
           {"ox_tcp_connect_102",Pox_tcp_connect_102,4},
           {"ox_reset_102",Pox_reset_102,1},
   
           {"ox_get_rank_102",Pox_get_rank_102,0},
         {"ox_send_102",Pox_send_102,2},          {"ox_send_102",Pox_send_102,2},
         {"ox_recv_102",Pox_recv_102,1},          {"ox_recv_102",Pox_recv_102,1},
         {"ox_tcp_accept_102",Pox_tcp_accept_102,2},          {"ox_bcast_102",Pox_bcast_102,-2},
         {"ox_tcp_connect_102",Pox_tcp_connect_102,3},          {"ox_reduce_102",Pox_reduce_102,-3},
         {"ox_reset_102",Pox_reset_102,1},  
   
         {"try_bind_listen",Ptry_bind_listen,1},          {"try_bind_listen",Ptry_bind_listen,1},
         {"try_connect",Ptry_connect,2},          {"try_connect",Ptry_connect,2},
Line 294  void Pox_reset_102(NODE arg,Q *rp)
Line 301  void Pox_reset_102(NODE arg,Q *rp)
         s = m_c_tab[index].c;          s = m_c_tab[index].c;
         ox_send_cmd(s,SM_reset_102);          ox_send_cmd(s,SM_reset_102);
         ox_flush_stream_force(s);          ox_flush_stream_force(s);
           *rp = 0;
 }  }
   
   void Pox_get_rank_102(LIST *rp)
   {
           Q n,r;
           NODE node;
   
           STOQ(nserver_102,n);
           STOQ(myrank_102,r);
           node = mknode(2,n,r);
           MKLIST(*rp,node);
   }
   
 void Pox_set_rank_102(NODE arg,Q *rp)  void Pox_set_rank_102(NODE arg,Q *rp)
 {  {
         Q nserver,rank;          Q nserver,rank;
Line 313  void Pox_set_rank_102(NODE arg,Q *rp)
Line 332  void Pox_set_rank_102(NODE arg,Q *rp)
         *rp = 0;          *rp = 0;
 }  }
   
 /* ox_tcp_accept_102(port,rank) */  /* ox_tcp_accept_102(server,port,rank) */
   
 void Pox_tcp_accept_102(NODE arg,Q *rp)  void Pox_tcp_accept_102(NODE arg,Q *rp)
 {  {
         char port_str[BUFSIZ];          int s;
         int port,s,use_unix,rank;          int     index = QTOS((Q)ARG0(arg));
   
         if ( IS_CYGWIN || !ARG0(arg) || NUM(ARG0(arg)) ) {          valid_mctab_index(index);
                 port = QTOS((Q)ARG0(arg));          s = m_c_tab[index].c;
                 sprintf(port_str,"%d",port);  
                 use_unix = 0;          ox_send_data(s,ARG1(arg));
         } else {          ox_send_data(s,ARG2(arg));
                 strcpy(port_str,BDY((STRING)ARG0(arg)));          ox_send_cmd(s,SM_tcp_accept_102);
                 use_unix = 1;          ox_flush_stream_force(s);
         }          *rp = 0;
         s = try_bind_listen(use_unix,port_str);  
         s = try_accept(use_unix,s);  
         rank = QTOS((Q)ARG1(arg));  
         if ( register_102(s,rank,1) < 0 )  
                 STOQ(-1,*rp);  
         else  
                 *rp = 0;  
 }  }
   
 /*  /*
  ox_tcp_connect_102(host,port,rank)   ox_tcp_connect_102(server,host,port,rank)
 */  */
   
 void Pox_tcp_connect_102(NODE arg,Q *rp)  void Pox_tcp_connect_102(NODE arg,Q *rp)
 {  {
         char port_str[BUFSIZ];          int s;
         char *host;          int     index = QTOS((Q)ARG0(arg));
         int port,s,use_unix,rank;  
   
         if ( IS_CYGWIN || !ARG1(arg) || NUM(ARG1(arg)) ) {          valid_mctab_index(index);
                 port = QTOS((Q)ARG1(arg));          s = m_c_tab[index].c;
                 sprintf(port_str,"%d",port);  
                 use_unix = 0;          ox_send_data(s,ARG1(arg));
         } else {          ox_send_data(s,ARG2(arg));
                 strcpy(port_str,BDY((STRING)ARG1(arg)));          ox_send_data(s,ARG3(arg));
                 use_unix = 1;          ox_send_cmd(s,SM_tcp_connect_102);
         }          ox_flush_stream_force(s);
         host = BDY((STRING)ARG0(arg));          *rp = 0;
         s = try_connect(use_unix,host,port_str);  
         rank = QTOS((Q)ARG2(arg));  
         if ( register_102(s,rank,0) < 0 )  
                 STOQ(-1,*rp);  
         else  
                 *rp = 0;  
 }  }
   
 /*  /*
Line 735  void spawn_server(char *host,char *launcher,char *serv
Line 740  void spawn_server(char *host,char *launcher,char *serv
                         if ( !fork() ) {                          if ( !fork() ) {
                                 setpgid(0,getpid());                                  setpgid(0,getpid());
                                 execlp("xterm","xterm","-name",OX_XTERM,"-T","ox_launch:local","-display",dname,                                  execlp("xterm","xterm","-name",OX_XTERM,"-T","ox_launch:local","-display",dname,
                                         "-geometry","60x10","-e",launcher,use_unix?".":"127.1",conn_str,                                          "-geometry","60x10","-xrm","XTerm*locale:false","-e",launcher,use_unix?".":"127.1",conn_str,
                                         control_port_str,server_port_str,server,dname,0);                                          control_port_str,server_port_str,server,dname,0);
                         }                          }
                 } else if ( dname && get_start_path(win_start) ) {                  } else if ( dname && get_start_path(win_start) ) {
Line 755  void spawn_server(char *host,char *launcher,char *serv
Line 760  void spawn_server(char *host,char *launcher,char *serv
                         setpgid(0,getpid());                          setpgid(0,getpid());
                         if ( dname )                          if ( dname )
                                 execlp("xterm","xterm","-name",OX_XTERM,"-T","ox_launch:local","-display",dname,                                  execlp("xterm","xterm","-name",OX_XTERM,"-T","ox_launch:local","-display",dname,
                                         "-geometry","60x10","-e",launcher,use_unix?".":"127.1",conn_str,                                          "-geometry","60x10","-xrm","XTerm*locale:false","-e",launcher,use_unix?".":"127.1",conn_str,
                                         control_port_str,server_port_str,server,dname,0);                                          control_port_str,server_port_str,server,dname,0);
                         else                          else
                                 execlp(launcher,launcher,use_unix?".":"127.1",conn_str,                                  execlp(launcher,launcher,use_unix?".":"127.1",conn_str,
Line 780  void spawn_server(char *host,char *launcher,char *serv
Line 785  void spawn_server(char *host,char *launcher,char *serv
                 if ( dname )                  if ( dname )
                         if ( use_ssh )                          if ( use_ssh )
                                 sprintf(cmd,                                  sprintf(cmd,
 "%s -f -n %s \"xterm -name %s -title ox_launch:%s -geometry 60x10 -e %s %s %s %s %s %s %s >&/dev/null\">/dev/null",  "%s -f -n %s \"xterm -name %s -title ox_launch:%s -geometry 60x10 -xrm 'XTerm*locale:false' -e %s %s %s %s %s %s %s >&/dev/null\">/dev/null",
                                 rsh,host,OX_XTERM,host,launcher,localhost,conn_str,                                  rsh,host,OX_XTERM,host,launcher,localhost,conn_str,
                                 control_port_str,server_port_str,server,"1");                                  control_port_str,server_port_str,server,"1");
                         else                          else
                                 sprintf(cmd,                                  sprintf(cmd,
 "%s -n %s \"xterm -name %s -title ox_launch:%s -display %s -geometry 60x10 -e %s %s %s %s %s %s %s >&/dev/null&\">/dev/null",  "%s -n %s \"xterm -name %s -title ox_launch:%s -display %s -geometry 60x10 -xrm 'XTerm*locale:false' -e %s %s %s %s %s %s %s >&/dev/null&\">/dev/null",
                                 rsh,host,OX_XTERM,host,dname,launcher,localhost,conn_str,                                  rsh,host,OX_XTERM,host,dname,launcher,localhost,conn_str,
                                 control_port_str,server_port_str,server,dname);                                  control_port_str,server_port_str,server,dname);
                 else                  else
Line 1008  void Pox_recv_102(NODE arg,Obj *rp)
Line 1013  void Pox_recv_102(NODE arg,Obj *rp)
         int rank = QTOS((Q)ARG0(arg));          int rank = QTOS((Q)ARG0(arg));
   
         ox_recv_102(rank,&id,rp);          ox_recv_102(rank,&id,rp);
   }
   
   void Pox_bcast_102(NODE arg,Obj *rp)
   {
           int rank = QTOS((Q)ARG0(arg));
           Obj data;
   
           if ( argc(arg) > 1 )
                   asir_push_one((Obj)ARG1(arg));
           ox_bcast_102(rank);
           *rp = (Obj)asir_pop_one();
   }
   
   void Pox_reduce_102(NODE arg,Obj *rp)
   {
           int root = QTOS((Q)ARG0(arg));
           STRING op;
           char *opname;
           void (*func)();
   
           op = (STRING)ARG1(arg);
           asir_assert(op,O_STR,"ox_reduce_102");
           opname = BDY(op);
           if ( !strcmp(opname,"+") )
                   func = arf_add;
           else if ( !strcmp(opname,"*") )
                   func = arf_mul;
           else {
                   error("ox_reduce_102 : operation not supported");
           }
           if ( argc(arg) > 2 )
                   asir_push_one((Obj)ARG2(arg));
           ox_reduce_102(root,func);
           *rp = (Obj)asir_pop_one();
 }  }
   
 void Pox_push_local(NODE arg,Obj *rp)  void Pox_push_local(NODE arg,Obj *rp)

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.51

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>