OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / linux-man9 / original / man9 / printk.9
1 .\" -*- nroff -*-
2 .TH printk 9 "$Date:$" "Linux DDI" "Kernel Functions"
3 .SH NAME
4 printk \- print messages to console log
5 .SH SYNOPSIS
6 .B #include <linux/kernel.h>
7 .sp
8 .BI "int printk(const char*" fmt ", ...)"
9 .SH DESCRIPTION
10 Print a formatted message to the kernel console, much like the
11 .B printf
12 function of the stdio library. Normally, the message is written to the
13 physical console device of the computer, although this behavior can be
14 changed with the
15 .B register_console
16 function. Messages are also stored in a message log book.
17 .PP
18 The generated string may also start with a message priority code,
19 which sets the priority of the message. The priority code strings are
20 of the form
21 .I "<n>"
22 where n is a number from 0 - 7. The following macros are defined in
23 the
24 .I "<linux/kernel.h>"
25 header file:
26 .RS
27 .TP
28 KERN_EMERG
29 System is unuseable
30 .TP
31 KERN_ALERT
32 Action must be taken immediately
33 .TP
34 KERN_CRIT
35 Critical conditions
36 .TP
37 KERN_ERR
38 Error conditions
39 .TP
40 KERN_WARNING
41 Warning conditions
42 .TP
43 KERN_NOTICE
44 Normal but significant condition
45 .TP
46 KERN_INFO
47 Informational
48 .TP
49 KERN_DEBUG
50 Debug-level messages
51 .RE
52
53 For example
54 .nf
55
56         printk(KERN_NOTICE "Hello, world.\\n");
57
58 .fi
59 does the expected thing.
60 .SH "RETURN VALUE"
61 Returns the number of characters written to the log.
62 .SH AVAILABILITY
63 Linux 1.0+
64 .SH "SEE ALSO"
65 .BR register_console "(9), " syslog "(2)"
66 .PP
67 .IR "kernel/printk.c"
68 .SH AUTHOR
69 Stephen Williams (steve@icarus.com)
70 .SH BUGS
71 float and double formats are not supported. Floats and doubles do not
72 belong inside the kernel anyhow.
73 .PP
74 The
75 .B printk
76 implementation protects itself from interruption, so in principle it
77 can be used in interrupts handlers and critical sections. However,
78 there are no guarantees about the console function that is registered.