[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/4] oslib-posix: rename socket_set_nonblock() t
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 3/4] oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock() |
Date: |
Tue, 26 Mar 2013 10:39:42 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
On 03/26/2013 10:07 AM, Stefan Hajnoczi wrote:
> The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.
> Rename to qemu_set_nonblock() just like qemu_set_cloexec().
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
Reviewed-by: Eric Blake <address@hidden>
> +++ b/util/oslib-posix.c
> @@ -134,14 +134,14 @@ void qemu_vfree(void *ptr)
> free(ptr);
> }
>
> -void socket_set_block(int fd)
> +void qemu_set_block(int fd)
> {
> int f;
> f = fcntl(fd, F_GETFL);
> fcntl(fd, F_SETFL, f & ~O_NONBLOCK);
Odd that we aren't checking for errors here, but that's an independent
consideration not for this patch.
> +++ b/util/oslib-win32.c
> @@ -100,14 +100,14 @@ struct tm *localtime_r(const time_t *timep, struct tm
> *result)
> return p;
> }
>
> -void socket_set_block(int fd)
> +void qemu_set_block(int fd)
> {
> unsigned long opt = 0;
> WSAEventSelect(fd, NULL, 0);
> ioctlsocket(fd, FIONBIO, &opt);
ioctlsocket() doesn't work on non-sockets, does it? On the other hand,
do we ever call qemu_set_block() on a non-socket in the mingw build,
since we lack SCM_RIGHTS on that platform? Also, this is another case
of not checking for errors - I guess inability to set blocking on a
non-socket is not fatal, so not checking for errors kind of makes sense.
Again, doesn't impact this patch from being a mechanical rename.
See my comment in 1/4 about possibly rebasing this to be first (in which
case it is slightly smaller).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 4/4] chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors, (continued)