--- mpich-1.2.5-orig/mpid/ch_p4/p4/lib/p4_sock_cr.c Mon Jan 13 10:23:33 2003 +++ mpich-1.2.5/mpid/ch_p4/p4/lib/p4_sock_cr.c Fri May 2 17:38:15 2003 @@ -424,19 +424,69 @@ int net_create_slave( int serv_port, int child_pid = rc = fork_p4(); if (rc == 0) { + + +/* #define USE_ONLY_MOSRUN */ +#ifdef USE_ONLY_MOSRUN + char local_cmd[1024] = "mosrun"; + char * mos_args; + mos_args = getenv("MOSRUN_ARGS"); + if(!mos_args) mos_args="-l"; + + p4_dprintfl( 80, "Using mosrun instead of rsh\n" ); + + /* TODO: Perhaps there's a nicer way than a bunch + of strcat's ? */ + strcat(local_cmd, " "); + strcat(local_cmd, mos_args); + strcat(local_cmd, " "); + strcat(local_cmd, pgm); + strcat(local_cmd, " "); + strcat(local_cmd, myhostname); + strcat(local_cmd, " "); + strcat(local_cmd, serv_port_c); + strcat(local_cmd, " "); + strcat(local_cmd, am_slave_c); + strcat(local_cmd, " "); + strcat(local_cmd, "-p4yourname"); + strcat(local_cmd, " "); + strcat(local_cmd, host); + strcat(local_cmd, " "); + strcat(local_cmd, "-p4rmrank"); + strcat(local_cmd, " "); + strcat(local_cmd, rm_rank_str); + + rc = execlp("bash", "bash", "-c", local_cmd, NULL); + + +#else /* !USE_ONLY_MOSRUN */ /* define SHORT_CIRCUIT_LOCALHOST */ -/* This doesn't work yet. redirection of stdin/out/error are undoubtedly - part of the problem. We'll leave this for the next release */ +/* this is untested... Good luck! */ #ifdef SHORT_CIRCUIT_LOCALHOST /* If host is localhost or myhost, then we don't need to run - remote shell (do we? what about stdin/out/err?) */ + remote shell */ + char local_cmd[1024]; if (strcmp( host, "localhost" ) == 0 || strcmp( myhostname, host ) == 0) { p4_dprintfl( 80, "Not using rsh to localhost\n" ); - rc = execlp(pgm, pgm, - myhostname, serv_port_c, am_slave_c, - "-p4yourname", host, "-p4rmrank", rm_rank_str, - NULL); + + strcpy(local_cmd, pgm); + strcat(local_cmd, " "); + strcat(local_cmd, myhostname); + strcat(local_cmd, " "); + strcat(local_cmd, serv_port_c); + strcat(local_cmd, " "); + strcat(local_cmd, am_slave_c); + strcat(local_cmd, " "); + strcat(local_cmd, "-p4yourname"); + strcat(local_cmd, " "); + strcat(local_cmd, host); + strcat(local_cmd, " "); + strcat(local_cmd, "-p4rmrank"); + strcat(local_cmd, " "); + strcat(local_cmd, rm_rank_str); + + rc = execlp("bash", "bash", "-c", local_cmd, NULL); } else { rc = execlp(remote_shell, remote_shell, @@ -616,6 +666,7 @@ int net_create_slave( int serv_port, int NULL); #endif /* RSH_NEEDS_OPTS */ #endif /* Short_circuit_localhost */ +#endif /* USE_ONLY_MOSRUN */ /* host,"-n","cluster","5",pgm,myhostname,serv_port_c,0); for butterfly */ if (rc < 0) { /* Trap common user errors and generate a more --- mpich-1.2.5-orig/configure Mon Jan 13 14:34:56 2003 +++ mpich-1.2.5/configure Fri May 2 17:15:29 2003 @@ -1123,6 +1123,10 @@ do rshnol=1 ;; + -use_only_mosrun) + use_only_mosrun=1 + ;; + -lib=* | --lib=*) package="`echo $arg|sed 's/-*lib=//'`" USERLIB="$package" ;; --- mpich-1.2.5-orig/configure.in Mon Jan 13 14:34:57 2003 +++ mpich-1.2.5/configure.in Fri May 2 17:22:05 2003 @@ -1132,6 +1132,10 @@ do rshnol=1 ;; + -use_only_mosrun) + use_only_mosrun=1 + ;; + -lib=* | --lib=*) package="`echo $arg|sed 's/-*lib=//'`" USERLIB="$package" ;; --- mpich-1.2.5-orig/mpid/ch_p4/setup_ch_p4 Fri Oct 4 07:30:41 2002 +++ mpich-1.2.5/mpid/ch_p4/setup_ch_p4 Fri May 2 17:17:10 2003 @@ -166,6 +166,9 @@ fi if test -n "$rshnol" ; then otherargs="$otherargs -rshnol" fi +if test -n "$use_only_mosrun" ; then + otherargs="$otherargs -use_only_mosrun" +fi if test -n "$DLAST" ; then otherargs="$otherargs $DLAST" fi --- mpich-1.2.5-orig/mpid/ch_p4/p4/configure.in Sun Jun 9 09:47:40 2002 +++ mpich-1.2.5/mpid/ch_p4/p4/configure.in Fri May 2 17:20:05 2003 @@ -121,6 +121,9 @@ case $arg in -rshnol) RSHNOL=1 ;; + -use_only_mosrun) + USE_ONLY_MOSRUN=1 + ;; -cflags=*) USER_CFLAGS="`echo A$arg|sed 's/A-*cflags=//'`" ;; --- mpich-1.2.5-orig/mpid/ch_p4/p4/configure Tue Jun 11 07:04:29 2002 +++ mpich-1.2.5/mpid/ch_p4/p4/configure Fri May 2 17:18:07 2003 @@ -113,6 +113,9 @@ case $arg in -rshnol) RSHNOL=1 ;; + -use_only_mosrun) + USE_ONLY_MOSRUN=1 + ;; -cflags=*) USER_CFLAGS="`echo A$arg|sed 's/A-*cflags=//'`" ;; @@ -10301,6 +10304,16 @@ test -n "$verbose" && \ echo " defining RSH_HAS_NO_L" echo "#define" RSH_HAS_NO_L 1 >> confdefs.h DEFS="$DEFS -DRSH_HAS_NO_L=1" +} + +fi +if test -n "$USE_ONLY_MOSRUN" ; then + +{ +test -n "$verbose" && \ +echo " defining USE_ONLY_MOSRUN" +echo "#define" USE_ONLY_MOSRUN 1 >> confdefs.h +DEFS="$DEFS -DUSE_ONLY_MOSRUN=1" } fi