/* OS X does not have O_DSYNC */
#ifndef O_DSYNC
+#ifdef O_SYNC
#define O_DSYNC O_SYNC
+#elif defined(O_FSYNC)
+#define O_DSYNC O_FSYNC
+#endif
#endif
/* Approximate O_DIRECT with O_DSYNC if O_DIRECT isn't available */
label__raw_read__success:
- return ret;
+ return (ret < 0) ? -errno : ret;
}
/*
return 0;
s = qemu_malloc(sizeof(PosixAioState));
- if (s == NULL)
- return -ENOMEM;
sigfillset(&act.sa_mask);
act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
pacb = &posix_aio_state->first_aio;
for(;;) {
if (*pacb == NULL) {
+ fprintf(stderr, "raw_aio_remove: aio request not found!\n");
break;
} else if (*pacb == acb) {
*pacb = acb->next;
qemu_aio_release(acb);
break;
}
- pacb = &acb->next;
+ pacb = &(*pacb)->next;
}
}