diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-24 21:55:17 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-24 21:55:17 +0000 |
commit | c1d366653207033b811c85da8c839729786451a5 (patch) | |
tree | 246e541f100a13b6f77d2869c669c806f10e146f /vl.c | |
parent | 17e909738da65d315d462839a05628580b96f8c1 (diff) |
Live migration for Win32 (Hervé Poussineau)
This patch fixes migration so that it works on Win32. This requires using
socket specific calls since sockets cannot be treated like file descriptors
on win32.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5525 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -6252,43 +6252,43 @@ struct QEMUFile { int has_error; }; -typedef struct QEMUFileFD +typedef struct QEMUFileSocket { int fd; QEMUFile *file; -} QEMUFileFD; +} QEMUFileSocket; -static int fd_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) +static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) { - QEMUFileFD *s = opaque; + QEMUFileSocket *s = opaque; ssize_t len; do { - len = read(s->fd, buf, size); - } while (len == -1 && errno == EINTR); + len = recv(s->fd, buf, size, 0); + } while (len == -1 && socket_error() == EINTR); if (len == -1) - len = -errno; + len = -socket_error(); return len; } -static int fd_close(void *opaque) +static int socket_close(void *opaque) { - QEMUFileFD *s = opaque; + QEMUFileSocket *s = opaque; qemu_free(s); return 0; } -QEMUFile *qemu_fopen_fd(int fd) +QEMUFile *qemu_fopen_socket(int fd) { - QEMUFileFD *s = qemu_mallocz(sizeof(QEMUFileFD)); + QEMUFileSocket *s = qemu_mallocz(sizeof(QEMUFileSocket)); if (s == NULL) return NULL; s->fd = fd; - s->file = qemu_fopen_ops(s, NULL, fd_get_buffer, fd_close, NULL); + s->file = qemu_fopen_ops(s, NULL, socket_get_buffer, socket_close, NULL); return s->file; } |