summary refs log tree commit diff stats
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/aarch64/cpu_loop.c1
-rw-r--r--linux-user/aarch64/syscall_nr.h4
-rw-r--r--linux-user/aarch64/termbits.h5
-rw-r--r--linux-user/alpha/cpu_loop.c1
-rw-r--r--linux-user/alpha/syscall_nr.h5
-rw-r--r--linux-user/alpha/termbits.h5
-rw-r--r--linux-user/arm/cpu_loop.c1
-rw-r--r--linux-user/arm/syscall_nr.h5
-rw-r--r--linux-user/arm/termbits.h5
-rw-r--r--linux-user/cris/cpu_loop.c1
-rw-r--r--linux-user/cris/syscall_nr.h5
-rw-r--r--linux-user/cris/termbits.h5
-rw-r--r--linux-user/errno_defs.h6
-rw-r--r--linux-user/flat.h5
-rw-r--r--linux-user/hppa/sockbits.h5
-rw-r--r--linux-user/hppa/syscall_nr.h5
-rw-r--r--linux-user/hppa/termbits.h5
-rw-r--r--linux-user/i386/cpu_loop.c1
-rw-r--r--linux-user/i386/syscall_nr.h5
-rw-r--r--linux-user/i386/termbits.h5
-rw-r--r--linux-user/m68k/cpu_loop.c1
-rw-r--r--linux-user/m68k/syscall_nr.h5
-rw-r--r--linux-user/m68k/termbits.h5
-rw-r--r--linux-user/main.c4
-rw-r--r--linux-user/microblaze/cpu_loop.c1
-rw-r--r--linux-user/microblaze/syscall_nr.h5
-rw-r--r--linux-user/microblaze/termbits.h5
-rw-r--r--linux-user/mips/cpu_loop.c1
-rw-r--r--linux-user/mips/syscall_nr.h6
-rw-r--r--linux-user/mips/termbits.h5
-rw-r--r--linux-user/mips64/syscall_nr.h5
-rw-r--r--linux-user/mmap.c1
-rw-r--r--linux-user/nios2/syscall_nr.h5
-rw-r--r--linux-user/nios2/termbits.h5
-rw-r--r--linux-user/openrisc/cpu_loop.c1
-rw-r--r--linux-user/openrisc/syscall_nr.h5
-rw-r--r--linux-user/openrisc/termbits.h5
-rw-r--r--linux-user/ppc/cpu_loop.c1
-rw-r--r--linux-user/ppc/syscall_nr.h6
-rw-r--r--linux-user/ppc/termbits.h5
-rw-r--r--linux-user/riscv/cpu_loop.c1
-rw-r--r--linux-user/riscv/syscall_nr.h5
-rw-r--r--linux-user/riscv/target_syscall.h5
-rw-r--r--linux-user/riscv/termbits.h5
-rw-r--r--linux-user/s390x/cpu_loop.c1
-rw-r--r--linux-user/s390x/syscall_nr.h5
-rw-r--r--linux-user/s390x/termbits.h4
-rw-r--r--linux-user/sh4/cpu_loop.c1
-rw-r--r--linux-user/sh4/syscall_nr.h5
-rw-r--r--linux-user/sh4/termbits.h5
-rw-r--r--linux-user/signal.c1
-rw-r--r--linux-user/socket.h5
-rw-r--r--linux-user/sparc/cpu_loop.c1
-rw-r--r--linux-user/sparc/syscall_nr.h5
-rw-r--r--linux-user/sparc/termbits.h5
-rw-r--r--linux-user/sparc64/syscall_nr.h5
-rw-r--r--linux-user/sparc64/termbits.h5
-rw-r--r--linux-user/syscall.c1
-rw-r--r--linux-user/target_flat.h6
-rw-r--r--linux-user/tilegx/cpu_loop.c1
-rw-r--r--linux-user/x86_64/syscall_nr.h5
-rw-r--r--linux-user/x86_64/termbits.h5
-rw-r--r--linux-user/xtensa/target_flat.h8
63 files changed, 241 insertions, 6 deletions
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index 18db6f80f0..1295fa8531 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "qemu/guest-random.h"
diff --git a/linux-user/aarch64/syscall_nr.h b/linux-user/aarch64/syscall_nr.h
index a3c9a3b679..f00ffd7fb8 100644
--- a/linux-user/aarch64/syscall_nr.h
+++ b/linux-user/aarch64/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_AARCH64_SYSCALL_NR_H
+#define LINUX_USER_AARCH64_SYSCALL_NR_H
+
 #define TARGET_NR_io_setup 0
 #define TARGET_NR_io_destroy 1
 #define TARGET_NR_io_submit 2
@@ -274,3 +277,4 @@
 #define TARGET_NR_mlock2 284
 #define TARGET_NR_copy_file_range 285
 
+#endif
diff --git a/linux-user/aarch64/termbits.h b/linux-user/aarch64/termbits.h
index f9f80f0f37..0ab448d090 100644
--- a/linux-user/aarch64/termbits.h
+++ b/linux-user/aarch64/termbits.h
@@ -1,6 +1,9 @@
 /* from asm/termbits.h */
 /* NOTE: exactly the same as i386 */
 
+#ifndef LINUX_USER_AARCH64_TERMBITS_H
+#define LINUX_USER_AARCH64_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -220,3 +223,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP           32
 
 #define TARGET_TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c
index 7a94eee84c..7ce2461a02 100644
--- a/linux-user/alpha/cpu_loop.c
+++ b/linux-user/alpha/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index fbb1ed288b..2e5541bbf9 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_ALPHA_SYSCALL_NR_H
+#define LINUX_USER_ALPHA_SYSCALL_NR_H
+
 #define TARGET_NR_osf_syscall	  0	/* not implemented */
 #define TARGET_NR_exit		  1
 #define TARGET_NR_fork		  2
@@ -450,3 +453,5 @@
 #define TARGET_NR_getrandom                     511
 #define TARGET_NR_memfd_create                  512
 #define TARGET_NR_execveat                      513
+
+#endif
diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
index 139bc87fa6..a71425174a 100644
--- a/linux-user/alpha/termbits.h
+++ b/linux-user/alpha/termbits.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_ALPHA_TERMBITS_H
+#define LINUX_USER_ALPHA_TERMBITS_H
+
 typedef unsigned char	target_cc_t;
 typedef unsigned int	target_speed_t;
 typedef unsigned int	target_tcflag_t;
@@ -263,3 +266,5 @@ struct target_termios {
 #define TARGET_TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
 #define TARGET_TIOCGHAYESESP	0x545E  /* Get Hayes ESP configuration */
 #define TARGET_TIOCSHAYESESP	0x545F  /* Set Hayes ESP configuration */
+
+#endif
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index ece4cf335e..8d65de5b9f 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "elf.h"
 #include "cpu_loop-common.h"
diff --git a/linux-user/arm/syscall_nr.h b/linux-user/arm/syscall_nr.h
index cc9089ccdc..e7eda0d766 100644
--- a/linux-user/arm/syscall_nr.h
+++ b/linux-user/arm/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_ARM_SYSCALL_NR_H
+#define LINUX_USER_ARM_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall		(  0)
 #define TARGET_NR_exit			(  1)
 #define TARGET_NR_fork			(  2)
@@ -396,3 +399,5 @@
 #define TARGET_NR_userfaultfd                  (388)
 #define TARGET_NR_membarrier                   (389)
 #define TARGET_NR_mlock2                       (390)
+
+#endif
diff --git a/linux-user/arm/termbits.h b/linux-user/arm/termbits.h
index a61e138ec4..e555cff105 100644
--- a/linux-user/arm/termbits.h
+++ b/linux-user/arm/termbits.h
@@ -1,6 +1,9 @@
 /* from asm/termbits.h */
 /* NOTE: exactly the same as i386 */
 
+#ifndef LINUX_USER_ARM_TERMBITS_H
+#define LINUX_USER_ARM_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -215,3 +218,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c
index 86e711108d..334edddd1e 100644
--- a/linux-user/cris/cpu_loop.c
+++ b/linux-user/cris/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/cris/syscall_nr.h b/linux-user/cris/syscall_nr.h
index 44f0b645b4..4b6cf65c42 100644
--- a/linux-user/cris/syscall_nr.h
+++ b/linux-user/cris/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers, and stub macros for libc.
  */
 
+#ifndef LINUX_USER_CRIS_SYSCALL_NR_H
+#define LINUX_USER_CRIS_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall      0
 #define TARGET_NR_exit		  1
 #define TARGET_NR_fork		  2
@@ -360,3 +363,5 @@
 #define TARGET_NR_memfd_create       357
 #define TARGET_NR_bpf                358
 #define TARGET_NR_execveat           359
+
+#endif
diff --git a/linux-user/cris/termbits.h b/linux-user/cris/termbits.h
index c825cd2f5e..475ee70fed 100644
--- a/linux-user/cris/termbits.h
+++ b/linux-user/cris/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_CRIS_TERMBITS_H
+#define LINUX_USER_CRIS_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -212,3 +215,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/errno_defs.h b/linux-user/errno_defs.h
index 55fbebda51..aaf5208d62 100644
--- a/linux-user/errno_defs.h
+++ b/linux-user/errno_defs.h
@@ -4,6 +4,10 @@
  *
  * Taken from asm-generic/errno-base.h and asm-generic/errno.h
  */
+
+#ifndef LINUX_USER_ERRNO_DEFS_H
+#define LINUX_USER_ERRNO_DEFS_H
+
 #define TARGET_EPERM            1      /* Operation not permitted */
 #define TARGET_ENOENT           2      /* No such file or directory */
 #define TARGET_ESRCH            3      /* No such process */
@@ -159,3 +163,5 @@
  * clash with a valid guest errno now or in the future.
  */
 #define TARGET_QEMU_ESIGRETURN 513     /* Return from signal */
+
+#endif
diff --git a/linux-user/flat.h b/linux-user/flat.h
index 6f2d0c4b2d..1e44b33443 100644
--- a/linux-user/flat.h
+++ b/linux-user/flat.h
@@ -7,6 +7,9 @@
  * support uClinux flat-format executables.
  */
 
+#ifndef LINUX_USER_FLAT_H
+#define LINUX_USER_FLAT_H
+
 #define	FLAT_VERSION			0x00000004L
 
 #ifdef CONFIG_BINFMT_SHARED_FLAT
@@ -65,3 +68,5 @@ struct flat_hdr {
 #define OLD_FLAT_RELOC_TYPE_BSS		2
 
 #   	define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
+
+#endif
diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
index 2641aea859..23f69a3293 100644
--- a/linux-user/hppa/sockbits.h
+++ b/linux-user/hppa/sockbits.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_HPPA_SOCKBITS_H
+#define LINUX_USER_HPPA_SOCKBITS_H
+
 #define TARGET_SOL_SOCKET      0xffff
 
 #define TARGET_SO_DEBUG        0x0001
@@ -68,3 +71,5 @@
  * have to define SOCK_NONBLOCK to a different value here.
  */
 #define TARGET_SOCK_NONBLOCK   0x40000000
+
+#endif
diff --git a/linux-user/hppa/syscall_nr.h b/linux-user/hppa/syscall_nr.h
index 9c1d0a195d..ae41e94321 100644
--- a/linux-user/hppa/syscall_nr.h
+++ b/linux-user/hppa/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_HPPA_SYSCALL_NR_H
+#define LINUX_USER_HPPA_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall 0
 #define TARGET_NR_exit            1
 #define TARGET_NR_fork            2
@@ -351,3 +354,5 @@
 #define TARGET_NR_copy_file_range   346
 #define TARGET_NR_preadv2           347
 #define TARGET_NR_pwritev2          348
+
+#endif
diff --git a/linux-user/hppa/termbits.h b/linux-user/hppa/termbits.h
index ad51c9c911..8fba839dd4 100644
--- a/linux-user/hppa/termbits.h
+++ b/linux-user/hppa/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_HPPA_TERMBITS_H
+#define LINUX_USER_HPPA_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -219,3 +222,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP           32
 
 #define TARGET_TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c
index 71da24384f..024b6f4d58 100644
--- a/linux-user/i386/cpu_loop.c
+++ b/linux-user/i386/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/i386/syscall_nr.h b/linux-user/i386/syscall_nr.h
index bc1bc233ed..3234ec21c6 100644
--- a/linux-user/i386/syscall_nr.h
+++ b/linux-user/i386/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_I386_SYSCALL_NR_H
+#define LINUX_USER_I386_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall      0
 #define TARGET_NR_exit		  1
 #define TARGET_NR_fork		  2
@@ -380,3 +383,5 @@
 #define TARGET_NR_membarrier            375
 #define TARGET_NR_mlock2                376
 #define TARGET_NR_copy_file_range       377
+
+#endif
diff --git a/linux-user/i386/termbits.h b/linux-user/i386/termbits.h
index 32dd0dde5d..88264bbde7 100644
--- a/linux-user/i386/termbits.h
+++ b/linux-user/i386/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_I386_TERMBITS_H
+#define LINUX_USER_I386_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -225,3 +228,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c
index f2c33057b3..e8d39d15f3 100644
--- a/linux-user/m68k/cpu_loop.c
+++ b/linux-user/m68k/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/m68k/syscall_nr.h b/linux-user/m68k/syscall_nr.h
index d239551b34..d33d8e98a7 100644
--- a/linux-user/m68k/syscall_nr.h
+++ b/linux-user/m68k/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_M68K_SYSCALL_NR_H
+#define LINUX_USER_M68K_SYSCALL_NR_H
+
 #define TARGET_NR_exit                 1
 #define TARGET_NR_fork                 2
 #define TARGET_NR_read                 3
@@ -379,3 +382,5 @@
 #define TARGET_NR_copy_file_range       376
 #define TARGET_NR_preadv2               377
 #define TARGET_NR_pwritev2              378
+
+#endif
diff --git a/linux-user/m68k/termbits.h b/linux-user/m68k/termbits.h
index 9df58dc5cb..23840aa968 100644
--- a/linux-user/m68k/termbits.h
+++ b/linux-user/m68k/termbits.h
@@ -1,6 +1,9 @@
 /* from asm/termbits.h */
 /* NOTE: exactly the same as i386 */
 
+#ifndef LINUX_USER_M68K_TERMBITS_H
+#define LINUX_USER_M68K_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -226,3 +229,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/main.c b/linux-user/main.c
index 97ca22bb04..a59ae9439d 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -16,8 +16,11 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/units.h"
+#include "sysemu/tcg.h"
 #include "qemu-version.h"
 #include <sys/syscall.h>
 #include <sys/resource.h>
@@ -29,6 +32,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/help_option.h"
+#include "qemu/module.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "tcg.h"
diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c
index a6ea71401d..3e0a7f730b 100644
--- a/linux-user/microblaze/cpu_loop.c
+++ b/linux-user/microblaze/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/microblaze/syscall_nr.h b/linux-user/microblaze/syscall_nr.h
index 5d1a47a9a9..aa2eb93881 100644
--- a/linux-user/microblaze/syscall_nr.h
+++ b/linux-user/microblaze/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_MICROBLAZE_SYSCALL_NR_H
+#define LINUX_USER_MICROBLAZE_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall	0 /* ok */
 #define TARGET_NR_exit		1 /* ok */
 #define TARGET_NR_fork		2 /* not for no MMU - weird */
@@ -390,3 +393,5 @@
 #define TARGET_NR_memfd_create          386
 #define TARGET_NR_bpf                   387
 #define TARGET_NR_execveat              388
+
+#endif
diff --git a/linux-user/microblaze/termbits.h b/linux-user/microblaze/termbits.h
index c825cd2f5e..17db8a4473 100644
--- a/linux-user/microblaze/termbits.h
+++ b/linux-user/microblaze/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_MICROBLAZE_TERMBITS_H
+#define LINUX_USER_MICROBLAZE_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -212,3 +215,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index ac6c6d1504..43ba267547 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "elf.h"
diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h
index e70adfc2fe..7fa7fa5a86 100644
--- a/linux-user/mips/syscall_nr.h
+++ b/linux-user/mips/syscall_nr.h
@@ -1,6 +1,10 @@
 /*
  * Linux o32 style syscalls are in the range from 4000 to 4999.
  */
+
+#ifndef LINUX_USER_MIPS_SYSCALL_NR_H
+#define LINUX_USER_MIPS_SYSCALL_NR_H
+
 #define TARGET_NR_Linux			4000
 #define TARGET_NR_syscall		(TARGET_NR_Linux +   0)
 #define TARGET_NR_exit			(TARGET_NR_Linux +   1)
@@ -372,3 +376,5 @@
 #define TARGET_NR_statx                 (TARGET_NR_Linux + 366)
 #define TARGET_NR_rseq                  (TARGET_NR_Linux + 367)
 #define TARGET_NR_io_pgetevents         (TARGET_NR_Linux + 368)
+
+#endif
diff --git a/linux-user/mips/termbits.h b/linux-user/mips/termbits.h
index 49a72c5539..3287cf6df8 100644
--- a/linux-user/mips/termbits.h
+++ b/linux-user/mips/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_MIPS_TERMBITS_H
+#define LINUX_USER_MIPS_TERMBITS_H
+
 #define TARGET_NCCS 23
 
 struct target_termios {
@@ -256,3 +259,5 @@ struct target_termios {
 #define TARGET_TIOCGICOUNT     0x5492 /* read serial port inline interrupt counts */
 #define TARGET_TIOCGHAYESESP	0x5493 /* Get Hayes ESP configuration */
 #define TARGET_TIOCSHAYESESP	0x5494 /* Set Hayes ESP configuration */
+
+#endif
diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
index ff218a9bf2..db40f69ca2 100644
--- a/linux-user/mips64/syscall_nr.h
+++ b/linux-user/mips64/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_MIPS64_SYSCALL_NR_H
+#define LINUX_USER_MIPS64_SYSCALL_NR_H
+
 #ifdef TARGET_ABI32
 /*
  * Linux N32 syscalls are in the range from 6000 to 6999.
@@ -672,3 +675,5 @@
 #define TARGET_NR_rseq                  (TARGET_NR_Linux + 327)
 #define TARGET_NR_io_pgetevents         (TARGET_NR_Linux + 328)
 #endif
+
+#endif
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index af41339d57..46a6e3a761 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -19,7 +19,6 @@
 #include "qemu/osdep.h"
 
 #include "qemu.h"
-#include "qemu-common.h"
 
 //#define DEBUG_MMAP
 
diff --git a/linux-user/nios2/syscall_nr.h b/linux-user/nios2/syscall_nr.h
index 8b46763673..8fb87864ca 100644
--- a/linux-user/nios2/syscall_nr.h
+++ b/linux-user/nios2/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_NIOS2_SYSCALL_NR_H
+#define LINUX_USER_NIOS2_SYSCALL_NR_H
+
 #define TARGET_NR_io_setup                  0
 #define TARGET_NR_io_destroy                1
 #define TARGET_NR_io_submit                 2
@@ -327,3 +330,5 @@
 #define TARGET_NR_uselib                    1077
 #define TARGET_NR__sysctl                   1078
 #define TARGET_NR_fork                      1079
+
+#endif
diff --git a/linux-user/nios2/termbits.h b/linux-user/nios2/termbits.h
index f9f80f0f37..425a2fe6ef 100644
--- a/linux-user/nios2/termbits.h
+++ b/linux-user/nios2/termbits.h
@@ -1,6 +1,9 @@
 /* from asm/termbits.h */
 /* NOTE: exactly the same as i386 */
 
+#ifndef LINUX_USER_NIOS2_TERMBITS_H
+#define LINUX_USER_NIOS2_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -220,3 +223,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP           32
 
 #define TARGET_TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c
index 4b8165b261..b33fa77718 100644
--- a/linux-user/openrisc/cpu_loop.c
+++ b/linux-user/openrisc/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/openrisc/syscall_nr.h b/linux-user/openrisc/syscall_nr.h
index 04059d020c..7763dbcfd8 100644
--- a/linux-user/openrisc/syscall_nr.h
+++ b/linux-user/openrisc/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_OPENRISC_SYSCALL_NR_H
+#define LINUX_USER_OPENRISC_SYSCALL_NR_H
+
 #define TARGET_NR_io_setup 0
 #define TARGET_NR_io_destroy 1
 #define TARGET_NR_io_submit 2
@@ -502,3 +505,5 @@
 #define TARGET_NR_stat64 TARGET_NR_3264_stat
 #define TARGET_NR_lstat64 TARGET_NR_3264_lstat
 #endif
+
+#endif
diff --git a/linux-user/openrisc/termbits.h b/linux-user/openrisc/termbits.h
index 231a49806b..7a635ffbc6 100644
--- a/linux-user/openrisc/termbits.h
+++ b/linux-user/openrisc/termbits.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_OPENRISC_TERMBITS_H
+#define LINUX_USER_OPENRISC_TERMBITS_H
+
 typedef unsigned char   target_openrisc_cc;        /*cc_t*/
 typedef unsigned int    target_openrisc_speed;     /*speed_t*/
 typedef unsigned int    target_openrisc_tcflag;    /*tcflag_t*/
@@ -294,3 +297,5 @@ struct target_termios3 {
 #define TARGET_TIOCPKT_IOCTL           64
 
 #define TARGET_TIOCSER_TEMT    0x01    /* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/ppc/cpu_loop.c b/linux-user/ppc/cpu_loop.c
index 24dfdba854..d5704def29 100644
--- a/linux-user/ppc/cpu_loop.c
+++ b/linux-user/ppc/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/ppc/syscall_nr.h b/linux-user/ppc/syscall_nr.h
index afa36544f1..b57a07b931 100644
--- a/linux-user/ppc/syscall_nr.h
+++ b/linux-user/ppc/syscall_nr.h
@@ -1,6 +1,10 @@
 /*
  * This file contains the system call numbers.
  */
+
+#ifndef LINUX_USER_PPC_SYSCALL_NR_H
+#define LINUX_USER_PPC_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall          0
 #define TARGET_NR_exit                     1
 #define TARGET_NR_fork                     2
@@ -394,3 +398,5 @@
 #define TARGET_NR_shmget                376
 #define TARGET_NR_shmctl                377
 #define TARGET_NR_mlock2                378
+
+#endif
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index a5b1bb783b..19e4c6eda8 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_PPC_TERMBITS_H
+#define LINUX_USER_PPC_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -235,3 +238,5 @@ struct target_termios {
 
 #define TARGET_TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
 #define TARGET_TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
+
+#endif
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index c1134597fd..12aa3c0f16 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
diff --git a/linux-user/riscv/syscall_nr.h b/linux-user/riscv/syscall_nr.h
index 7e30f1f1ef..dab6509e3a 100644
--- a/linux-user/riscv/syscall_nr.h
+++ b/linux-user/riscv/syscall_nr.h
@@ -3,6 +3,9 @@
  * of recently-added arches including RISC-V.
  */
 
+#ifndef LINUX_USER_RISCV_SYSCALL_NR_H
+#define LINUX_USER_RISCV_SYSCALL_NR_H
+
 #define TARGET_NR_io_setup 0
 #define TARGET_NR_io_destroy 1
 #define TARGET_NR_io_submit 2
@@ -285,3 +288,5 @@
 #define TARGET_NR_copy_file_range 285
 
 #define TARGET_NR_syscalls (TARGET_NR_copy_file_range + 1)
+
+#endif
diff --git a/linux-user/riscv/target_syscall.h b/linux-user/riscv/target_syscall.h
index ee81d8bc88..a88e821f73 100644
--- a/linux-user/riscv/target_syscall.h
+++ b/linux-user/riscv/target_syscall.h
@@ -5,6 +5,9 @@
  * Reference: linux/arch/riscv/include/uapi/asm/ptrace.h
  */
 
+#ifndef LINUX_USER_RISCV_TARGET_SYSCALL_H
+#define LINUX_USER_RISCV_TARGET_SYSCALL_H
+
 struct target_pt_regs {
     abi_long sepc;
     abi_long ra;
@@ -54,3 +57,5 @@ struct target_pt_regs {
 /* clone(flags, newsp, ptidptr, tls, ctidptr) for RISC-V */
 /* This comes from linux/kernel/fork.c, CONFIG_CLONE_BACKWARDS */
 #define TARGET_CLONE_BACKWARDS
+
+#endif
diff --git a/linux-user/riscv/termbits.h b/linux-user/riscv/termbits.h
index 7e4e230588..5e0af0dd3f 100644
--- a/linux-user/riscv/termbits.h
+++ b/linux-user/riscv/termbits.h
@@ -1,6 +1,9 @@
 /* from asm/termbits.h */
 /* NOTE: exactly the same as i386 */
 
+#ifndef LINUX_USER_RISCV_TERMBITS_H
+#define LINUX_USER_RISCV_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -220,3 +223,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP           32
 
 #define TARGET_TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c
index 8211022ceb..f2d1215fb1 100644
--- a/linux-user/s390x/cpu_loop.c
+++ b/linux-user/s390x/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/s390x/syscall_nr.h b/linux-user/s390x/syscall_nr.h
index 1a66c5561d..b1553a0810 100644
--- a/linux-user/s390x/syscall_nr.h
+++ b/linux-user/s390x/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_S390X_SYSCALL_NR_H
+#define LINUX_USER_S390X_SYSCALL_NR_H
+
 #define TARGET_NR_exit                 1
 #define TARGET_NR_fork                 2
 #define TARGET_NR_read                 3
@@ -391,3 +394,5 @@
 #define TARGET_NR_newfstatat		293
 
 #endif
+
+#endif
diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
index 8bcca89cd7..9affa8f41a 100644
--- a/linux-user/s390x/termbits.h
+++ b/linux-user/s390x/termbits.h
@@ -6,6 +6,9 @@
  *  Derived from "include/asm-i386/termbits.h"
  */
 
+#ifndef LINUX_USER_S390X_TERMBITS_H
+#define LINUX_USER_S390X_TERMBITS_H
+
 #define TARGET_NCCS 19
 struct target_termios {
     unsigned int c_iflag;		/* input mode flags */
@@ -282,3 +285,4 @@ struct target_ktermios {
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
 
+#endif
diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c
index add8817d86..222ed1c670 100644
--- a/linux-user/sh4/cpu_loop.c
+++ b/linux-user/sh4/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/sh4/syscall_nr.h b/linux-user/sh4/syscall_nr.h
index d6c1e059f6..d53a2a07dd 100644
--- a/linux-user/sh4/syscall_nr.h
+++ b/linux-user/sh4/syscall_nr.h
@@ -2,6 +2,9 @@
  * This file contains the system call numbers.
  */
 
+#ifndef LINUX_USER_SH4_SYSCALL_NR_H
+#define LINUX_USER_SH4_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall	  0
 #define TARGET_NR_exit		  1
 #define TARGET_NR_fork		  2
@@ -386,3 +389,5 @@
 #define TARGET_NR_copy_file_range       380
 #define TARGET_NR_preadv2               381
 #define TARGET_NR_pwritev2              382
+
+#endif
diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
index 5723ed7752..dd125b6a2b 100644
--- a/linux-user/sh4/termbits.h
+++ b/linux-user/sh4/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_SH4_TERMBITS_H
+#define LINUX_USER_SH4_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -273,3 +276,5 @@ tus register */
 serial input line(s) */
 #define TARGET_TIOCGICOUNT     TARGET_IOR('T', 93, int) /* 0x545D */ /* read
 serial port inline interrupt counts */
+
+#endif
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 7c5588adff..5cd237834d 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -22,7 +22,6 @@
 #include <sys/resource.h>
 
 #include "qemu.h"
-#include "qemu-common.h"
 #include "trace.h"
 #include "signal-common.h"
 
diff --git a/linux-user/socket.h b/linux-user/socket.h
index 4c0b5c2dfa..680a9218a9 100644
--- a/linux-user/socket.h
+++ b/linux-user/socket.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_SOCKET_H
+#define LINUX_USER_SOCKET_H
+
 #include "sockbits.h"
 
 #ifndef TARGET_ARCH_HAS_SOCKET_TYPES
@@ -35,3 +38,5 @@ enum sock_type {
 #define TARGET_SOCK_NONBLOCK   TARGET_O_NONBLOCK
 #endif
 #endif /* TARGET_ARCH_HAS_SOCKET_TYPES */
+
+#endif
diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index d85359037c..7645cc04ca 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/sparc/syscall_nr.h b/linux-user/sparc/syscall_nr.h
index 2d77e19bec..162099f9ce 100644
--- a/linux-user/sparc/syscall_nr.h
+++ b/linux-user/sparc/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_SPARC_SYSCALL_NR_H
+#define LINUX_USER_SPARC_SYSCALL_NR_H
+
 #define TARGET_NR_exit                 1 /* Common                                      */
 #define TARGET_NR_fork                 2 /* Common                                      */
 #define TARGET_NR_read                 3 /* Common                                      */
@@ -356,3 +359,5 @@
 #define TARGET_NR_preadv2               358
 #define TARGET_NR_pwritev2              359
 #define TARGET_NR_statx                 360
+
+#endif
diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
index 113d6dfbdb..f85219ed71 100644
--- a/linux-user/sparc/termbits.h
+++ b/linux-user/sparc/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_SPARC_TERMBITS_H
+#define LINUX_USER_SPARC_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -278,3 +281,5 @@ struct target_termios {
 #define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
 #define TARGET_TIOCMIWAIT	0x545C /* Wait input */
 #define TARGET_TIOCGICOUNT	0x545D /* Read serial port inline interrupt counts */
+
+#endif
diff --git a/linux-user/sparc64/syscall_nr.h b/linux-user/sparc64/syscall_nr.h
index 0b91b896da..6b088c9862 100644
--- a/linux-user/sparc64/syscall_nr.h
+++ b/linux-user/sparc64/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_SPARC64_SYSCALL_NR_H
+#define LINUX_USER_SPARC64_SYSCALL_NR_H
+
 #define TARGET_NR_restart_syscall      0 /* Linux Specific				   */
 #define TARGET_NR_exit                 1 /* Common                                      */
 #define TARGET_NR_fork                 2 /* Common                                      */
@@ -359,3 +362,5 @@
 #define TARGET_NR_preadv2               358
 #define TARGET_NR_pwritev2              359
 #define TARGET_NR_statx                 360
+
+#endif
diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h
index 113d6dfbdb..11b5abcf84 100644
--- a/linux-user/sparc64/termbits.h
+++ b/linux-user/sparc64/termbits.h
@@ -1,5 +1,8 @@
 /* from asm/termbits.h */
 
+#ifndef LINUX_USER_SPARC64_TERMBITS_H
+#define LINUX_USER_SPARC64_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 struct target_termios {
@@ -278,3 +281,5 @@ struct target_termios {
 #define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
 #define TARGET_TIOCMIWAIT	0x545C /* Wait input */
 #define TARGET_TIOCGICOUNT	0x545D /* Read serial port inline interrupt counts */
+
+#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ac3b5dc393..b187c1281d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -55,7 +55,6 @@
 #include <linux/icmpv6.h>
 #include <linux/errqueue.h>
 #include <linux/random.h>
-#include "qemu-common.h"
 #ifdef CONFIG_TIMERFD
 #include <sys/timerfd.h>
 #endif
diff --git a/linux-user/target_flat.h b/linux-user/target_flat.h
index 0ba6bdd12e..8fe189ea6f 100644
--- a/linux-user/target_flat.h
+++ b/linux-user/target_flat.h
@@ -1,6 +1,10 @@
 /* If your arch needs to do custom stuff, create your own target_flat.h
  * header file in linux-user/<your arch>/
  */
+
+#ifndef LINUX_USER_TARGET_FLAT_H
+#define LINUX_USER_TARGET_FLAT_H
+
 #define flat_argvp_envp_on_stack()                           1
 #define flat_reloc_valid(reloc, size)                        ((reloc) <= (size))
 #define flat_old_ram_flag(flag)                              (flag)
@@ -8,3 +12,5 @@
 #define flat_get_addr_from_rp(rp, relval, flags, persistent) (rp)
 #define flat_set_persistent(relval, persistent)              (*persistent)
 #define flat_put_addr_at_rp(rp, addr, relval)                put_user_ual(addr, rp)
+
+#endif
diff --git a/linux-user/tilegx/cpu_loop.c b/linux-user/tilegx/cpu_loop.c
index d4abe29dcd..490a8f38e5 100644
--- a/linux-user/tilegx/cpu_loop.c
+++ b/linux-user/tilegx/cpu_loop.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu.h"
 #include "cpu_loop-common.h"
 
diff --git a/linux-user/x86_64/syscall_nr.h b/linux-user/x86_64/syscall_nr.h
index 16397b3e8f..9b6981e74c 100644
--- a/linux-user/x86_64/syscall_nr.h
+++ b/linux-user/x86_64/syscall_nr.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_X86_64_SYSCALL_NR_H
+#define LINUX_USER_X86_64_SYSCALL_NR_H
+
 #define TARGET_NR_read                                0
 #define TARGET_NR_write                               1
 #define TARGET_NR_open                                2
@@ -325,3 +328,5 @@
 #define TARGET_NR_membarrier            324
 #define TARGET_NR_mlock2                325
 #define TARGET_NR_copy_file_range       326
+
+#endif
diff --git a/linux-user/x86_64/termbits.h b/linux-user/x86_64/termbits.h
index f5776a8aa6..c8bb5996b1 100644
--- a/linux-user/x86_64/termbits.h
+++ b/linux-user/x86_64/termbits.h
@@ -1,3 +1,6 @@
+#ifndef LINUX_USER_X86_64_TERMBITS_H
+#define LINUX_USER_X86_64_TERMBITS_H
+
 #define TARGET_NCCS 19
 
 typedef unsigned char	target_cc_t;
@@ -246,3 +249,5 @@ struct target_termios {
 #define TARGET_TIOCPKT_DOSTOP		32
 
 #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+#endif
diff --git a/linux-user/xtensa/target_flat.h b/linux-user/xtensa/target_flat.h
index 732adddb0d..25fe3f5f3b 100644
--- a/linux-user/xtensa/target_flat.h
+++ b/linux-user/xtensa/target_flat.h
@@ -1,6 +1,6 @@
-/* If your arch needs to do custom stuff, create your own target_flat.h
- * header file in linux-user/<your arch>/
- */
+#ifndef LINUX_USER_XTENSA_TARGET_FLAT_H
+#define LINUX_USER_XTENSA_TARGET_FLAT_H
+
 #define flat_argvp_envp_on_stack()                           0
 #define flat_reloc_valid(reloc, size)                        ((reloc) <= (size))
 #define flat_old_ram_flag(flag)                              (flag)
@@ -8,3 +8,5 @@
 #define flat_get_addr_from_rp(rp, relval, flags, persistent) (rp)
 #define flat_set_persistent(relval, persistent)              (*persistent)
 #define flat_put_addr_at_rp(rp, addr, relval)                put_user_ual(addr, rp)
+
+#endif