All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Cam Macdonell <cam@cs.ualberta.ca>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Passing fds through a qemu char device
Date: Fri, 22 May 2009 21:10:41 -0500	[thread overview]
Message-ID: <4A175B21.6010306@codemonkey.ws> (raw)
In-Reply-To: <4A172800.8080406@cs.ualberta.ca>

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

  reply	other threads:[~2009-05-23  2:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 22:32 [Qemu-devel] Passing fds through a qemu char device Cam Macdonell
2009-05-23  2:10 ` Anthony Liguori [this message]
2009-05-26 17:47   ` Cam Macdonell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A175B21.6010306@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=cam@cs.ualberta.ca \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.