Commit dc249aaf57 for qemu.org

commit dc249aaf57e8e3d5e79a21c1eba42b7698aafea9
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Fri Jan 16 12:58:29 2026 +0000

    misc: Clean up includes

    This commit deals with various .c files that included system
    headers that are already pulled in by osdep.h, where the .c
    file includes osdep.h already itself.

    This commit was created with scripts/clean-includes:
     ./scripts/clean-includes '--git' 'misc' 'hw/core' 'semihosting' 'target/arm' 'target/i386/kvm/kvm.c' 'target/loongarch' 'target/riscv' 'tools' 'util'

    All .c should include qemu/osdep.h first.  The script performs three
    related cleanups:

    * Ensure .c files include qemu/osdep.h first.
    * Including it in a .h is redundant, since the .c  already includes
      it.  Drop such inclusions.
    * Likewise, including headers qemu/osdep.h includes is redundant.
      Drop these, too.

    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20260116125830.926296-4-peter.maydell@linaro.org

diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 79cbcdd63e..e62cb4ec88 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -30,7 +30,6 @@
 #include "system/runstate.h"
 #include "system/system.h"
 #include "hw/s390x/storage-keys.h"
-#include <sys/stat.h>

 /*
  * QMP query for enabled and present accelerators
diff --git a/semihosting/arm-compat-semi-stub.c b/semihosting/arm-compat-semi-stub.c
index bfa3681e26..40199c9842 100644
--- a/semihosting/arm-compat-semi-stub.c
+++ b/semihosting/arm-compat-semi-stub.c
@@ -6,7 +6,6 @@

 #include "qemu/osdep.h"
 #include "semihosting/semihost.h"
-#include <glib.h>

 bool semihosting_arm_compatible(void)
 {
diff --git a/target/arm/cpu32-stubs.c b/target/arm/cpu32-stubs.c
index f0ce159572..9e50bb1b0b 100644
--- a/target/arm/cpu32-stubs.c
+++ b/target/arm/cpu32-stubs.c
@@ -3,7 +3,6 @@
 #include "qemu/osdep.h"
 #include "target/arm/cpu.h"
 #include "target/arm/internals.h"
-#include <glib.h>

 void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)
 {
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 7b9b740a8e..0c940d4b64 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -21,7 +21,6 @@
 #include <sys/utsname.h>
 #include <sys/syscall.h>
 #include <sys/resource.h>
-#include <sys/time.h>

 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
diff --git a/target/loongarch/csr.c b/target/loongarch/csr.c
index 332a1396cc..fff2312f87 100644
--- a/target/loongarch/csr.c
+++ b/target/loongarch/csr.c
@@ -2,7 +2,6 @@
 /*
  * Copyright (c) 2025 Loongson Technology Corporation Limited
  */
-#include <stddef.h>
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "csr.h"
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 05c7ec8352..5064483917 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -31,7 +31,6 @@
 #include "qapi/error.h"
 #include "tcg/insn-start-words.h"
 #include "internals.h"
-#include <stdbool.h>

 /* CSR function table public API */
 void riscv_get_csr_ops(int csrno, riscv_csr_operations *ops)
diff --git a/tools/i386/qemu-vmsr-helper.c b/tools/i386/qemu-vmsr-helper.c
index 6c0f4fe870..f12fd3c3e8 100644
--- a/tools/i386/qemu-vmsr-helper.c
+++ b/tools/i386/qemu-vmsr-helper.c
@@ -20,7 +20,6 @@

 #include "qemu/osdep.h"
 #include <getopt.h>
-#include <stdbool.h>
 #include <sys/ioctl.h>
 #ifdef CONFIG_LIBCAP_NG
 #include <cap-ng.h>
diff --git a/util/cpuinfo-aarch64.c b/util/cpuinfo-aarch64.c
index 57468890c3..288074c08f 100644
--- a/util/cpuinfo-aarch64.c
+++ b/util/cpuinfo-aarch64.c
@@ -26,7 +26,6 @@
 #if defined(__OpenBSD__) && !defined(CONFIG_ELF_AUX_INFO)
 # include <machine/armreg.h>
 # include <machine/cpu.h>
-# include <sys/types.h>
 # include <sys/sysctl.h>
 #endif