mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
io: replace qemu_set{_non}block()
Those calls are non-socket fd, or are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@ -139,14 +139,19 @@ static int qio_channel_file_set_blocking(QIOChannel *ioc,
|
||||
bool enabled,
|
||||
Error **errp)
|
||||
{
|
||||
#ifdef WIN32
|
||||
/* not implemented */
|
||||
error_setg_errno(errp, errno, "Failed to set FD nonblocking");
|
||||
return -1;
|
||||
#else
|
||||
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);
|
||||
|
||||
if (enabled) {
|
||||
qemu_set_block(fioc->fd);
|
||||
} else {
|
||||
qemu_set_nonblock(fioc->fd);
|
||||
if (!g_unix_set_fd_nonblocking(fioc->fd, !enabled, NULL)) {
|
||||
error_setg_errno(errp, errno, "Failed to set FD nonblocking");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user