From: Tetsuya Mukawa <mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
To: Huawei Xie <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
dev-VfR2kkLFssw@public.gmane.org
Subject: Re: [PATCH] test whether file descriptor is valid before close it
Date: Mon, 09 Mar 2015 11:23:15 +0900 [thread overview]
Message-ID: <54FD0413.9070804@igel.co.jp> (raw)
In-Reply-To: <1425639943-27157-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On 2015/03/06 20:05, Huawei Xie wrote:
> This avoids closing -1 in our case.
>
> Signed-off-by: Huawei Xie <huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> lib/librte_vhost/virtio-net.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 6917fcf..4672e67 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -185,13 +185,13 @@ cleanup_device(struct virtio_net *dev)
> }
>
> /* Close any event notifiers opened by device. */
> - if (dev->virtqueue[VIRTIO_RXQ]->callfd)
> + if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0)
> close((int)dev->virtqueue[VIRTIO_RXQ]->callfd);
> - if (dev->virtqueue[VIRTIO_RXQ]->kickfd)
> + if ((int)dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0)
> close((int)dev->virtqueue[VIRTIO_RXQ]->kickfd);
> - if (dev->virtqueue[VIRTIO_TXQ]->callfd)
> + if ((int)dev->virtqueue[VIRTIO_TXQ]->callfd >= 0)
> close((int)dev->virtqueue[VIRTIO_TXQ]->callfd);
> - if (dev->virtqueue[VIRTIO_TXQ]->kickfd)
> + if ((int)dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0)
> close((int)dev->virtqueue[VIRTIO_TXQ]->kickfd);
> }
>
Acked-by: Tetsuya Mukawa <mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
next prev parent reply other threads:[~2015-03-09 2:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 10:39 [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion Huawei Xie
[not found] ` <1425638358-26523-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-06 11:05 ` [PATCH] test whether file descriptor is valid before close it Huawei Xie
[not found] ` <1425639943-27157-1-git-send-email-huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-03-09 1:32 ` Ouyang, Changchun
[not found] ` <F52918179C57134FAEC9EA62FA2F962511A0F479-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 8:34 ` Thomas Monjalon
2015-03-09 2:23 ` Tetsuya Mukawa [this message]
2015-03-09 1:28 ` [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion Ouyang, Changchun
[not found] ` <F52918179C57134FAEC9EA62FA2F962511A0F456-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-09 8:33 ` Thomas Monjalon
2015-03-09 2:23 ` Tetsuya Mukawa
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=54FD0413.9070804@igel.co.jp \
--to=mukawa-alsx/un32fvpdbfq/vqriq@public.gmane.org \
--cc=dev-VfR2kkLFssw@public.gmane.org \
--cc=huawei.xie-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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.