[BusyBox] init: sysinfo [PATCH]
Shaun Jackman
sjackman at gmail.com
Tue Jul 5 22:26:46 MDT 2005
On 7/5/05, Mike Frysinger <vapier at gentoo.org> wrote:
> On Tuesday 05 July 2005 06:17 pm, Jason Schoon wrote:
> > Given that it's difficult to determine who is or isn't using a feature,
> > perhaps for now we could settle for a config option, defaulted to on, such
> > as ENABLE_INIT_SWAPON. That would allow people like me to turn it off to
> > save space, without breaking others.
>
> good enough for me ... ive never hacked on init before so could someone post a
> patch for this ?
As discussed above.
Cheers,
Shaun
2005-07-05 Shaun Jackman <sjackman at 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.
--- init/Config.in
+++ init/Config.in
@@ -35,6 +35,14 @@
core file sizes. If this option is disabled, processes
will not generate any core files.
+config CONFIG_FEATURE_INIT_SWAPON
+ bool " Should init run swapon if short on memory?"
+ default y
+ depends on CONFIG_INIT
+ help
+ If the system has less than one megabyte of total memory, init
+ will call /sbin/swapon -a to add swap memory.
+
config CONFIG_FEATURE_EXTRA_QUIET
bool " Should init be _extra_ quiet on boot?"
default y
--- init/init.c
+++ init/init.c
@@ -308,6 +308,7 @@
tcsetattr(fd, TCSANOW, &tty);
}
+#ifdef CONFIG_FEATURE_INIT_SWAPON
/* How much memory does this machine have?
Units are kBytes to avoid overflow on 4GB machines */
static unsigned int check_free_memory(void)
@@ -336,6 +337,7 @@
return(result * u);
}
}
+#endif /* CONFIG_FEATURE_INIT_SWAPON */
static void console_init(void)
{
@@ -910,6 +912,7 @@
}
}
+#ifdef CONFIG_FEATURE_INIT_SWAPON
/* Make sure there is enough memory to do something useful. *
* Calls "swapon -a" if needed so be sure /etc/fstab is present... */
static void check_memory(void)
@@ -937,6 +940,9 @@
message(CONSOLE, "Sorry, your computer does not have enough memory.");
loop_forever();
}
+#else
+# define check_memory()
+#endif /* CONFIG_FEATURE_INIT_SWAPON */
/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
* then parse_inittab() simply adds in some default
More information about the busybox
mailing list