[PATCH] linux: Use /proc/stat fallback for __get_nprocs_conf (BZ #28624)

Andreas Schwab schwab@linux-m68k.org
Thu Nov 25 13:40:32 GMT 2021


On Nov 25 2021, Adhemerval Zanella via Libc-alpha wrote:

> diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
> index 15ad91cf2f..0165e58b05 100644
> --- a/sysdeps/unix/sysv/linux/getsysstats.c
> +++ b/sysdeps/unix/sysv/linux/getsysstats.c
> @@ -107,6 +107,39 @@ next_line (int fd, char *const buffer, char **cp, char **re,
>    return res == *re ? NULL : res;
>  }
>  
> +static int
> +get_nproc_stat (void)
> +{
> +  enum { buffer_size = 1024 };
> +  char buffer[buffer_size];

Perhaps reuse the array from the caller (for __get_nprocs)?

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