diff mbox series

[v4,9/9] common-user: Move safe-syscall.* from *-user

Message ID 20211116110256.365484-10-richard.henderson@linaro.org
State New
Headers show
Series linux-user: simplify safe signal handling | expand

Commit Message

Richard Henderson Nov. 16, 2021, 11:02 a.m. UTC
From: Warner Losh <imp@bsdimp.com>

Move linux-user/safe-syscall.S to common-user so that bsd-user
can also use it.  Also move safe-syscall.h to include/user/.

Signed-off-by: Warner Losh <imp@bsdimp.com>
[rth: Adjust build rules to eliminate common-save-syscall.S.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 meson.build                                 | 8 ++++++--
 {linux-user => include/user}/safe-syscall.h | 0
 linux-user/signal.c                         | 2 +-
 linux-user/syscall.c                        | 2 +-
 common-user/meson.build                     | 2 ++
 {linux-user => common-user}/safe-syscall.S  | 0
 linux-user/meson.build                      | 1 -
 7 files changed, 10 insertions(+), 5 deletions(-)
 rename {linux-user => include/user}/safe-syscall.h (100%)
 create mode 100644 common-user/meson.build
 rename {linux-user => common-user}/safe-syscall.S (100%)
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index ec22cf05c1..c5b0b2b247 100644
--- a/meson.build
+++ b/meson.build
@@ -2359,6 +2359,7 @@  block_ss = ss.source_set()
 bsd_user_ss = ss.source_set()
 chardev_ss = ss.source_set()
 common_ss = ss.source_set()
+common_user_ss = ss.source_set()
 crypto_ss = ss.source_set()
 hwcore_ss = ss.source_set()
 io_ss = ss.source_set()
@@ -2605,12 +2606,15 @@  subdir('accel')
 subdir('plugins')
 subdir('bsd-user')
 subdir('linux-user')
+subdir('common-user')
 subdir('ebpf')
 
-specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
+specific_ss.add_all(when: 'CONFIG_BSD_USER',
+                    if_true: [bsd_user_ss, common_user_ss])
 
 linux_user_ss.add(files('thunk.c'))
-specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
+specific_ss.add_all(when: 'CONFIG_LINUX_USER',
+                    if_true: [linux_user_ss, common_user_ss])
 
 # needed for fuzzing binaries
 subdir('tests/qtest/libqos')
diff --git a/linux-user/safe-syscall.h b/include/user/safe-syscall.h
similarity index 100%
rename from linux-user/safe-syscall.h
rename to include/user/safe-syscall.h
diff --git a/linux-user/signal.c b/linux-user/signal.c
index ca8f24b9ec..0744c6bf20 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -31,7 +31,7 @@ 
 #include "trace.h"
 #include "signal-common.h"
 #include "host-signal.h"
-#include "safe-syscall.h"
+#include "user/safe-syscall.h"
 
 static struct target_sigaction sigact_table[TARGET_NSIG];
 
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 544f5b662f..0c5f63d08c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -132,7 +132,7 @@ 
 #include "signal-common.h"
 #include "loader.h"
 #include "user-mmap.h"
-#include "safe-syscall.h"
+#include "user/safe-syscall.h"
 #include "qemu/guest-random.h"
 #include "qemu/selfmap.h"
 #include "user/syscall-trace.h"
diff --git a/common-user/meson.build b/common-user/meson.build
new file mode 100644
index 0000000000..233b69199c
--- /dev/null
+++ b/common-user/meson.build
@@ -0,0 +1,2 @@ 
+# TODO: reorg the *-user headers so that this can be built once.
+common_user_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('safe-syscall.S'))
diff --git a/linux-user/safe-syscall.S b/common-user/safe-syscall.S
similarity index 100%
rename from linux-user/safe-syscall.S
rename to common-user/safe-syscall.S
diff --git a/linux-user/meson.build b/linux-user/meson.build
index bf62c13e37..af8d39aecc 100644
--- a/linux-user/meson.build
+++ b/linux-user/meson.build
@@ -9,7 +9,6 @@  linux_user_ss.add(files(
   'linuxload.c',
   'main.c',
   'mmap.c',
-  'safe-syscall.S',
   'signal.c',
   'strace.c',
   'syscall.c',