Line
Link Here
|
|
* sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER): |
|
* sysdeps/unix/sysv/linux/alpha/getsysstats.c (GET_NPROCS_PARSER): |
1 |
Change parameters and use next_line. |
1 |
Change parameters and use next_line. |
2 |
-- |
|
|
3 |
ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c | 5 +++-- |
2 |
ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c | 5 +++-- |
4 |
1 file changed, 3 insertions(+), 2 deletions(-) |
3 |
1 file changed, 3 insertions(+), 2 deletions(-) |
5 |
-- a/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c |
4 |
++ b/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c |
Lines 20-34
Link Here
|
20 |
|
20 |
|
21 |
|
21 |
|
22 |
/* We need to define a special parser for /proc/cpuinfo. */ |
22 |
/* We need to define a special parser for /proc/cpuinfo. */ |
23 |
#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ |
23 |
#define GET_NPROCS_PARSER(FD, BUFFER, CP, RE, BUFFER_END, RESULT) \ |
24 |
do \ |
24 |
do \ |
25 |
{ \ |
25 |
{ \ |
26 |
/* Find the line that contains the information about the number of \ |
26 |
/* Find the line that contains the information about the number of \ |
27 |
active cpus. We don't have to fear extremely long lines since \ |
27 |
active cpus. We don't have to fear extremely long lines since \ |
28 |
the kernel will not generate them. 8192 bytes are really enough. \ |
28 |
the kernel will not generate them. 8192 bytes are really enough. \ |
29 |
If there is no "CPUs ..." line then we are on a UP system. */ \ |
29 |
If there is no "CPUs ..." line then we are on a UP system. */ \ |
|
|
30 |
char *l; \ |
30 |
(RESULT) = 1; \ |
31 |
(RESULT) = 1; \ |
31 |
while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \ |
32 |
while ((l = next_line (FD, BUFFER, &CP, &RE, BUFFER_END)) != NULL) \ |
32 |
if ((sscanf (BUFFER, "cpus active : %d", &(RESULT)) == 1) \ |
33 |
if ((sscanf (BUFFER, "cpus active : %d", &(RESULT)) == 1) \ |
33 |
|| (sscanf (BUFFER, "CPUs probed %*d active %d", \ |
34 |
|| (sscanf (BUFFER, "CPUs probed %*d active %d", \ |
34 |
&(RESULT)) == 1)) \ |
35 |
&(RESULT)) == 1)) \ |