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 <[email protected]> > ---
Reviewed-by: Eric Blake <[email protected]> > +++ 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
