diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/kill.c | 2 | ||||
-rw-r--r-- | procps/top.c | 25 |
2 files changed, 17 insertions, 10 deletions
diff --git a/procps/kill.c b/procps/kill.c index 8c2bc2b6f..583d61aaf 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -85,8 +85,8 @@ | |||
85 | * This brings some complications: | 85 | * This brings some complications: |
86 | * | 86 | * |
87 | * + we can't use xfunc here | 87 | * + we can't use xfunc here |
88 | * + we can't use applet_name | ||
89 | * + we can't use bb_show_usage | 88 | * + we can't use bb_show_usage |
89 | * + applet_name can be the name of the shell | ||
90 | * (doesn't apply for killall[5], still should be careful b/c NOFORK) | 90 | * (doesn't apply for killall[5], still should be careful b/c NOFORK) |
91 | * | 91 | * |
92 | * kill %n gets translated into kill ' -<process group>' by shell (note space!) | 92 | * kill %n gets translated into kill ' -<process group>' by shell (note space!) |
diff --git a/procps/top.c b/procps/top.c index ff775422c..6d25d9633 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -619,17 +619,15 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width) | |||
619 | unsigned busy_jifs; | 619 | unsigned busy_jifs; |
620 | #endif | 620 | #endif |
621 | 621 | ||
622 | /* what info of the processes is shown */ | ||
623 | printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width, | ||
624 | " PID PPID USER STAT VSZ %VSZ" | ||
625 | IF_FEATURE_TOP_SMP_PROCESS(" CPU") | ||
626 | IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU") | ||
627 | " COMMAND"); | ||
628 | lines_rem--; | ||
629 | |||
630 | #if ENABLE_FEATURE_TOP_DECIMALS | 622 | #if ENABLE_FEATURE_TOP_DECIMALS |
631 | # define UPSCALE 1000 | 623 | # define UPSCALE 1000 |
632 | # define CALC_STAT(name, val) div_t name = div((val), 10) | 624 | typedef struct { unsigned quot, rem; } bb_div_t; |
625 | /* Used to have "div_t name = div((val), 10)" here | ||
626 | * (IOW: intended to use libc-compatible way to divide and use | ||
627 | * both result and remainder, but musl does not inline div()...) | ||
628 | * Oh well. Modern compilers detect "N/d, N%d" idiom by themselves: | ||
629 | */ | ||
630 | # define CALC_STAT(name, val) bb_div_t name = { (val) / 10, (val) % 10 } | ||
633 | # define SHOW_STAT(name) name.quot, '0'+name.rem | 631 | # define SHOW_STAT(name) name.quot, '0'+name.rem |
634 | # define FMT "%3u.%c" | 632 | # define FMT "%3u.%c" |
635 | #else | 633 | #else |
@@ -638,6 +636,15 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width) | |||
638 | # define SHOW_STAT(name) name | 636 | # define SHOW_STAT(name) name |
639 | # define FMT "%4u%%" | 637 | # define FMT "%4u%%" |
640 | #endif | 638 | #endif |
639 | |||
640 | /* what info of the processes is shown */ | ||
641 | printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width, | ||
642 | " PID PPID USER STAT VSZ %VSZ" | ||
643 | IF_FEATURE_TOP_SMP_PROCESS(" CPU") | ||
644 | IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU") | ||
645 | " COMMAND"); | ||
646 | lines_rem--; | ||
647 | |||
641 | /* | 648 | /* |
642 | * %VSZ = s->vsz/MemTotal | 649 | * %VSZ = s->vsz/MemTotal |
643 | */ | 650 | */ |