#ifdef _WIN32
+/* mingw32 needs ffs for compilations without optimization. */
+int ffs(int i)
+{
+ /* Use gcc's builtin ffs. */
+ return __builtin_ffs(i);
+}
+
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
#define _W32_FT_OFFSET (116444736000000000ULL)
*
* Return the number of bytes transferred.
* Set errno if fewer than `count' bytes are written.
+ *
+ * This function don't work with non-blocking fd's.
+ * Any of the possibilities with non-bloking fd's is bad:
+ * - return a short write (then name is wrong)
+ * - busy wait adding (errno == EAGAIN) to the loop
*/
ssize_t qemu_write_full(int fd, const void *buf, size_t count)
{
*/
int qemu_eventfd(int fds[2])
{
+#ifdef CONFIG_EVENTFD
int ret;
-#ifdef CONFIG_EVENTFD
ret = eventfd(0, 0);
if (ret >= 0) {
fds[0] = ret;