title: openmpi, termios and stdin
body: <p>I've a question regarding openmpi and the standard input file descriptor (fd)
  and the use of termios.
  Is actually the standard fd used in ompi programs ?</p>
  
  <p>There's the mpirun <code>-stdin</code> option for standard input redirection to a certain rank. I assume something is done behind the scene.</p>
  
  <p>For example, the following code snippet fails at <code>tcgetattr</code> for STDIN_FILENO only with mpirun (but works in sequential).</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;mpi.h&gt;
  #include &lt;termios.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;assert.h&gt;
  using namespace std;
  
  int main(int argc, char* argv[]) {
    MPI_Status status;
    MPI_Init(&amp;argc, &amp;argv);
  
    int in = dup( STDIN_FILENO );
    struct termios org_opts, new_opts;
    res = tcgetattr( in, &amp;org_opts);
    assert(res==0);
  
    MPI_Finalize( );
  }    
  </code></pre>