9 |
|
|
10 |
/* getopt not needed */ |
/* getopt not needed */ |
11 |
|
|
12 |
#include "busybox.h" |
#include "libbb.h" |
13 |
|
|
14 |
|
int free_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
15 |
int free_main(int argc, char **argv) |
int free_main(int argc, char **argv) |
16 |
{ |
{ |
17 |
struct sysinfo info; |
struct sysinfo info; |
18 |
sysinfo(&info); |
sysinfo(&info); |
19 |
|
|
20 |
/* Kernels prior to 2.4.x will return info.mem_unit==0, so cope... */ |
/* Kernels prior to 2.4.x will return info.mem_unit==0, so cope... */ |
21 |
if (info.mem_unit==0) { |
if (info.mem_unit == 0) { |
22 |
info.mem_unit=1; |
info.mem_unit=1; |
23 |
} |
} |
24 |
if ( info.mem_unit == 1 ) { |
if (info.mem_unit == 1) { |
25 |
info.mem_unit=1024; |
info.mem_unit=1024; |
26 |
|
|
27 |
/* TODO: Make all this stuff not overflow when mem >= 4 Gib */ |
/* TODO: Make all this stuff not overflow when mem >= 4 Gib */ |
46 |
info.bufferram*=info.mem_unit; |
info.bufferram*=info.mem_unit; |
47 |
} |
} |
48 |
|
|
49 |
if (argc > 1 && **(argv + 1) == '-') |
if (argc > 1 && *argv[1] == '-') |
50 |
bb_show_usage(); |
bb_show_usage(); |
51 |
|
|
52 |
printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free", |
66 |
#endif |
#endif |
67 |
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
68 |
} |
} |
|
|
|