[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket chara
From: |
Mark McLoughlin |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices |
Date: |
Wed, 08 Jul 2009 17:04:03 +0100 |
On Wed, 2009-07-08 at 18:25 +0300, Avi Kivity wrote:
> On 07/08/2009 05:57 PM, Mark McLoughlin wrote:
> > If a file descriptor is passed via a message with SCM_RIGHTS ancillary
> > data on a unix socket, store the file descriptor for use in the
> > chr_read() handler. Close the file descriptor if it was not used.
> >
> > The qemu_chr_get_msgfd() API provides access to the passed descriptor.
> >
> > Signed-off-by: Mark McLoughlin<address@hidden>
> > ---
> > qemu-char.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > qemu-char.h | 2 ++
> > 2 files changed, 52 insertions(+), 0 deletions(-)
> >
> > diff --git a/qemu-char.c b/qemu-char.c
> > index e0d7220..f06a614 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -168,6 +168,11 @@ void qemu_chr_read(CharDriverState *s, uint8_t *buf,
> > int len)
> > s->chr_read(s->handler_opaque, buf, len);
> > }
> >
> > +int qemu_chr_get_msgfd(CharDriverState *s)
> > +{
> > + return s->get_msgfd ? s->get_msgfd(s) : -1;
> > +}
> > +
> > void qemu_chr_accept_input(CharDriverState *s)
> > {
> > if (s->chr_accept_input)
> > @@ -1832,6 +1837,7 @@ typedef struct {
> > int do_telnetopt;
> > int do_nodelay;
> > int is_unix;
> > + int msgfd;
> > } TCPCharDriver;
> >
>
> SCM_RIGHTS messages can contain multiple fds,
It only makes sense to have one per getfd command and ...
> and multiple messages can arrive. I think you need to queue fds here
> in case the client sends two getfd commands back-to-back and does
> buffering.
it doesn't look to me like the current monitor code can handle multiple
commands in the one message.
Cheers,
Mark.
- [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, (continued)
- [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Mark McLoughlin, 2009/07/22
- [Qemu-devel] [PATCH] Add support for fd=name to tap and socket networking, Mark McLoughlin, 2009/07/21
- [Qemu-devel] [PATCH] Add SCM_RIGHTS support to unix socket character devices, Mark McLoughlin, 2009/07/21
- [Qemu-devel] [PATCH] Add monitor_get_fd() command for fetching named fds, Mark McLoughlin, 2009/07/21
- [Qemu-devel] [PATCH] Add getfd and closefd monitor commands, Mark McLoughlin, 2009/07/21
- Re: [Qemu-devel] [PATCH 3/5] Add getfd and closefd monitor commands, Anthony Liguori, 2009/07/21
- Re: [Qemu-devel] [PATCH 3/5] Add getfd and closefd monitor commands, Mark McLoughlin, 2009/07/22
- [Qemu-devel] Re: [PATCH 3/5] Add getfd and closefd monitor commands, Jan Kiszka, 2009/07/23
- [Qemu-devel] Re: [PATCH 3/5] Add getfd and closefd monitor commands, Mark McLoughlin, 2009/07/23
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Avi Kivity, 2009/07/08
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices,
Mark McLoughlin <=
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Avi Kivity, 2009/07/08
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Anthony Liguori, 2009/07/08
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Avi Kivity, 2009/07/08
- Re: [Qemu-devel] [PATCH 2/5] Add SCM_RIGHTS support to unix socket character devices, Jamie Lokier, 2009/07/10