diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b6ffdc15bf..ba15be9c56 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 diff --git a/meson.build b/meson.build index 27c31caa2d..9ecb09dfe2 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 ')) config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include '))