diff options
author | vapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-06 04:39:08 +0000 |
---|---|---|
committer | vapier <vapier@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-07-06 04:39:08 +0000 |
commit | 828afaad5661eec494d15ebe54dbb02f78d1e239 (patch) | |
tree | 5d071d726cff05f4201e6ced5b77ed6278e82c8c /init | |
parent | 8c1554a4253be66272bafad8859af703d5e32c7d (diff) | |
download | busybox-w32-828afaad5661eec494d15ebe54dbb02f78d1e239.tar.gz busybox-w32-828afaad5661eec494d15ebe54dbb02f78d1e239.tar.bz2 busybox-w32-828afaad5661eec494d15ebe54dbb02f78d1e239.zip |
2005-07-05 Shaun Jackman <sjackman@gmail.com>
* init/Config.in (CONFIG_FEATURE_INIT_SWAPON): New option.
* init/init.c (check_memory): Disable the swapon feature unless
CONFIG_FEATURE_INIT_SWAPON is defined.
git-svn-id: svn://busybox.net/trunk/busybox@10721 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'init')
-rw-r--r-- | init/Config.in | 8 | ||||
-rw-r--r-- | init/init.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/init/Config.in b/init/Config.in index 4465e75a1..521f8fe1d 100644 --- a/init/Config.in +++ b/init/Config.in | |||
@@ -35,6 +35,14 @@ config CONFIG_FEATURE_INIT_COREDUMPS | |||
35 | core file sizes. If this option is disabled, processes | 35 | core file sizes. If this option is disabled, processes |
36 | will not generate any core files. | 36 | will not generate any core files. |
37 | 37 | ||
38 | config CONFIG_FEATURE_INIT_SWAPON | ||
39 | bool " Should init run swapon if short on memory?" | ||
40 | default y | ||
41 | depends on CONFIG_INIT | ||
42 | help | ||
43 | If the system has less than one megabyte of total memory, init | ||
44 | will run '/sbin/swapon -a' to add swap memory. | ||
45 | |||
38 | config CONFIG_FEATURE_EXTRA_QUIET | 46 | config CONFIG_FEATURE_EXTRA_QUIET |
39 | bool " Should init be _extra_ quiet on boot?" | 47 | bool " Should init be _extra_ quiet on boot?" |
40 | default y | 48 | default y |
diff --git a/init/init.c b/init/init.c index e0e2f19fb..528122580 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -309,6 +309,7 @@ static void set_term(int fd) | |||
309 | tcsetattr(fd, TCSANOW, &tty); | 309 | tcsetattr(fd, TCSANOW, &tty); |
310 | } | 310 | } |
311 | 311 | ||
312 | #ifdef CONFIG_FEATURE_INIT_SWAPON | ||
312 | /* How much memory does this machine have? | 313 | /* How much memory does this machine have? |
313 | Units are kBytes to avoid overflow on 4GB machines */ | 314 | Units are kBytes to avoid overflow on 4GB machines */ |
314 | static unsigned int check_free_memory(void) | 315 | static unsigned int check_free_memory(void) |
@@ -337,6 +338,7 @@ static unsigned int check_free_memory(void) | |||
337 | return(result * u); | 338 | return(result * u); |
338 | } | 339 | } |
339 | } | 340 | } |
341 | #endif /* CONFIG_FEATURE_INIT_SWAPON */ | ||
340 | 342 | ||
341 | static void console_init(void) | 343 | static void console_init(void) |
342 | { | 344 | { |
@@ -910,6 +912,7 @@ static void delete_init_action(struct init_action *action) | |||
910 | } | 912 | } |
911 | } | 913 | } |
912 | 914 | ||
915 | #ifdef CONFIG_FEATURE_INIT_SWAPON | ||
913 | /* Make sure there is enough memory to do something useful. * | 916 | /* Make sure there is enough memory to do something useful. * |
914 | * Calls "swapon -a" if needed so be sure /etc/fstab is present... */ | 917 | * Calls "swapon -a" if needed so be sure /etc/fstab is present... */ |
915 | static void check_memory(void) | 918 | static void check_memory(void) |
@@ -937,6 +940,9 @@ static void check_memory(void) | |||
937 | message(CONSOLE, "Sorry, your computer does not have enough memory."); | 940 | message(CONSOLE, "Sorry, your computer does not have enough memory."); |
938 | loop_forever(); | 941 | loop_forever(); |
939 | } | 942 | } |
943 | #else | ||
944 | # define check_memory() | ||
945 | #endif /* CONFIG_FEATURE_INIT_SWAPON */ | ||
940 | 946 | ||
941 | /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, | 947 | /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, |
942 | * then parse_inittab() simply adds in some default | 948 | * then parse_inittab() simply adds in some default |