summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/sparc/getsysstats.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-15 23:43:36 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-15 23:43:36 +0000
commitf43b4be6556daf9d406bca5d3cfe4e6722ef02c7 (patch)
tree52b943c631f440ba2ade379ce27119ff6ed87991 /sysdeps/unix/sysv/linux/sparc/getsysstats.c
parent4c869eb67e0852e8026c9975bca5239adf6956d0 (diff)
downloadglibc-f43b4be6556daf9d406bca5d3cfe4e6722ef02c7.tar.gz
* 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.
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc/getsysstats.c')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/getsysstats.c9
1 files changed, 5 insertions, 4 deletions
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 <schwab@suse.de> and
Jakub Jelinek <jj@ultra.linux.cz>
@@ -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)