From 83f59ff1c121f3a872041f060dd6994aca4a279e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 19 Oct 2019 09:54:46 +0200 Subject: [PATCH] linux: fix arm64 SYS__sysctl build breakage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The arm64 architecture never had a _sysctl system call and therefore doesn't have a SYS__sysctl define either. Always return UV_ENOSYS. Fixes: https://github.com/libuv/libuv/issues/2522 PR-URL: https://github.com/libuv/libuv/pull/2524 Reviewed-By: Saúl Ibarra Corretgé Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- src/unix/random-sysctl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/unix/random-sysctl.c b/src/unix/random-sysctl.c index 7af2e320..fb182ded 100644 --- a/src/unix/random-sysctl.c +++ b/src/unix/random-sysctl.c @@ -65,9 +65,18 @@ int uv__random_sysctl(void* buf, size_t buflen) { * an okay trade-off for the fallback of the fallback: this function is * only called when neither getrandom(2) nor /dev/urandom are available. * Fails with ENOSYS on kernels configured without CONFIG_SYSCTL_SYSCALL. + * At least arm64 never had a _sysctl system call and therefore doesn't + * have a SYS__sysctl define either. */ +#ifdef SYS__sysctl if (syscall(SYS__sysctl, &args) == -1) return UV__ERR(errno); +#else + { + (void) &args; + return UV_ENOSYS; + } +#endif if (n != sizeof(uuid)) return UV_EIO; /* Can't happen. */