linux: fix arm64 SYS__sysctl build breakage

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é <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Ben Noordhuis 2019-10-19 09:54:46 +02:00 committed by cjihrig
parent cb7e5a6aff
commit 83f59ff1c1
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -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 * an okay trade-off for the fallback of the fallback: this function is
* only called when neither getrandom(2) nor /dev/urandom are available. * only called when neither getrandom(2) nor /dev/urandom are available.
* Fails with ENOSYS on kernels configured without CONFIG_SYSCTL_SYSCALL. * 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) if (syscall(SYS__sysctl, &args) == -1)
return UV__ERR(errno); return UV__ERR(errno);
#else
{
(void) &args;
return UV_ENOSYS;
}
#endif
if (n != sizeof(uuid)) if (n != sizeof(uuid))
return UV_EIO; /* Can't happen. */ return UV_EIO; /* Can't happen. */