Re: Location of shmfs; devfs automagics

From: wingel@t1.ctrl-c.liu.se
Date: Mon Apr 03 2000 - 19:00:59 EST


In article <E12Zzud-0000bC-00@the-village.bc.nu> you write:
>/dev/console can point to any console device of the users choosing (and
>in some cases points to serial ports and stuff so that an init=/bin/sh
>lets them recover from failed upgrades and stuff)

One thing I would like though is to open /dev/null [1] without going
through /dev:

        if (open("/dev/console", O_RDWR, 0) < 0) {
                printk("Warning: unable to open an initial console.\n");
                opennull(); /* opens /dev/null as fd 0 */
        }

The reason for this is to have _something_ on fd 0,1,2 when starting
init even if the kernel was unable to open an initial console, since
a lot of applications break otherwise, they don't expect

    fprintf(stderr, "Hello World\n")
    
to write data to the file they just opened.

  /Christer

[1] Actually /dev/null might be a bad choice since I've seen
    applications that go berzerk when select() always returns
    immediately but the application doesn't know how to cope
    with EOF on standard input. A device that just does nothing
    (don't produce any data, just throw away any data that it
    gets and never return EOF) might be better.

-- 
"Just how much can I get away with and still go to heaven?"

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:11 EST