From f43b4be6556daf9d406bca5d3cfe4e6722ef02c7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 15 Feb 2009 23:43:36 +0000 Subject: * sysdeps/unix/sysv/linux/getsysstats.c (next_line): New function. (GET_NPROCS_PARSER): Change parameters and use next_line. (__get_nprocs): Rewrite to not use stdio routines. * sysdeps/unix/sysv/linux/sparc/getsysstats.c (GET_NPROCS_PARSER): Change parameters and use next_line. --- sysdeps/unix/sysv/linux/sparc/getsysstats.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sysdeps/unix/sysv/linux/sparc/getsysstats.c') diff --git a/sysdeps/unix/sysv/linux/sparc/getsysstats.c b/sysdeps/unix/sysv/linux/sparc/getsysstats.c index f064b372ff..e96a8e5605 100644 --- a/sysdeps/unix/sysv/linux/sparc/getsysstats.c +++ b/sysdeps/unix/sysv/linux/sparc/getsysstats.c @@ -1,5 +1,5 @@ /* Determine various system internal values, Linux/Sparc version. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab and Jakub Jelinek @@ -21,7 +21,7 @@ /* We need to define a special parser for /proc/cpuinfo. */ -#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ +#define GET_NPROCS_PARSER(FD, BUFFER, CP, RE, BUFFER_END, RESULT) \ do \ { \ (RESULT) = 0; \ @@ -29,8 +29,9 @@ active cpus. We don't have to fear extremely long lines since \ the kernel will not generate them. 8192 bytes are really \ enough. */ \ - while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \ - if (sscanf (BUFFER, "ncpus active : %d", &(RESULT)) == 1) \ + char *l; \ + while ((l = next_line (FD, BUFFER, &CP, &RE, BUFFER_END)) != NULL) \ + if (sscanf (l, "ncpus active : %d", &(RESULT)) == 1) \ break; \ } \ while (0) -- cgit 1.4.1