I have multiple child \"forked\" by the same parent and I try to construct pipe connection between all these child processes like a linked list structure. Child
pipe
Create all the pipes first, then spawn all the children with the appropriate pipe ends in FDs 0 and 1.
As for waiting, just keep waiting until it returns -1.