Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rob Latham
MPICH-BlueGene
Commits
27220172
Commit
27220172
authored
Nov 30, 2012
by
Pavan Balaji
Browse files
[svn-r10700] Whether mpiexec is attached to a terminal does not make any difference
for our stdin strategy. Remove that test. No reviewer.
parent
2b1f35d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pm/hydra/tools/demux/demux.c
View file @
27220172
...
...
@@ -13,7 +13,7 @@ struct HYDT_dmxu_fns HYDT_dmxu_fns = { 0 };
static
int
got_sigttin
=
0
;
#if defined(SIGTTIN)
&& defined(HAVE_ISATTY)
#if defined(SIGTTIN)
static
void
signal_cb
(
int
sig
)
{
HYDU_FUNC_ENTER
();
...
...
@@ -25,7 +25,7 @@ static void signal_cb(int sig)
HYDU_FUNC_EXIT
();
return
;
}
#endif
/* SIGTTIN
and HAVE_ISATTY
*/
#endif
/* SIGTTIN */
HYD_status
HYDT_dmx_init
(
char
**
demux
)
{
...
...
@@ -228,25 +228,44 @@ HYD_status HYDT_dmxi_stdin_valid(int *out)
* that, we catch SIGTTIN and ignore it. But that causes the
* read() call to return an error (with errno == EINTR) when we
* are not attached to the terminal. */
#if defined(SIGTTIN) && defined(HAVE_ISATTY)
if
(
isatty
(
STDIN_FILENO
))
{
status
=
HYDU_set_signal
(
SIGTTIN
,
signal_cb
);
HYDU_ERR_POP
(
status
,
"unable to set SIGTTIN
\n
"
);
}
#endif
/* SIGTTIN and HAVE_ISATTY */
/*
* We need to allow for the following cases:
*
* 1. mpiexec -n 2 ./foo --> type something on the terminal
* Attached to terminal, and can read from stdin
*
* 2. mpiexec -n 2 ./foo &
* Attached to terminal, but cannot read from stdin
*
* 3. mpiexec -n 2 ./foo < bar
* Not attached to terminal, but can read from stdin
*
* 4. mpiexec -n 2 ./foo < /dev/null
* Not attached to terminal, and can read from stdin
*
* 5. mpiexec -n 2 ./foo < bar &
* Not attached to terminal, but can read from stdin
*
* 6. mpiexec -n 2 ./foo < /dev/null &
* Not attached to terminal, and can read from stdin
*/
#if defined(SIGTTIN)
status
=
HYDU_set_signal
(
SIGTTIN
,
signal_cb
);
HYDU_ERR_POP
(
status
,
"unable to set SIGTTIN
\n
"
);
#endif
/* SIGTTIN */
ret
=
read
(
STDIN_FILENO
,
NULL
,
0
);
if
(
ret
<
0
&&
errno
==
EINTR
&&
got_sigttin
)
*
out
=
0
;
else
if
(
ret
==
0
)
*
out
=
1
;
else
*
out
=
0
;
#if defined(SIGTTIN) && defined(HAVE_ISATTY)
if
(
isatty
(
STDIN_FILENO
))
{
status
=
HYDU_set_signal
(
SIGTTIN
,
SIG_IGN
);
HYDU_ERR_POP
(
status
,
"unable to set SIGTTIN
\n
"
);
}
#endif
/* SIGTTIN and HAVE_ISATTY */
#if defined(SIGTTIN)
status
=
HYDU_set_signal
(
SIGTTIN
,
SIG_IGN
);
HYDU_ERR_POP
(
status
,
"unable to set SIGTTIN
\n
"
);
#endif
/* SIGTTIN */
fn_exit:
HYDU_FUNC_EXIT
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment