Re: Fork and Exec a process within the kernel

From: Erik Mouw
Date: Wed Aug 11 2004 - 04:52:48 EST


On Tue, Aug 10, 2004 at 03:03:08PM -0400, Richard B. Johnson wrote:
> /dev/console is a symlink to /dev/tty0.

Please don't mislead newbies, Richard. /dev/console is NOT a link to
/dev/tty0, it's a completely different device:

erik@abra2:~ >ls -l /dev/console
crw------- 1 root tty 5, 1 Apr 7 09:13 /dev/console
erik@abra2:~ >ls -l /dev/tty0
crw------- 1 root tty 4, 0 Feb 10 2000 /dev/tty0

On x86 desktop systems console output usually comes on the virtual
terminals, but you can also use serial console. My embedded StrongARM
board only has serial console.

> struct termios term;
>
> tcgetattr(0, &term); // Get old terminal characteristics
> (void)close(0); // Close old terminal(s)
> (void)close(1);
> (void)close(2);
> fd = open("/dev/console", O_RDWR);

And what happens when you have console on a device that's not a serial
port like a line printer?


Erik

--
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/