Re: Fork and Exec a process within the kernel

From: Richard B. Johnson
Date: Tue Aug 10 2004 - 14:12:00 EST


On Tue, 10 Aug 2004, Paul Jackson wrote:

> > My user mode program is running.
>
> Good.
>
> > Any idea how to control which console it shows up on?
>
> No clue.
>
> --


/dev/console is a symlink to /dev/tty0.

Alt-F1 = /dev/tty0
Alt-F2 = /dev/tty1
Alt-F3 = /dev/tty2

... etc.

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);
tcsetattr(fd, &term); // Restore characteristics
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);

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/