From 57622f22919dd4d859a8432763dd98128239fd86 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 28 Oct 1996 11:03:19 +0000 Subject: [PATCH] If passed the -d flag, mount devfs on /dev --- sbin/init/init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 6ea623324e88..7e735581db53 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -45,6 +45,7 @@ static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93"; #endif /* not lint */ #include +#include #include #include @@ -121,6 +122,8 @@ enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT; int Reboot = FALSE; +int devfs; + void transition __P((state_t)); state_t requested_transition = runcom; @@ -216,8 +219,11 @@ main(argc, argv) * This code assumes that we always get arguments through flags, * never through bits set in some random machine register. */ - while ((c = getopt(argc, argv, "sf")) != -1) + while ((c = getopt(argc, argv, "dsf")) != -1) switch (c) { + case 'd': + devfs = 1; + break; case 's': requested_transition = single_user; break; @@ -232,6 +238,11 @@ main(argc, argv) if (optind != argc) warning("ignoring excess arguments"); + /* Mount devfs on /dev */ + if (devfs) { + mount(MOUNT_DEVFS, "/dev", MNT_NOEXEC|MNT_RDONLY, 0); + } + /* * We catch or block signals rather than ignore them, * so that they get reset on exec.