* back out r5925, which added a second pty for stdin
* turn off echoing on the pty (which was what r5925 was trying to do). With this patch, stdin forwarding to rank 0 looks good, with the exception of the initialization delay until stage gate 1. This commit was SVN r5930. The following SVN revision numbers were found above: r5925 --> open-mpi/ompi@e406a4b1aa
Этот коммит содержится в:
родитель
0ffbc5506a
Коммит
690d03eea8
@ -61,13 +61,11 @@ orte_iof_base_setup_prefork(orte_iof_base_io_conf_t *opts)
|
||||
#endif
|
||||
|
||||
fflush(stdout);
|
||||
#if defined(HAVE_OPENPTY) && OMPI_ENABLE_PTY_SUPPORT
|
||||
|
||||
#if defined(HAVE_OPENPTY) && OMPI_ENABLE_PTY_SUPPORT
|
||||
if (opts->usepty) {
|
||||
ret = openpty(&(opts->p_stdout[0]), &(opts->p_stdout[1]),
|
||||
NULL, NULL, NULL);
|
||||
ret = openpty(&(opts->p_stdin[0]), &(opts->p_stdin[1]),
|
||||
NULL, NULL, NULL);
|
||||
} else {
|
||||
ret = -1;
|
||||
}
|
||||
@ -107,7 +105,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!opts->usepty) {
|
||||
if (! opts->usepty) {
|
||||
close(opts->p_stdout[0]);
|
||||
close(opts->p_stdin[1]);
|
||||
}
|
||||
@ -115,7 +113,19 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
|
||||
|
||||
if (opts->usepty) {
|
||||
if (opts->connect_stdin) {
|
||||
ret = dup2(opts->p_stdin[0], fileno(stdin));
|
||||
/* disable echo */
|
||||
struct termios term_attrs;
|
||||
if (tcgetattr(opts->p_stdout[1], &term_attrs) < 0) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
term_attrs.c_lflag &= ~ (ECHO | ECHOE | ECHOK |
|
||||
ECHOCTL | ECHOKE | ECHONL);
|
||||
if (tcsetattr(opts->p_stdout[1], TCSANOW, &term_attrs) == -1) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* and connect the pty to stdin */
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdin));
|
||||
if (ret < 0) return OMPI_ERROR;
|
||||
} else {
|
||||
int fd;
|
||||
@ -128,6 +138,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
|
||||
}
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
if (ret < 0) return OMPI_ERROR;
|
||||
|
||||
} else {
|
||||
if(opts->p_stdout[1] != fileno(stdout)) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
@ -136,9 +147,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
|
||||
}
|
||||
if (opts->connect_stdin) {
|
||||
if(opts->p_stdin[0] != fileno(stdin)) {
|
||||
ret = dup2(opts->p_stdin[0], fileno(stdin));
|
||||
ret = dup2(opts->p_stdin[1], fileno(stdin));
|
||||
if (ret < 0) return OMPI_ERROR;
|
||||
close(opts->p_stdin[0]);
|
||||
close(opts->p_stdin[1]);
|
||||
}
|
||||
} else {
|
||||
int fd;
|
||||
@ -157,6 +168,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts)
|
||||
if (ret < 0) return OMPI_ERROR;
|
||||
close(opts->p_stderr[1]);
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -173,10 +185,11 @@ orte_iof_base_setup_parent(const orte_process_name_t* name,
|
||||
}
|
||||
close(opts->p_stderr[1]);
|
||||
|
||||
/* connect write end to IOF */
|
||||
/* connect stdin endpoint */
|
||||
if (opts->connect_stdin) {
|
||||
ret = orte_iof.iof_publish(name, ORTE_IOF_SINK,
|
||||
ORTE_IOF_STDIN, opts->p_stdin[1]);
|
||||
ORTE_IOF_STDIN, opts->usepty ?
|
||||
opts->p_stdout[0] : opts->p_stdin[1]);
|
||||
if(ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
return ret;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user