My question is about a pipe/pipeline in Unix. And it's especially about the FD (File descriptor) numbers/integers associated with it.
This is what I would expect:
PROCESS A PROCESS B
1 stdout -> pipe -> 0 stdin
2 stderr 1 stdout
However, on the internet I'm reading different things.
For example, see: http://pubs.opengroup.org/onlinepubs/009696799/functions/pipe.html
Their integer values shall be the two lowest available at the time of the pipe() call.
Also see the images here: http://www.rozmichelle.com/pipes-forks-dups/#attachment_7362
Why new file descriptors are created? Why they don't use stdout (1) of the parent process? They could just redirect this existing
file descriptor (1/stdout) to the pipe. Do I miss something?