Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!mike From: mike@whuxl.UUCP (BALDWIN) Newsgroups: net.unix-wizards Subject: Re: Being `well and truly up the creek' Message-ID: <820@whuxl.UUCP> Date: Thu, 14-Nov-85 20:15:28 EST Article-I.D.: whuxl.820 Posted: Thu Nov 14 20:15:28 1985 Date-Received: Sat, 16-Nov-85 01:31:33 EST References: <2968@sun.uucp> <2200@umcp-cs.UUCP> Distribution: net Organization: AT&T Bell Laboratories, Whippany Lines: 26 > + /* > + * 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