If passed the -d flag, mount devfs on /dev

This commit is contained in:
Poul-Henning Kamp 1996-10-28 11:03:19 +00:00
parent a07ca43c89
commit 57622f2291
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19227

View File

@ -45,6 +45,7 @@ static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93";
#endif /* not lint */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -121,6 +122,8 @@ enum { AUTOBOOT, FASTBOOT } runcom_mode = AUTOBOOT;
int Reboot = FALSE; int Reboot = FALSE;
int devfs;
void transition __P((state_t)); void transition __P((state_t));
state_t requested_transition = runcom; state_t requested_transition = runcom;
@ -216,8 +219,11 @@ main(argc, argv)
* This code assumes that we always get arguments through flags, * This code assumes that we always get arguments through flags,
* never through bits set in some random machine register. * 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) { switch (c) {
case 'd':
devfs = 1;
break;
case 's': case 's':
requested_transition = single_user; requested_transition = single_user;
break; break;
@ -232,6 +238,11 @@ main(argc, argv)
if (optind != argc) if (optind != argc)
warning("ignoring excess arguments"); 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, * We catch or block signals rather than ignore them,
* so that they get reset on exec. * so that they get reset on exec.