'\" t .\" Title: printk .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Driver Basics .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "PRINTK" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Driver Basics" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" printk \- print a kernel message .SH "SYNOPSIS" .HP \w'__visible\ int\ printk('u .BI "__visible int printk(const\ char\ *\ " "fmt" ", " "\&.\&.\&." ");" .SH "ARGUMENTS" .PP \fIfmt\fR .RS 4 format string .RE .PP \fI\&.\&.\&.\fR .RS 4 variable arguments .RE .SH "DESCRIPTION" .PP This is \fBprintk\fR\&. It can be called from any context\&. We want it to work\&. .PP We try to grab the console_lock\&. If we succeed, it\*(Aqs easy \- we log the output and call the console drivers\&. If we fail to get the semaphore, we place the output into the log buffer and return\&. The current holder of the console_sem will notice the new output in \fBconsole_unlock\fR; and will send it to the consoles before releasing the lock\&. .PP One effect of this deferred printing is that code which calls \fBprintk\fR and then changes console_loglevel may break\&. This is because console_loglevel is inspected when the actual printing occurs\&. .SH "SEE ALSO" .PP printf(3) .PP See the \fBvsnprintf\fR documentation for format string extensions over C99\&. .SH "COPYRIGHT" .br