[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/46] osdep: build with non-working system() function
From: |
Peter Maydell |
Subject: |
[PULL 11/46] osdep: build with non-working system() function |
Date: |
Fri, 29 Jan 2021 10:59:37 +0000 |
From: Joelle van Dyne <j@getutm.app>
Build without error on hosts without a working system(). If system()
is called, return -1 with ENOSYS.
Signed-off-by: Joelle van Dyne <j@getutm.app>
Message-id: 20210126012457.39046-6-j@getutm.app
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
meson.build | 1 +
include/qemu/osdep.h | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/meson.build b/meson.build
index 27c31caa2d1..9ecb09dfe21 100644
--- a/meson.build
+++ b/meson.build
@@ -1127,6 +1127,7 @@ config_host_data.set('HAVE_DRM_H',
cc.has_header('libdrm/drm.h'))
config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
+config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix:
'#include <stdlib.h>'))
config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix:
'#include <sys/uio.h>'))
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index b6ffdc15bf3..ba15be9c569 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -710,4 +710,16 @@ static inline void qemu_thread_jit_write(void) {}
static inline void qemu_thread_jit_execute(void) {}
#endif
+/**
+ * Platforms which do not support system() return ENOSYS
+ */
+#ifndef HAVE_SYSTEM_FUNCTION
+#define system platform_does_not_support_system
+static inline int platform_does_not_support_system(const char *command)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif /* !HAVE_SYSTEM_FUNCTION */
+
#endif
--
2.20.1
- [PULL 00/46] target-arm queue, Peter Maydell, 2021/01/29
- [PULL 05/46] arm-virt: refactor gpios creation, Peter Maydell, 2021/01/29
- [PULL 01/46] target/arm: Implement ID_PFR2, Peter Maydell, 2021/01/29
- [PULL 03/46] arm: rename xlnx-zcu102.canbusN properties, Peter Maydell, 2021/01/29
- [PULL 06/46] arm-virt: add secure pl061 for reset/power down, Peter Maydell, 2021/01/29
- [PULL 02/46] target/arm: Conditionalize DBGDIDR, Peter Maydell, 2021/01/29
- [PULL 09/46] configure: Move preadv check to meson.build, Peter Maydell, 2021/01/29
- [PULL 11/46] osdep: build with non-working system() function,
Peter Maydell <=
- [PULL 07/46] hw/misc: Fix arith overflow in NPCM7XX PWM module, Peter Maydell, 2021/01/29
- [PULL 08/46] target/arm: Replace magic value by MMU_DATA_LOAD definition, Peter Maydell, 2021/01/29
- [PULL 04/46] hw: gpio: implement gpio-pwr driver for qemu reset/poweroff, Peter Maydell, 2021/01/29
- [PULL 13/46] darwin: fix cross-compiling for Darwin, Peter Maydell, 2021/01/29
- [PULL 10/46] configure: cross-compiling with empty cross_prefix, Peter Maydell, 2021/01/29
- [PULL 12/46] darwin: remove redundant dependency declaration, Peter Maydell, 2021/01/29
- [PULL 14/46] configure: cross compile should use x86_64 cpu_family, Peter Maydell, 2021/01/29
- [PULL 16/46] darwin: remove 64-bit build detection on 32-bit OS, Peter Maydell, 2021/01/29
- [PULL 19/46] hw/misc/pvpanic: add PCI interface support, Peter Maydell, 2021/01/29
- [PULL 18/46] hw/misc/pvpanic: split-out generic and bus dependent code, Peter Maydell, 2021/01/29