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.
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.