diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/free.c | 16 | ||||
-rw-r--r-- | procps/fuser.c | 2 | ||||
-rw-r--r-- | procps/nmeter.c | 10 | ||||
-rw-r--r-- | procps/pidof.c | 2 | ||||
-rw-r--r-- | procps/pmap.c | 12 | ||||
-rw-r--r-- | procps/ps.c | 2 |
6 files changed, 23 insertions, 21 deletions
diff --git a/procps/free.c b/procps/free.c index b33506b9e..0adef501f 100644 --- a/procps/free.c +++ b/procps/free.c | |||
@@ -97,10 +97,10 @@ int free_main(int argc UNUSED_PARAM, char **argv IF_NOT_DESKTOP(UNUSED_PARAM)) | |||
97 | case 'k': /* 2^10 */ | 97 | case 'k': /* 2^10 */ |
98 | /* G.unit_steps = 10; - already is */ | 98 | /* G.unit_steps = 10; - already is */ |
99 | break; | 99 | break; |
100 | case 'm': /* 2^(2*10) */ | 100 | case 'm': /* 2^20 */ |
101 | G.unit_steps = 20; | 101 | G.unit_steps = 20; |
102 | break; | 102 | break; |
103 | case 'g': /* 2^(3*10) */ | 103 | case 'g': /* 2^30 */ |
104 | G.unit_steps = 30; | 104 | G.unit_steps = 30; |
105 | break; | 105 | break; |
106 | default: | 106 | default: |
@@ -117,16 +117,24 @@ int free_main(int argc UNUSED_PARAM, char **argv IF_NOT_DESKTOP(UNUSED_PARAM)) | |||
117 | ); | 117 | ); |
118 | 118 | ||
119 | sysinfo(&info); | 119 | sysinfo(&info); |
120 | /* Kernels prior to 2.4.x will return info.mem_unit==0, so cope... */ | ||
121 | G.mem_unit = (info.mem_unit ? info.mem_unit : 1); | ||
122 | /* Extract cached and memavailable from /proc/meminfo and convert to mem_units */ | 120 | /* Extract cached and memavailable from /proc/meminfo and convert to mem_units */ |
123 | seen_available = parse_meminfo(&G); | 121 | seen_available = parse_meminfo(&G); |
122 | G.mem_unit = (info.mem_unit ? info.mem_unit : 1); /* kernels < 2.4.x return mem_unit==0, so cope */ | ||
124 | available = ((unsigned long long) G.available_kb * 1024) / G.mem_unit; | 123 | available = ((unsigned long long) G.available_kb * 1024) / G.mem_unit; |
125 | cached = ((unsigned long long) G.cached_kb * 1024) / G.mem_unit; | 124 | cached = ((unsigned long long) G.cached_kb * 1024) / G.mem_unit; |
126 | cached += info.bufferram; | 125 | cached += info.bufferram; |
127 | cached += ((unsigned long long) G.reclaimable_kb * 1024) / G.mem_unit; | 126 | cached += ((unsigned long long) G.reclaimable_kb * 1024) / G.mem_unit; |
128 | cached_plus_free = cached + info.freeram; | 127 | cached_plus_free = cached + info.freeram; |
129 | 128 | ||
129 | /* In case (long long * G.mem_unit) can overflow, this can be used to reduce the chances */ | ||
130 | #if 0 //ENABLE_DESKTOP | ||
131 | while (!(G.mem_unit & 1) && G.unit_steps != 0) { | ||
132 | G.mem_unit >>= 1; | ||
133 | G.unit_steps--; | ||
134 | //bb_error_msg("mem_unit:%d unit_steps:%d", G.mem_unit, G.unit_steps); | ||
135 | } | ||
136 | #endif | ||
137 | |||
130 | #define FIELDS_6 "%12llu %11llu %11llu %11llu %11llu %11llu\n" | 138 | #define FIELDS_6 "%12llu %11llu %11llu %11llu %11llu %11llu\n" |
131 | #define FIELDS_3 (FIELDS_6 + 6 + 7 + 7) | 139 | #define FIELDS_3 (FIELDS_6 + 6 + 7 + 7) |
132 | #define FIELDS_2 (FIELDS_6 + 6 + 7 + 7 + 7) | 140 | #define FIELDS_2 (FIELDS_6 + 6 + 7 + 7 + 7) |
diff --git a/procps/fuser.c b/procps/fuser.c index 418f57b57..191746751 100644 --- a/procps/fuser.c +++ b/procps/fuser.c | |||
@@ -19,7 +19,7 @@ | |||
19 | //kbuild:lib-$(CONFIG_FUSER) += fuser.o | 19 | //kbuild:lib-$(CONFIG_FUSER) += fuser.o |
20 | 20 | ||
21 | //usage:#define fuser_trivial_usage | 21 | //usage:#define fuser_trivial_usage |
22 | //usage: "[OPTIONS] FILE or PORT/PROTO" | 22 | //usage: "[-msk46] [-SIGNAL] FILE or PORT/PROTO" |
23 | //usage:#define fuser_full_usage "\n\n" | 23 | //usage:#define fuser_full_usage "\n\n" |
24 | //usage: "Find processes which use FILEs or PORTs\n" | 24 | //usage: "Find processes which use FILEs or PORTs\n" |
25 | //usage: "\n -m Find processes which use same fs as FILEs" | 25 | //usage: "\n -m Find processes which use same fs as FILEs" |
diff --git a/procps/nmeter.c b/procps/nmeter.c index 856ce0202..f08938654 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c | |||
@@ -838,7 +838,7 @@ static void FAST_FUNC collect_info(s_stat *s) | |||
838 | typedef s_stat* init_func(const char *param); | 838 | typedef s_stat* init_func(const char *param); |
839 | 839 | ||
840 | static const char options[] ALIGN1 = "ncmsfixptTbr"; | 840 | static const char options[] ALIGN1 = "ncmsfixptTbr"; |
841 | static init_func *const init_functions[] = { | 841 | static init_func *const init_functions[] ALIGN_PTR = { |
842 | init_if, | 842 | init_if, |
843 | init_cpu, | 843 | init_cpu, |
844 | init_mem, | 844 | init_mem, |
@@ -952,11 +952,11 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv) | |||
952 | reset_outbuf(); | 952 | reset_outbuf(); |
953 | 953 | ||
954 | if (G.delta >= 0) { | 954 | if (G.delta >= 0) { |
955 | gettimeofday(&G.tv, NULL); | 955 | xgettimeofday(&G.tv); |
956 | usleep(G.delta > 1000000 ? 1000000 : G.delta - G.tv.tv_usec % G.deltanz); | 956 | usleep(G.delta > 1000000 ? 1000000 : G.delta - G.tv.tv_usec % G.deltanz); |
957 | } | 957 | } |
958 | 958 | ||
959 | gettimeofday(&G.start, NULL); | 959 | xgettimeofday(&G.start); |
960 | G.tv = G.start; | 960 | G.tv = G.start; |
961 | while (1) { | 961 | while (1) { |
962 | collect_info(first); | 962 | collect_info(first); |
@@ -971,7 +971,7 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv) | |||
971 | if (G.delta >= 0) { | 971 | if (G.delta >= 0) { |
972 | int rem; | 972 | int rem; |
973 | // can be commented out, will sacrifice sleep time precision a bit | 973 | // can be commented out, will sacrifice sleep time precision a bit |
974 | gettimeofday(&G.tv, NULL); | 974 | xgettimeofday(&G.tv); |
975 | if (need_seconds) | 975 | if (need_seconds) |
976 | rem = G.delta - ((ullong)G.tv.tv_sec*1000000 + G.tv.tv_usec) % G.deltanz; | 976 | rem = G.delta - ((ullong)G.tv.tv_sec*1000000 + G.tv.tv_usec) % G.deltanz; |
977 | else | 977 | else |
@@ -983,7 +983,7 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv) | |||
983 | } | 983 | } |
984 | usleep(rem); | 984 | usleep(rem); |
985 | } | 985 | } |
986 | gettimeofday(&G.tv, NULL); | 986 | xgettimeofday(&G.tv); |
987 | } | 987 | } |
988 | 988 | ||
989 | /*return 0;*/ | 989 | /*return 0;*/ |
diff --git a/procps/pidof.c b/procps/pidof.c index 5595e3421..b81709a81 100644 --- a/procps/pidof.c +++ b/procps/pidof.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | //usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) | 40 | //usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) |
41 | //usage:#define pidof_trivial_usage | 41 | //usage:#define pidof_trivial_usage |
42 | //usage: "[OPTIONS] [NAME]..." | 42 | //usage: IF_FEATURE_PIDOF_SINGLE("[-s] ")IF_FEATURE_PIDOF_OMIT("[-o PID] ")"[NAME]..." |
43 | //usage:#define USAGE_PIDOF "\n" | 43 | //usage:#define USAGE_PIDOF "\n" |
44 | //usage:#else | 44 | //usage:#else |
45 | //usage:#define pidof_trivial_usage | 45 | //usage:#define pidof_trivial_usage |
diff --git a/procps/pmap.c b/procps/pmap.c index 9e541c707..408cbfce7 100644 --- a/procps/pmap.c +++ b/procps/pmap.c | |||
@@ -27,20 +27,14 @@ | |||
27 | 27 | ||
28 | #include "libbb.h" | 28 | #include "libbb.h" |
29 | 29 | ||
30 | #if ULONG_MAX == 0xffffffff | 30 | #if ULLONG_MAX == 0xffffffff |
31 | # define TABS "\t" | 31 | # define TABS "\t" |
32 | # define AFMT "8" | 32 | # define AFMTLL "8" |
33 | # define DASHES "" | 33 | # define DASHES "" |
34 | #else | 34 | #else |
35 | # define TABS "\t\t" | 35 | # define TABS "\t\t" |
36 | # define AFMT "16" | ||
37 | # define DASHES "--------" | ||
38 | #endif | ||
39 | |||
40 | #if ULLONG_MAX == 0xffffffff | ||
41 | # define AFMTLL "8" | ||
42 | #else | ||
43 | # define AFMTLL "16" | 36 | # define AFMTLL "16" |
37 | # define DASHES "--------" | ||
44 | #endif | 38 | #endif |
45 | 39 | ||
46 | enum { | 40 | enum { |
diff --git a/procps/ps.c b/procps/ps.c index a4de11379..f84060447 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -381,7 +381,7 @@ static void func_pcpu(char *buf, int size, const procps_status_t *ps) | |||
381 | } | 381 | } |
382 | */ | 382 | */ |
383 | 383 | ||
384 | static const ps_out_t out_spec[] = { | 384 | static const ps_out_t out_spec[] ALIGN_PTR = { |
385 | /* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ | 385 | /* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ |
386 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, | 386 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, |
387 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, | 387 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, |