[PATCH 1/1] riscv: Get cache information through sysconf
Andrew Waterman
andrew@sifive.com
Tue Oct 27 08:32:29 GMT 2020
On Tue, Oct 27, 2020 at 1:29 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> On Okt 27 2020, Zong Li wrote:
>
> > diff --git a/sysdeps/unix/sysv/linux/riscv/sysconf.c
> > b/sysdeps/unix/sysv/linux/riscv/sysconf.c
> > index e73095528c..22ac4f8d19 100644
> > --- a/sysdeps/unix/sysv/linux/riscv/sysconf.c
> > +++ b/sysdeps/unix/sysv/linux/riscv/sysconf.c
> > @@ -24,19 +24,34 @@ static long int linux_sysconf (int name);
> > static inline long int
> > sysconf_get_cache_associativity (unsigned long type)
> > {
> > - return (__getauxval (type) & 0xffff0000) >> 16;
> > + unsigned long int val = __getauxval (type);
> > +
> > + if (errno == ENOENT)
> > + return -1;
> > + else
> > + return (val & 0xffff0000) >> 16;
>
> You need to clear errno before calling __getauxval.
Err, what Andreas said.
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
More information about the Libc-alpha
mailing list