#include <sys/statvfs.h>
/* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for
discussion about Solaris header problems */
-extern int madvise(caddr_t, size_t, int);
+extern int madvise(char *, size_t, int);
#endif
#include "qemu-common.h"
DWORD old_protect;
if (!VirtualProtect(addr, size, prot, &old_protect)) {
- error_report("%s: VirtualProtect failed with error code %ld",
- __func__, GetLastError());
+ g_autofree gchar *emsg = g_win32_error_message(GetLastError());
+ error_report("%s: VirtualProtect failed: %s", __func__, emsg);
return -1;
}
return 0;
return close(fd);
}
+/*
+ * Delete a file from the filesystem, unless the filename is /dev/fdset/...
+ *
+ * Returns: On success, zero is returned. On error, -1 is returned,
+ * and errno is set appropriately.
+ */
+int qemu_unlink(const char *name)
+{
+ if (g_str_has_prefix(name, "/dev/fdset/")) {
+ return 0;
+ }
+
+ return unlink(name);
+}
+
/*
* A variant of write(2) which handles partial write.
*
#ifdef _FIPS_DEBUG
fprintf(stderr, "FIPS mode %s (requested %s)\n",
- (fips_enabled ? "enabled" : "disabled"),
- (requested ? "enabled" : "disabled"));
+ (fips_enabled ? "enabled" : "disabled"),
+ (requested ? "enabled" : "disabled"));
#endif
}
return 0;
}
-#if !GLIB_CHECK_VERSION(2, 31, 0)
-/* Ensure that glib is running in multi-threaded mode
- * Old versions of glib require explicit initialization. Failure to do
- * this results in the single-threaded code paths being taken inside
- * glib. For example, the g_slice allocator will not be thread-safe
- * and cause crashes.
- */
-static void __attribute__((constructor)) thread_init(void)
-{
- if (!g_thread_supported()) {
- g_thread_init(NULL);
- }
-}
-#endif
#ifndef CONFIG_IOVEC
/* helper function for iov_send_recv() */