Re: Fork and Exec a process within the kernel

From: Richard B. Johnson
Date: Wed Aug 11 2004 - 06:26:55 EST


On Wed, 11 Aug 2004, Erik Mouw wrote:

> 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
>

Bullshit. I know how to use `file`.

Script started on Wed Aug 11 07:21:39 2004
# file /dev/console
/dev/console: symbolic link to /dev/tty0
# exit
Script done on Wed Aug 11 07:21:51 2004


> 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.
>

Then that's your problem.


> > 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
>

It will still work but there is no input and it can't be turned
into a "controlling terminal".


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.


-
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/