diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-01-11 20:40:49 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-01-11 20:40:49 +0000 |
commit | 1dcf218e60849b58b1efa7ce43cf0c4e14f95617 (patch) | |
tree | db0f8169a80bae8a1af4a2a9eed91fbfc7fd23e6 | |
parent | 575c78274a7458cc9459c6e07c5ff33a103c3f3c (diff) | |
download | busybox-w32-1dcf218e60849b58b1efa7ce43cf0c4e14f95617.tar.gz busybox-w32-1dcf218e60849b58b1efa7ce43cf0c4e14f95617.tar.bz2 busybox-w32-1dcf218e60849b58b1efa7ce43cf0c4e14f95617.zip |
Patch from Daniel J Walsh at redhat to make free work for systems
with more than 1 GB of memory...
-rw-r--r-- | procps/free.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/procps/free.c b/procps/free.c index cdc0d358c..4a5469b10 100644 --- a/procps/free.c +++ b/procps/free.c | |||
@@ -37,15 +37,30 @@ extern int free_main(int argc, char **argv) | |||
37 | if (info.mem_unit==0) { | 37 | if (info.mem_unit==0) { |
38 | info.mem_unit=1; | 38 | info.mem_unit=1; |
39 | } | 39 | } |
40 | info.mem_unit*=1024; | 40 | if ( info.mem_unit == 1 ) { |
41 | 41 | info.mem_unit=1024; | |
42 | /* TODO: Make all this stuff not overflow when mem >= 4 Gib */ | 42 | |
43 | info.totalram/=info.mem_unit; | 43 | /* TODO: Make all this stuff not overflow when mem >= 4 Gib */ |
44 | info.freeram/=info.mem_unit; | 44 | info.totalram/=info.mem_unit; |
45 | info.totalswap/=info.mem_unit; | 45 | info.freeram/=info.mem_unit; |
46 | info.freeswap/=info.mem_unit; | 46 | #ifndef __uClinux__ |
47 | info.sharedram/=info.mem_unit; | 47 | info.totalswap/=info.mem_unit; |
48 | info.bufferram/=info.mem_unit; | 48 | info.freeswap/=info.mem_unit; |
49 | #endif | ||
50 | info.sharedram/=info.mem_unit; | ||
51 | info.bufferram/=info.mem_unit; | ||
52 | } else { | ||
53 | info.mem_unit/=1024; | ||
54 | /* TODO: Make all this stuff not overflow when mem >= 4 Gib */ | ||
55 | info.totalram*=info.mem_unit; | ||
56 | info.freeram*=info.mem_unit; | ||
57 | #ifndef __uClinux__ | ||
58 | info.totalswap*=info.mem_unit; | ||
59 | info.freeswap*=info.mem_unit; | ||
60 | #endif | ||
61 | info.sharedram*=info.mem_unit; | ||
62 | info.bufferram*=info.mem_unit; | ||
63 | } | ||
49 | 64 | ||
50 | if (argc > 1 && **(argv + 1) == '-') | 65 | if (argc > 1 && **(argv + 1) == '-') |
51 | show_usage(); | 66 | show_usage(); |
@@ -57,13 +72,14 @@ extern int free_main(int argc, char **argv) | |||
57 | info.totalram-info.freeram, info.freeram, | 72 | info.totalram-info.freeram, info.freeram, |
58 | info.sharedram, info.bufferram); | 73 | info.sharedram, info.bufferram); |
59 | 74 | ||
75 | #ifndef __uClinux__ | ||
60 | printf("%6s%13ld%13ld%13ld\n", "Swap:", info.totalswap, | 76 | printf("%6s%13ld%13ld%13ld\n", "Swap:", info.totalswap, |
61 | info.totalswap-info.freeswap, info.freeswap); | 77 | info.totalswap-info.freeswap, info.freeswap); |
62 | 78 | ||
63 | printf("%6s%13ld%13ld%13ld\n", "Total:", info.totalram+info.totalswap, | 79 | printf("%6s%13ld%13ld%13ld\n", "Total:", info.totalram+info.totalswap, |
64 | (info.totalram-info.freeram)+(info.totalswap-info.freeswap), | 80 | (info.totalram-info.freeram)+(info.totalswap-info.freeswap), |
65 | info.freeram+info.freeswap); | 81 | info.freeram+info.freeswap); |
82 | #endif | ||
66 | return EXIT_SUCCESS; | 83 | return EXIT_SUCCESS; |
67 | } | 84 | } |
68 | 85 | ||
69 | |||