diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-03-16 09:21:02 -0700 |
---|---|---|
committer | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-03-16 09:21:02 -0700 |
commit | 10bc04fd968d7f80258bf1eec665babf28e9e47d (patch) | |
tree | 30269c62a7f2d6658b6c6ebc2ad2fcf7c1d9ddb0 /qemu-common.h | |
parent | facee1d1d0c3029915f5443c788cd32b9f5b9c83 (diff) | |
download | external_qemu-10bc04fd968d7f80258bf1eec665babf28e9e47d.zip external_qemu-10bc04fd968d7f80258bf1eec665babf28e9e47d.tar.gz external_qemu-10bc04fd968d7f80258bf1eec665babf28e9e47d.tar.bz2 |
Fixes a hack that was enabling multi-touch emulation on Mac.
The issue was that on Mac there is a bug in select() implementation, that caused select()
to fail with EINVAL on condition that timeout exceeds 100000000 secods. So the real fix
was to clamp timout value to that limit when select() is called on Mac.
Change-Id: Icb9ead00a0060028957af1e6e22911d5e8e231c6
Diffstat (limited to 'qemu-common.h')
-rw-r--r-- | qemu-common.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h index 897d510..79ac779 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -395,4 +395,17 @@ typedef enum DisplayType DT_NOGRAPHIC, } DisplayType; +/* + * A fixer for timeout value passed to select() on Mac. The issue is that Mac's + * version of select() will return EINVAL on timeouts larger than 100000000 + * seconds, even though it should have just clamped it. So, for Mac we should + * make sure that timeout value is bound to 100000000 seconds before passing it + * to select(). + */ +#if _DARWIN_C_SOURCE +#define CLAMP_MAC_TIMEOUT(to) do { if (to > 100000000000LL) to = 100000000000LL; } while (0) +#else +#define CLAMP_MAC_TIMEOUT(to) ((void)0) +#endif // _DARWIN_C_SOURCE + #endif |