Revision f3dfda61 osdep.c
b/osdep.c | ||
---|---|---|
37 | 37 |
#include <sys/statvfs.h> |
38 | 38 |
#endif |
39 | 39 |
|
40 |
#ifdef CONFIG_EVENTFD |
|
41 |
#include <sys/eventfd.h> |
|
42 |
#endif |
|
43 |
|
|
40 | 44 |
#ifdef _WIN32 |
41 | 45 |
#include <windows.h> |
42 | 46 |
#elif defined(CONFIG_BSD) |
... | ... | |
281 | 285 |
|
282 | 286 |
#ifndef _WIN32 |
283 | 287 |
/* |
288 |
* Creates an eventfd that looks like a pipe and has EFD_CLOEXEC set. |
|
289 |
*/ |
|
290 |
int qemu_eventfd(int fds[2]) |
|
291 |
{ |
|
292 |
int ret; |
|
293 |
|
|
294 |
#ifdef CONFIG_EVENTFD |
|
295 |
ret = eventfd(0, 0); |
|
296 |
if (ret >= 0) { |
|
297 |
fds[0] = ret; |
|
298 |
qemu_set_cloexec(ret); |
|
299 |
if ((fds[1] = dup(ret)) == -1) { |
|
300 |
close(ret); |
|
301 |
return -1; |
|
302 |
} |
|
303 |
qemu_set_cloexec(fds[1]); |
|
304 |
return 0; |
|
305 |
} |
|
306 |
|
|
307 |
if (errno != ENOSYS) { |
|
308 |
return -1; |
|
309 |
} |
|
310 |
#endif |
|
311 |
|
|
312 |
return qemu_pipe(fds); |
|
313 |
} |
|
314 |
|
|
315 |
/* |
|
284 | 316 |
* Creates a pipe with FD_CLOEXEC set on both file descriptors |
285 | 317 |
*/ |
286 | 318 |
int qemu_pipe(int pipefd[2]) |
Also available in: Unified diff