Revision f3dfda61 vl.c
b/vl.c | ||
---|---|---|
3211 | 3211 |
|
3212 | 3212 |
static void qemu_event_increment(void) |
3213 | 3213 |
{ |
3214 |
static const char byte = 0; |
|
3214 |
/* Write 8 bytes to be compatible with eventfd. */ |
|
3215 |
static uint64_t val = 1; |
|
3215 | 3216 |
ssize_t ret; |
3216 | 3217 |
|
3217 | 3218 |
if (io_thread_fd == -1) |
3218 | 3219 |
return; |
3219 | 3220 |
|
3220 | 3221 |
do { |
3221 |
ret = write(io_thread_fd, &byte, sizeof(byte));
|
|
3222 |
ret = write(io_thread_fd, &val, sizeof(val));
|
|
3222 | 3223 |
} while (ret < 0 && errno == EINTR); |
3223 | 3224 |
|
3224 | 3225 |
/* EAGAIN is fine, a read must be pending. */ |
... | ... | |
3235 | 3236 |
ssize_t len; |
3236 | 3237 |
char buffer[512]; |
3237 | 3238 |
|
3238 |
/* Drain the notify pipe */ |
|
3239 |
/* Drain the notify pipe. For eventfd, only 8 bytes will be read. */
|
|
3239 | 3240 |
do { |
3240 | 3241 |
len = read(fd, buffer, sizeof(buffer)); |
3241 | 3242 |
} while ((len == -1 && errno == EINTR) || len == sizeof(buffer)); |
... | ... | |
3246 | 3247 |
int err; |
3247 | 3248 |
int fds[2]; |
3248 | 3249 |
|
3249 |
err = qemu_pipe(fds);
|
|
3250 |
err = qemu_eventfd(fds);
|
|
3250 | 3251 |
if (err == -1) |
3251 | 3252 |
return -errno; |
3252 | 3253 |
|
Also available in: Unified diff