lkml.org 
[lkml]   [2004]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Fork and Exec a process within the kernel
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.108 / U:2.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site