aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Vanotti <mvanotti@users.noreply.github.com>2022-08-12 08:15:05 -0700
committerGitHub <noreply@github.com>2022-08-12 08:15:05 -0700
commit17f16b2425f6228254d590d8fc80727709af56cf (patch)
treefe0e25985063a3e61995acda675a3e490bf52aa7
parent402cd70d5792ac0fd0d4eb2ec81963ce378bf5a5 (diff)
executor: revert errno logic for fuchsia (#3306)
Commit 4ce69996ec362f8dd9762dcc1643d13cebaab44a changed the logic for processing results for fuchsia system calls. That change seems to be fault, as it sets syscalls that return with ZX_OK to return -1 instead. I am reverting that commit for now.
-rw-r--r--executor/executor_fuchsia.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/executor/executor_fuchsia.h b/executor/executor_fuchsia.h
index 646711079..c0856b5f3 100644
--- a/executor/executor_fuchsia.h
+++ b/executor/executor_fuchsia.h
@@ -22,6 +22,15 @@ static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs])
{
intptr_t res = c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
if (strncmp(c->name, "zx_", 3) == 0) {
+ // Convert zircon error convention to the libc convention that executor expects.
+ // The following calls return arbitrary integers instead of error codes.
+ if (res == ZX_OK ||
+ !strcmp(c->name, "zx_debuglog_read") ||
+ !strcmp(c->name, "zx_clock_get") ||
+ !strcmp(c->name, "zx_clock_get_monotonic") ||
+ !strcmp(c->name, "zx_deadline_after") ||
+ !strcmp(c->name, "zx_ticks_get"))
+ return 0;
errno = (-res) & 0x7f;
return -1;
}