[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v14 RESEND 09/21] multi-process: add qio channel read functio
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v14 RESEND 09/21] multi-process: add qio channel read function |
Date: |
Tue, 22 Dec 2020 10:29:49 +0000 |
On Thu, Dec 17, 2020 at 09:40:39PM -0800, elena.ufimtseva@oracle.com wrote:
> +int qio_channel_readv_full_all(QIOChannel *ioc,
> + const struct iovec *iov,
> + size_t niov,
> + int **fds, size_t *nfds,
> + Error **errp)
> {
> int ret = -1;
> struct iovec *local_iov = g_new(struct iovec, niov);
> struct iovec *local_iov_head = local_iov;
> unsigned int nlocal_iov = niov;
> + int **local_fds = fds;
> + size_t *local_nfds = nfds;
> bool partial = false;
>
> nlocal_iov = iov_copy(local_iov, nlocal_iov,
> @@ -104,7 +140,8 @@ int qio_channel_readv_all_eof(QIOChannel *ioc,
>
> while (nlocal_iov > 0) {
> ssize_t len;
> - len = qio_channel_readv(ioc, local_iov, nlocal_iov, errp);
> + len = qio_channel_readv_full(ioc, local_iov, nlocal_iov, local_fds,
> + local_nfds, errp);
> if (len == QIO_CHANNEL_ERR_BLOCK) {
> if (qemu_in_coroutine()) {
> qio_channel_yield(ioc, G_IO_IN);
> @@ -112,20 +149,21 @@ int qio_channel_readv_all_eof(QIOChannel *ioc,
> qio_channel_wait(ioc, G_IO_IN);
> }
> continue;
> - } else if (len < 0) {
> - goto cleanup;
> - } else if (len == 0) {
> - if (partial) {
> - error_setg(errp,
> - "Unexpected end-of-file before all bytes were
> read");
> + }
> + if (len <= 0) {
> + if (partial && (len == 0)) {
> + ret = -ECANCELED;
Do callers expect fds to be non-NULL when an error is returned? This
could lead to file descriptor and memory leaks.
signature.asc
Description: PGP signature
- Re: [PATCH v14 04/21] socket: export socket_get_fd() function, (continued)
- [PATCH v14 02/21] multi-process: add configure and usage information, elena . ufimtseva, 2020/12/17
- [PATCH v14 03/21] memory: alloc RAM from file at offset, elena . ufimtseva, 2020/12/17
- [PATCH v14 01/21] multi-process: add the concept description to docs/devel/qemu-multiprocess, elena . ufimtseva, 2020/12/17
- Re: [PATCH v14 00/21] Initial support for multi-process Qemu, Elena Ufimtseva, 2020/12/18
- [PATCH v14 RESEND 06/21] multi-process: setup PCI host bridge for remote device, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 07/21] multi-process: setup a machine object for remote device process, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 05/21] multi-process: Add config option for multi-process QEMU, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 09/21] multi-process: add qio channel read function, elena . ufimtseva, 2020/12/18
- Re: [PATCH v14 RESEND 09/21] multi-process: add qio channel read function,
Stefan Hajnoczi <=
- [PATCH v14 RESEND 10/21] multi-process: define MPQemuMsg format and transmission functions, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 11/21] multi-process: Initialize message handler in remote device, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 12/21] multi-process: Associate fd of a PCIDevice with its object, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 14/21] multi-process: introduce proxy object, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 15/21] multi-process: add proxy communication functions, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 13/21] multi-process: setup memory manager for remote device, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 17/21] multi-process: PCI BAR read/write handling for proxy & remote endpoints, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 18/21] multi-process: Synchronize remote memory, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 19/21] multi-process: create IOHUB object to handle irq, elena . ufimtseva, 2020/12/18
- [PATCH v14 RESEND 20/21] multi-process: Retrieve PCI info from remote process, elena . ufimtseva, 2020/12/18