Skip to content

Commit

Permalink
bsd-user: Implement host_to_target_waitstatus conversion.
Browse files Browse the repository at this point in the history
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20230925182425.3163-10-kariem.taha2.7@gmail.com>
  • Loading branch information
staceyson authored and bsdimp committed Oct 3, 2023
1 parent 66c51d6 commit 3f44e27
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bsd-user/bsd-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 3f44e27

Please sign in to comment.