2005-07-05 Shaun Jackman <sjackman@gmail.com>
authorMike Frysinger <vapier@gentoo.org>
Wed, 6 Jul 2005 04:39:08 +0000 (04:39 -0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 6 Jul 2005 04:39:08 +0000 (04:39 -0000)
        * 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/init.c

index 4465e75a161c4d8999c95a9fb7af1165d93afba0..521f8fe1d4dcfd533702bff716199d63f94a8bcb 100644 (file)
@@ -35,6 +35,14 @@ config CONFIG_FEATURE_INIT_COREDUMPS
          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 run '/sbin/swapon -a' to add swap memory.
+
 config CONFIG_FEATURE_EXTRA_QUIET
        bool "  Should init be _extra_ quiet on boot?"
        default y
index e0e2f19fbc4d1af10c91e125fb0af361417228d4..5281225801b101def7c6586477634509c4d84abc 100644 (file)
@@ -309,6 +309,7 @@ static void set_term(int fd)
        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)
@@ -337,6 +338,7 @@ static unsigned int check_free_memory(void)
                return(result * u);
        }
 }
+#endif /* CONFIG_FEATURE_INIT_SWAPON */
 
 static void console_init(void)
 {
@@ -910,6 +912,7 @@ static void delete_init_action(struct init_action *action)
        }
 }
 
+#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 @@ static void check_memory(void)
        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