aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--procps/top.c12
-rw-r--r--util-linux/fdisk.c2
2 files changed, 5 insertions, 9 deletions
diff --git a/procps/top.c b/procps/top.c
index 06a84c90c..d58fdda97 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -224,14 +224,12 @@ static unsigned long display_generic(int scr_width)
224 fclose(fp); 224 fclose(fp);
225 225
226 /* read load average as a string */ 226 /* read load average as a string */
227 fp = xfopen("loadavg", "r");
228 buf[0] = '\0'; 227 buf[0] = '\0';
229 fgets(buf, sizeof(buf), fp); 228 open_read_close("loadavg", buf, sizeof(buf));
230 end = strchr(buf, ' '); 229 end = strchr(buf, ' ');
231 if (end) end = strchr(end+1, ' '); 230 if (end) end = strchr(end+1, ' ');
232 if (end) end = strchr(end+1, ' '); 231 if (end) end = strchr(end+1, ' ');
233 if (end) *end = '\0'; 232 if (end) *end = '\0';
234 fclose(fp);
235 233
236 if (needs_conversion) { 234 if (needs_conversion) {
237 /* convert to kilobytes */ 235 /* convert to kilobytes */
@@ -253,8 +251,7 @@ static unsigned long display_generic(int scr_width)
253 251
254 printf(OPT_BATCH_MODE ? "%s\n" : "\e[H\e[J%s\n", scrbuf); 252 printf(OPT_BATCH_MODE ? "%s\n" : "\e[H\e[J%s\n", scrbuf);
255 253
256 snprintf(scrbuf, scr_width, 254 snprintf(scrbuf, scr_width, "Load average: %s", buf);
257 "Load average: %s", buf);
258 printf("%s\n", scrbuf); 255 printf("%s\n", scrbuf);
259 256
260 return total; 257 return total;
@@ -321,7 +318,6 @@ static void display_status(int count, int scr_width)
321 } 318 }
322 /* printf(" pmem_scale=%u pcpu_scale=%u ", pmem_scale, pcpu_scale); */ 319 /* printf(" pmem_scale=%u pcpu_scale=%u ", pmem_scale, pcpu_scale); */
323#endif 320#endif
324 if (OPT_BATCH_MODE) count--;
325 while (count-- > 0) { 321 while (count-- > 0) {
326 div_t pmem = div((s->rss*pmem_scale) >> pmem_shift, 10); 322 div_t pmem = div((s->rss*pmem_scale) >> pmem_shift, 10);
327 int col = scr_width+1; 323 int col = scr_width+1;
@@ -337,7 +333,7 @@ static void display_status(int count, int scr_width)
337 s->pid, s->user, s->state, rss_str_buf, s->ppid, 333 s->pid, s->user, s->state, rss_str_buf, s->ppid,
338 USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,) 334 USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,)
339 pmem.quot, '0'+pmem.rem); 335 pmem.quot, '0'+pmem.rem);
340 if (col>0) 336 if (col > 0)
341 printf("%.*s", col, s->short_cmd); 337 printf("%.*s", col, s->short_cmd);
342 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu, 338 /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
343 jif.busy - prev_jif.busy, jif.total - prev_jif.total); */ 339 jif.busy - prev_jif.busy, jif.total - prev_jif.total); */
@@ -463,7 +459,7 @@ int top_main(int argc, char **argv)
463 qsort(top, ntop, sizeof(procps_status_t), (void*)sort_function); 459 qsort(top, ntop, sizeof(procps_status_t), (void*)sort_function);
464#endif /* CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE */ 460#endif /* CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE */
465 count = lines; 461 count = lines;
466 if (count > ntop) { 462 if (OPT_BATCH_MODE || count > ntop) {
467 count = ntop; 463 count = ntop;
468 } 464 }
469 /* show status for each of the processes */ 465 /* show status for each of the processes */
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index adfd4d698..4749c1bd8 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2277,7 +2277,7 @@ add_partition(int n, int sys)
2277 if (start > limit) 2277 if (start > limit)
2278 break; 2278 break;
2279 if (start >= temp+units_per_sector && num_read) { 2279 if (start >= temp+units_per_sector && num_read) {
2280 printf(_("Sector %llu is already allocated\n"), (unsigned long long)temp); 2280 printf(_("Sector "OFF_T_FMT" is already allocated\n"), temp);
2281 temp = start; 2281 temp = start;
2282 num_read = 0; 2282 num_read = 0;
2283 } 2283 }