Relation between user space printing, console and tty?

Printf() writes to stdout which is a FILE that wraps file descriptor 1. File descriptors are either inherited from parent or opened explicitely. If you follow the process hierarchy upwards in a typical system you'll finally arrive at a login process, which is usually spawned by a getty process.

A getty process connects to a terminal with the appropriate settings (line speed, parity, ... on serial lines), and usually spawns login on first key / ENTER key. Gettys are usually launched directly from etc/inittab on traditional init systems.

Up vote 0 down vote favorite share g+ share fb share tw.

I have already posted a question to do printing from user space on a kind of unconventional serial port. Linux non-standard serial console However, I realized that I am a bit confused over the architecture of user space printing. Where does user space printf send its data?

I see stdout/stdin are symbolically linked to one of the tty/pty? But who sets up this link? How does a tty connect to available consoles?

Or let us say: how tty core interfaces with console? Linux linux-kernel device-driver linux-device-driver link|improve this question edited Feb 14 at 21:33 asked Feb 14 at 18:52agent. Smith25918 66% accept rate.

Printf() writes to stdout, which is a FILE * that wraps file descriptor 1. File descriptors are either inherited from parent or opened explicitely. If you follow the process hierarchy upwards in a typical system you'll finally arrive at a login process, which is usually spawned by a *getty process.

A getty process connects to a terminal with the appropriate settings (line speed, parity, ... on serial lines), and usually spawns login on first key / ENTER key. Gettys are usually launched directly from /etc/inittab on traditional init systems.

Printf uses inside itself system call write() and writes to file descriptor 1, which is associated with tty device file. The link you say about is being set by kernel.

Rite. However, I wanna find out which tty it is? How does kernel decide which tty to use?

Is it a configurable option. Can I find out before I compile the kernel. – agent.

Smith Feb 14 at 21:42 Unfortunately I do not know kernel internals good enough to answer your question. Look through special kernel literature – mikithskegg Feb 14 at 21:53.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions