Thread (6 messages) 6 messages, 3 authors, 2012-04-27

stdout to console

From: j.neuschaefer@gmx.net (Jonathan Neuschäfer)
Date: 2012-04-23 12:09:06

On Mon, Apr 23, 2012 at 03:45:00PM +0530, Arun KS wrote:
Hello Guys,

We all know that when an application writes to stdout, data ends up in
the console.

Okey so if I m on my development board and if I run an app, all the
prints comes to the console (eg /dev/ttyS0).
If I m on any server using ssh and all apps prints comes on my putty
(eg through /dev/pts/176).

Where is the code which maps fd 1 to the console in kernel?
If you guys have any pointers, please share.

While opening a device (for eg /dev/something), the vfs calls that
drivers, whose major and minor number matches.
But in case of stdout, how vfs resolves the write to the fd 1 and send
it to the corresponding console driver?

Thanks,
Arun
It's in init/main.c, around line 823.

"strace" is a useful tool for trying to figure out what exactly a user
space process does.

The man pages of various system calls (open, fork, exec, dup, etc.) may
also provide valuable information.


Thanks,
	Jonathan Neusch?fer
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help