mirror of https://github.com/proxmox/mirror_qemu
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>master
parent
b84bb4dfe5
commit
17fc124529
|
@ -301,16 +301,18 @@ static int qio_channel_command_set_blocking(QIOChannel *ioc,
|
||||||
bool enabled,
|
bool enabled,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
/* command spawn is not supported on win32 */
|
||||||
|
g_assert_not_reached();
|
||||||
|
#else
|
||||||
QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);
|
QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);
|
||||||
|
|
||||||
if (enabled) {
|
if (!g_unix_set_fd_nonblocking(cioc->writefd, !enabled, NULL) ||
|
||||||
qemu_set_block(cioc->writefd);
|
!g_unix_set_fd_nonblocking(cioc->readfd, !enabled, NULL)) {
|
||||||
qemu_set_block(cioc->readfd);
|
error_setg_errno(errp, errno, "Failed to set FD nonblocking");
|
||||||
} else {
|
return -1;
|
||||||
qemu_set_nonblock(cioc->writefd);
|
|
||||||
qemu_set_nonblock(cioc->readfd);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,14 +139,19 @@ static int qio_channel_file_set_blocking(QIOChannel *ioc,
|
||||||
bool enabled,
|
bool enabled,
|
||||||
Error **errp)
|
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);
|
QIOChannelFile *fioc = QIO_CHANNEL_FILE(ioc);
|
||||||
|
|
||||||
if (enabled) {
|
if (!g_unix_set_fd_nonblocking(fioc->fd, !enabled, NULL)) {
|
||||||
qemu_set_block(fioc->fd);
|
error_setg_errno(errp, errno, "Failed to set FD nonblocking");
|
||||||
} else {
|
return -1;
|
||||||
qemu_set_nonblock(fioc->fd);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue