diff options
Diffstat (limited to 'procps/top.c')
-rw-r--r-- | procps/top.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/procps/top.c b/procps/top.c index 4204deaf2..b70a42a72 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -155,11 +155,11 @@ static unsigned long Hertz; | |||
155 | 155 | ||
156 | #define FILE_TO_BUF(filename, fd) do{ \ | 156 | #define FILE_TO_BUF(filename, fd) do{ \ |
157 | if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \ | 157 | if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \ |
158 | perror_msg_and_die("/proc not be mounted?"); \ | 158 | bb_perror_msg_and_die("/proc not be mounted?"); \ |
159 | } \ | 159 | } \ |
160 | lseek(fd, 0L, SEEK_SET); \ | 160 | lseek(fd, 0L, SEEK_SET); \ |
161 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ | 161 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ |
162 | perror_msg_and_die("%s", filename); \ | 162 | bb_perror_msg_and_die("%s", filename); \ |
163 | } \ | 163 | } \ |
164 | buf[local_n] = '\0'; \ | 164 | buf[local_n] = '\0'; \ |
165 | }while(0) | 165 | }while(0) |
@@ -167,7 +167,7 @@ static unsigned long Hertz; | |||
167 | #define FILE_TO_BUF2(filename, fd) do{ \ | 167 | #define FILE_TO_BUF2(filename, fd) do{ \ |
168 | lseek(fd, 0L, SEEK_SET); \ | 168 | lseek(fd, 0L, SEEK_SET); \ |
169 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ | 169 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ |
170 | perror_msg_and_die("%s", filename); \ | 170 | bb_perror_msg_and_die("%s", filename); \ |
171 | } \ | 171 | } \ |
172 | buf[local_n] = '\0'; \ | 172 | buf[local_n] = '\0'; \ |
173 | }while(0) | 173 | }while(0) |
@@ -313,19 +313,19 @@ static unsigned long display_generic(void) | |||
313 | unsigned long total, used, mfree, shared, buffers, cached; | 313 | unsigned long total, used, mfree, shared, buffers, cached; |
314 | 314 | ||
315 | /* read memory info */ | 315 | /* read memory info */ |
316 | fp = xfopen("meminfo", "r"); | 316 | fp = bb_xfopen("meminfo", "r"); |
317 | fgets(buf, sizeof(buf), fp); /* skip first line */ | 317 | fgets(buf, sizeof(buf), fp); /* skip first line */ |
318 | 318 | ||
319 | if (fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu", | 319 | if (fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu", |
320 | &total, &used, &mfree, &shared, &buffers, &cached) != 6) { | 320 | &total, &used, &mfree, &shared, &buffers, &cached) != 6) { |
321 | error_msg_and_die("failed to read '%s'", "meminfo"); | 321 | bb_error_msg_and_die("failed to read '%s'", "meminfo"); |
322 | } | 322 | } |
323 | fclose(fp); | 323 | fclose(fp); |
324 | 324 | ||
325 | /* read load average */ | 325 | /* read load average */ |
326 | fp = xfopen("loadavg", "r"); | 326 | fp = bb_xfopen("loadavg", "r"); |
327 | if (fscanf(fp, "%f %f %f", &avg1, &avg2, &avg3) != 3) { | 327 | if (fscanf(fp, "%f %f %f", &avg1, &avg2, &avg3) != 3) { |
328 | error_msg_and_die("failed to read '%s'", "loadavg"); | 328 | bb_error_msg_and_die("failed to read '%s'", "loadavg"); |
329 | } | 329 | } |
330 | fclose(fp); | 330 | fclose(fp); |
331 | 331 | ||
@@ -447,7 +447,7 @@ int top_main(int argc, char **argv) | |||
447 | interval = atoi(optarg); | 447 | interval = atoi(optarg); |
448 | break; | 448 | break; |
449 | default: | 449 | default: |
450 | show_usage(); | 450 | bb_show_usage(); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
@@ -461,7 +461,7 @@ int top_main(int argc, char **argv) | |||
461 | #endif | 461 | #endif |
462 | /* change to /proc */ | 462 | /* change to /proc */ |
463 | if (chdir("/proc") < 0) { | 463 | if (chdir("/proc") < 0) { |
464 | perror_msg_and_die("chdir('/proc')"); | 464 | bb_perror_msg_and_die("chdir('/proc')"); |
465 | } | 465 | } |
466 | #if defined CONFIG_FEATURE_USE_TERMIOS | 466 | #if defined CONFIG_FEATURE_USE_TERMIOS |
467 | tcgetattr(0, (void *) &initial_settings); | 467 | tcgetattr(0, (void *) &initial_settings); |
@@ -508,7 +508,7 @@ int top_main(int argc, char **argv) | |||
508 | memcpy(top + n, p, sizeof(procps_status_t)); | 508 | memcpy(top + n, p, sizeof(procps_status_t)); |
509 | } | 509 | } |
510 | if (ntop == 0) { | 510 | if (ntop == 0) { |
511 | perror_msg_and_die("scandir('/proc')"); | 511 | bb_perror_msg_and_die("scandir('/proc')"); |
512 | } | 512 | } |
513 | #ifdef FEATURE_CPU_USAGE_PERCENTAGE | 513 | #ifdef FEATURE_CPU_USAGE_PERCENTAGE |
514 | if(!Hertz) { | 514 | if(!Hertz) { |