The ubiquitous kernel printk
There's a good reason the famous and familiar Kernighan and Ritchie (K&R) Hello, world C program employs the printf()
API: it's the preferred API via which any output is written to the screen (well, technically, to the standard output channel stdout of the calling process). After all, it's how we can actually see that our program is really doing something, right?
You will surely recall using this API when writing your very first C program. Did you write the code that incorporates the printf()
function? No, of course not; then where is it? You know: it's part of the (typically rather large) standard C library – GNU libc (glibc) on Linux. Pretty much every binary executable program on a Linux box automatically and dynamically links into this library; thus printf()
is pretty much always available! (On x86, doing ldd $(which ps)
will have the useful ldd
script show you the libraries that the ps
app links into; one of them will...