[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h |
Date: |
Tue, 9 Feb 2016 15:25:11 +0000 |
The right place for "work around issues with system headers" code
is osdep.h. Move the workaround for OSX's stdlib.h emitting a
deprecation warning for daemon() to that header.
This also fixes a problem where running clean-includes on
oslib-posix.c would erroneously remove the #include <stdlib.h>
from it, breaking the workaround.
Signed-off-by: Peter Maydell <address@hidden>
---
include/qemu/osdep.h | 11 +++++++++++
util/oslib-posix.c | 9 ---------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 59a7f8d..cc055c9 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -27,6 +27,17 @@
#include "config-host.h"
#include "qemu/compiler.h"
+
+/* The following block of code temporarily renames the daemon() function so the
+ * compiler does not see the warning associated with it in stdlib.h on OSX
+ */
+#ifdef __APPLE__
+#define daemon qemu_fake_daemon_function
+#include <stdlib.h>
+#undef daemon
+extern int daemon(int, int);
+#endif
+
#include <stdarg.h>
#include <stddef.h>
#include <stdbool.h>
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index d844387..7615be4 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -26,15 +26,6 @@
* THE SOFTWARE.
*/
-/* The following block of code temporarily renames the daemon() function so the
- compiler does not see the warning associated with it in stdlib.h on OSX */
-#ifdef __APPLE__
-#define daemon qemu_fake_daemon_function
-#include <stdlib.h>
-#undef daemon
-extern int daemon(int, int);
-#endif
-
#if defined(__linux__) && (defined(__x86_64__) || defined(__arm__))
/* Use 2 MiB alignment so transparent hugepages can be used by KVM.
Valgrind does not support alignments larger than 1 MiB,
--
1.9.1
- [Qemu-devel] [PATCH 00/14] More #include cleanups, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 10/14] qapi: Clean up includes in generated files, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 01/14] cpu: Clean up includes, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 03/14] disas/arm-a64.cc: Include osdep.h first, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 07/14] libdecnumber: Clean up includes, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 13/14] all: Clean up includes, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 12/14] scripts/tracetool: Include qemu/osdep.h in generated .c files, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 14/14] oslib-posix.c: Move workaround for OSX daemon() deprecation to osdep.h,
Peter Maydell <=
- [Qemu-devel] [PATCH 04/14] hw/block/nand.c: Include osdep.h first, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 02/14] ui/cocoa.m: Include qemu/osdep.h, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 05/14] target-cris: Remove unnecessary ifdef from mmu.c, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 08/14] tests/i440fx-test: Don't define ARRAY_SIZE locally, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 09/14] tests: Clean up includes, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 06/14] cris: Clean up includes, Peter Maydell, 2016/02/09
- [Qemu-devel] [PATCH 11/14] scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h, Peter Maydell, 2016/02/09
- Re: [Qemu-devel] [PATCH 00/14] More #include cleanups, Eric Blake, 2016/02/09