Re: Linux console interface



MQ wrote:




1. How is STDIN/STDOUT/STDERR opened? Is this done by getty, and then
all applications descended from getty just inherit this?

2. I know that keyboard input is obtained by reading STDIN and screen
output is acheived by writing to STDOUT. How do you send the console
configuration options. You can do this via the termios functions of
the C library, but does the C library acheive this using ioctls? I
think it does, but I thought console ioctls may change between kernel
versions. Should I just support the latest kernel version and risk old
applications breaking if they do ioctls directly (that is not through
termios)?

3. What C module is the top-level terminal driver in the Linux kernel.
That is, the one that is attached to major char device 4? Also, what
is the association between the terminal driver and /dev/console. They
seem to be two separate devices (/dev/console is on major number 5)



Is any one able to answer my questions?

MQ

Try thinking of it this way; STDIN/STDOUT/STDERR are all a gift to the
developer from the OS/API/ABI, they are opened for him before the program
starts and are closed automatically upon program exit. It is a very useful
part of OS support for IO redirection. Lots of terminals connected to the
computer was very much part of the computing environment when it was
developed. ncurses, termcap, and termio were all part of the original
multiple users per CPU model for unix.

--
JosephKK
Gegen dummheit kampfen die Gotter Selbst, vergebens.  
--Schiller
.



Relevant Pages

  • Re: Linux console interface
    ... Is this done by getty, ... but does the C library acheive this using ioctls? ... Should I just support the latest kernel version and risk old ... the one that is attached to major char device 4? ...
    (comp.os.linux.development.system)
  • Re: FreeBSD 7.0 BETA4 no serial console
    ... getty was running with 3wire.9600. ... Rebuilding kernel + world fixed ... Nope, my installation was built from source via "make buildworld TARGET_ARCH=amd64", afterwards pxebooted the box and copied my nfsroot to hard disk and then booted of hard disk. ... I cvsup today to RELENG_7 and give make buildworld another go. ...
    (freebsd-stable)
  • Re: uart(4) not working in QEMU
    ... Whilst I updated my kernel configs to reflect this, ... of problems with I/O and QEMU -- in particular, ... a getty there, I can get in, and see that the getty for ttyu0 is ... I dunno if INVARIANTS changes the behaviour of the uart driver (my guess ...
    (freebsd-current)
  • uart(4) not working in QEMU
    ... Whilst I updated my kernel configs to reflect this, I've noticed a lot of problems with I/O and QEMU -- in particular, the kernel will log messages over uartjust fine, but when the kernel runs init, I can't get any I/O out of the uartat all, apart from a single 'c' or 'F' character. ... The kernel continues to log messages OK to the uart0/ttyu0 device regardless of what's going on in userland. ... If I configure ttyv0 in the QEMU virtual machine up via /etc/ttys to run a getty there, I can get in, and see that the getty for ttyu0 is running. ...
    (freebsd-current)