aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/bsd-proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-user/bsd-proc.c')
-rw-r--r--bsd-user/bsd-proc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/bsd-user/bsd-proc.c b/bsd-user/bsd-proc.c
index aa386ff..19f6efe 100644
--- a/bsd-user/bsd-proc.c
+++ b/bsd-user/bsd-proc.c
@@ -102,3 +102,20 @@ abi_long host_to_target_wrusage(abi_ulong target_addr,
return 0;
}
+/*
+ * wait status conversion.
+ *
+ * Map host to target signal numbers for the wait family of syscalls.
+ * Assume all other status bits are the same.
+ */
+int host_to_target_waitstatus(int status)
+{
+ if (WIFSIGNALED(status)) {
+ return host_to_target_signal(WTERMSIG(status)) | (status & ~0x7f);
+ }
+ if (WIFSTOPPED(status)) {
+ return (host_to_target_signal(WSTOPSIG(status)) << 8) | (status & 0xff);
+ }
+ return status;
+}
+