LWN.net Logo

Passing fds via pipes?!

Passing fds via pipes?!

Posted Jul 30, 2009 0:01 UTC (Thu) by i3839 (guest, #31386)
In reply to: GNU + Linux = broken development model by nix
Parent article: A tempest in a tty pot

> TTY users can be people who accept file descriptors via
> pipes and have no idea there are TTYs at the other end

How is this possible? Did you mean unix domain sockets instead of pipes?


(Log in to post comments)

Passing fds via pipes?!

Posted Jul 30, 2009 0:37 UTC (Thu) by nix (subscriber, #2304) [Link]

Wrong way round. An fd to a TTY can be passed over a unix-domain socket
and then used (which will trigger line discipline magic even though the
app has no idea it's using it), so it's using a TTY even though it never
opened it or looked at /dev/ptmx. (This is probably not common, but it
makes a comprehensive audit of TTY users ridiculously hard, because use of
AF_UNIX sockets *is* common and fd passing is not particularly rare. One
variation of it, in which the fd is passed into the application as one of
fds 0 to 2, is of course exceedingly common. You don't even need AF_UNIX
sockets for that.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds