Being `well and truly up the creek'

BALDWIN mike at whuxl.UUCP
Fri Nov 15 11:15:28 AEST 1985


> + /*
> +  * Open the console, and if it fails make a last ditch attempt to
> +  * create a new one.  Assumes fd 0 is not currently open.
> +  */
> + get_console()
> + {
> + 
> + 	if (open(ctty, O_RDWR) == 0)
> + 		return;
> + 	(void) strcpy(ctty, "/#console");
> + 	(void) mknod(ctty, S_IFCHR|0644, 0);
> + 	(void) open(ctty, O_RDWR);
> + 	(void) write(0, "WARNING: /dev/console gone, made /#console\n", 43);
>   }
>   
> In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)

Er, um, what if your console isn't maj,min 0,0?  On my 7300, /dev/console
is 7,0 and the root file system is 0,0 -- writing WARNING over the boot
block would be, like, disastrous.  The only way to *know* what major dev
console is (minor 0 seems OK to assume) is to dig through cdevsw[] -- a
decicedly non-trivial task, and you don't even know that /unix is the
one you booted from anyway.  Oh well.
-- 
						Michael Baldwin
						{at&t}!whuxl!mike



More information about the Comp.unix.wizards mailing list