From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3Dcm-0006gY-Dg for qemu-devel@nongnu.org; Sun, 10 May 2009 14:19:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3Dch-0006dP-OR for qemu-devel@nongnu.org; Sun, 10 May 2009 14:19:44 -0400 Received: from [199.232.76.173] (port=49050 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3Dch-0006dB-IG for qemu-devel@nongnu.org; Sun, 10 May 2009 14:19:39 -0400 Received: from mail-fx0-f219.google.com ([209.85.220.219]:58918) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3Dch-0003jg-43 for qemu-devel@nongnu.org; Sun, 10 May 2009 14:19:39 -0400 Received: by fxm19 with SMTP id 19so2100663fxm.34 for ; Sun, 10 May 2009 11:19:36 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 10 May 2009 21:19:36 +0300 Message-ID: <8e04b5820905101119u39ae84bfp1bae24be6e057086@mail.gmail.com> From: "Ciprian Dorin, Craciun" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Transforming stdin and stdout pair into a socket List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: linux-newbie@vger.kernel.org Cc: nbd-general@lists.sourceforge.net, qemu-devel@nongnu.org Hello all! Today I've played around with NBD (Network Block Disk), and qemu-nbd (a NBD client that exports QEMU disks as NBD's). My problem is the following: both NBD kernel module and qemu-nbd implementation expect to use a socket in order to communicate. This means that in order to securely tunnel the connection over SSH (OpenSSH), I need an intermediary process that creates a socket and forwards all input / output between this socket and stdin / stdout (which are in fact pipes received from OpenSSH). My question is: can I somehow make the pair of stdin / stdout seem as a socket to the Linux syscalls (read and write)? (I would have to make stdin / stdout pair look like a single file descriptor.) (This would eliminate the intermediate process that just pipes data, and thus reduce the overhead.) Just to be clear: I know how to trick an application to have it's stdin and stdout be an opened socket (by using dup syscall). But in this case I need to trick the Linux kernel into thinking that stdin / stdout pair is a socket (or a single file descriptor). Thank you, Ciprian Craciun.