[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH v6 5/6] char: unix/tcp: Add a non-blocking write
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: [PATCH v6 5/6] char: unix/tcp: Add a non-blocking write handler |
Date: |
Tue, 04 May 2010 21:54:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Amit Shah <address@hidden> wrote:
> Add a non-blocking write handler that can return with -EAGAIN to the
> caller and also callback when the socket becomes writable.
>
> Non-blocking writes are only enabled for sockets that are opened in
> non-blocking mode and only for callers that have registered a callback
> handler for resuming writes.
>
> Signed-off-by: Amit Shah <address@hidden>
I
> static void tcp_chr_connect(void *opaque)
> {
> CharDriverState *chr = opaque;
> TCPCharDriver *s = chr->opaque;
> + IOHandler *write_cb;
> + int flags;
> + bool nonblock;
> +
> + flags = fcntl(s->fd, F_GETFL);
> + if (flags == -1) {
> + flags = 0;
> + }
> + nonblock = flags & O_NONBLOCK;
> +
> + write_cb = NULL;
> + chr->nonblock = false;
> + if (nonblock && chr->chr_write_unblocked) {
> + write_cb = chr->chr_write_unblocked;
> + chr->nonblock = true;
> + }
>
> + chr->write_blocked = false;
> s->connected = 1;
> qemu_set_fd_handler2(s->fd, tcp_chr_read_poll,
write_cb is a write-only variable, no?
- [Qemu-devel] [PATCH v6 0/6] char: non-blocking writes, virtio-console flow control, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 1/6] virtio-console: Factor out common init between console and generic ports, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 2/6] char: Add a QemuChrHandlers struct to initialise chardev handlers, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 3/6] char: Let writers know how much data was written in case of errors, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 4/6] char: Add qemu_chr_write_nb() for nonblocking writes, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 5/6] char: unix/tcp: Add a non-blocking write handler, Amit Shah, 2010/05/04
- [Qemu-devel] [PATCH v6 6/6] virtio-console: Throttle virtio-serial-bus if we can't consume any more guest data, Amit Shah, 2010/05/04
- [Qemu-devel] Re: [PATCH v6 6/6] virtio-console: Throttle virtio-serial-bus if we can't consume any more guest data, Juan Quintela, 2010/05/04
- [Qemu-devel] Re: [PATCH v6 5/6] char: unix/tcp: Add a non-blocking write handler,
Juan Quintela <=
- [Qemu-devel] Re: [PATCH v6 5/6] char: unix/tcp: Add a non-blocking write handler, Amit Shah, 2010/05/04
[Qemu-devel] Re: [PATCH v6 0/6] char: non-blocking writes, virtio-console flow control, Gerd Hoffmann, 2010/05/04