From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M7ghF-0000HP-HZ for qemu-devel@nongnu.org; Fri, 22 May 2009 22:10:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M7ghA-0000By-EM for qemu-devel@nongnu.org; Fri, 22 May 2009 22:10:48 -0400 Received: from [199.232.76.173] (port=41152 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M7ghA-0000Ba-AY for qemu-devel@nongnu.org; Fri, 22 May 2009 22:10:44 -0400 Received: from mail-gx0-f176.google.com ([209.85.217.176]:49437) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M7ghA-0007k8-15 for qemu-devel@nongnu.org; Fri, 22 May 2009 22:10:44 -0400 Received: by gxk24 with SMTP id 24so676973gxk.10 for ; Fri, 22 May 2009 19:10:43 -0700 (PDT) Message-ID: <4A175B21.6010306@codemonkey.ws> Date: Fri, 22 May 2009 21:10:41 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Passing fds through a qemu char device References: <4A172800.8080406@cs.ualberta.ca> In-Reply-To: <4A172800.8080406@cs.ualberta.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cam Macdonell Cc: qemu-devel@nongnu.org Cam Macdonell wrote: > > Hi, > > I'm trying to pass eventfds between qemu processes and I'm trying to > use a qemu char device to do this. AFAICT with a qemu_chr_device the > polling handler only has support to call read()/write(), not > send/recvmsg() which are necessary to send and receive fds with > SCM_RIGHTS through the socket. Is this true or is there support in > Qemu for recvmsg() that I'm not seeing? The TCP/Unix implementations for CharDriverState use send/recv. You can convert the recv path to always use recvmsg() and introduce an qemu_chr_ioctl() to pass/recv fds. You can be smart about storing the recv'd fd in the char driver state and that would allow qemu_chr_ioctl(CHR_IOCTL_GET_FD) to not block. qemu_chr_ioctl(CHR_IOCTL_SET_FD) would set the fd to be sent for the next qemu_chr_write() operation. Just a thought, other interfaces could also work. Regards, Anthony Liguori