c/unix q

c/unix q

ronys ronys at gmx.net
Tue Jun 4 14:43:29 IDT 2013


Nothing. You're just wasting resources (file descriptors) and making your
code a bit harder to understand and maintain.

Note that for pipe(), you can use both fds at both ends of the pipe, but
it's very easy to get into a race condition.Better to open a pair of pipes,
one for each direction (of course, you now need to worry about
deadlocks...).

Rony


On Tue, Jun 4, 2013 at 2:24 PM, Erez D <erez0001 at gmail.com> wrote:

> hello
>
> using the usual pipe()+fork()+dup()+close() to fork a child process and
> pipe data from and to it,
>
> I  know both the child and parent must close the unused fds.
>
> why ?
> what if i don't close the unsed fds ?
>
>
> thanks,
> erez.
>
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
>


-- 
Ubi dubium, ibi libertas (where there is doubt, there is freedom)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20130604/47819f00/attachment-0001.html>


More information about the Linux-il mailing list