[PATCH v7 1/6] riscv: Add Linux hwprobe syscall support
Florian Weimer
fweimer@redhat.com
Thu Aug 24 05:50:36 GMT 2023
* Evan Green:
> diff --git a/sysdeps/unix/sysv/linux/riscv/hwprobe.c b/sysdeps/unix/sysv/linux/riscv/hwprobe.c
> new file mode 100644
> index 0000000000..f2dc46cfd7
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/hwprobe.c
> @@ -0,0 +1,39 @@
> +int __riscv_hwprobe (struct riscv_hwprobe *__pairs, size_t __pair_count,
> + size_t __cpu_count, unsigned long int *__cpus,
> + unsigned int __flags)
> +{
> + int r;
> +
> + r = INTERNAL_SYSCALL_CALL (riscv_hwprobe, 5, __pairs, __pair_count,
> + __cpu_count, __cpus, __flags);
> +
> + /* Negate negative errno values to match pthreads API. */
> + if (r < 0)
> + r = -r;
> +
> + return r;
> +}
I would expect:
+ /* Positive errno values to match pthreads API. */
+ return -r;
If the kernel ever returns positive values, the if condition won't save
us.
Thanks,
Florian
More information about the Libc-alpha
mailing list