1 .\" $NetBSD: kprintf.9,v 1.27 2009/04/08 12:46:04 joerg Exp $
3 .\" Copyright (c) 1998, 2002, 2007 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jeremy Cooper and by Jason R. Thorpe.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
42 .Nd kernel formatted output conversion
46 .Fn "printf" "const char *format" "..."
48 .Fn "printf_nolog" "const char *format" "..."
50 .Fn "snprintf" "char *buf" "size_t size" "const char *format" "..."
53 .Fn "vprintf" "const char *format" "va_list ap"
55 .Fn "vsnprintf" "char *buf" "size_t size" "const char *format" "va_list ap"
57 .Fn "uprintf" "const char *format" "..."
59 .Fn "ttyprintf" "struct tty *tty" "const char *format" "..."
62 .Fn "tprintf_open" "struct proc *p"
64 .Fn "tprintf" "tpr_t tpr" "const char *format" "..."
66 .Fn "tprintf_close" "tpr_t tpr"
68 .Fn "aprint_normal" "const char *format" "..."
70 .Fn "aprint_naive" "const char *format" "..."
72 .Fn "aprint_verbose" "const char *format" "..."
74 .Fn "aprint_debug" "const char *format" "..."
76 .Fn "aprint_error" "const char *format" "..."
78 .Fn "aprint_normal_dev" "device_t" "const char *format" "..."
80 .Fn "aprint_naive_dev" "device_t" "const char *format" "..."
82 .Fn "aprint_verbose_dev" "device_t" "const char *format" "..."
84 .Fn "aprint_debug_dev" "device_t" "const char *format" "..."
86 .Fn "aprint_error_dev" "device_t" "const char *format" "..."
88 .Fn "aprint_normal_ifnet" "struct ifnet *" "const char *format" "..."
90 .Fn "aprint_naive_ifnet" "struct ifnet *" "const char *format" "..."
92 .Fn "aprint_verbose_ifnet" "struct ifnet *" "const char *format" "..."
94 .Fn "aprint_debug_ifnet" "struct ifnet *" "const char *format" "..."
96 .Fn "aprint_error_ifnet" "struct ifnet *" "const char *format" "..."
98 .Fn "aprint_get_error_count" "void"
102 family of functions allows the kernel to send formatted messages to various
108 send formatted strings to the system console.
111 function is identical to
113 except it does not send the data to the system log.
118 write output to a string buffer.
119 These four functions work similarly to their user space counterparts,
120 and are not described in detail here.
126 send formatted strings to the current process's controlling tty and a specific
131 function sends formatted strings to a process's controlling tty,
132 via a handle of type tpr_t.
133 This allows multiple write operations to the tty with a guarantee that the
134 tty will be valid across calls.
135 A handle is acquired by calling
137 with the target process as an argument.
138 This handle must be closed with a matching call to
148 are intended to be used to print
151 Their verbosity depends on flags set in the
153 variable, through options passed during bootstrap; see
159 .Bl -tag -width AB_VERBOSE
161 silent mode, enabled by
165 quiet mode, enabled by
169 verbose mode, enabled by
173 debug mode, enabled by
180 functions have the following behaviour, based on the above
182 .Bl -tag -width Xaprint_verboseXXX
184 Sends to the console unless
187 Always sends to the log.
189 Sends to the console only if
192 Never sends to the log.
193 .It Fn aprint_verbose
194 Sends to the console only if
197 Always sends to the log.
199 Sends to the console and the log only if
205 but also keeps track of the number of times called.
206 This allows a subsystem to report the number of errors that occurred
207 during a quiet or silent initialization phase.
212 functions there are two additional families of functions with the
217 which work like their counterparts without the suffixes, except that
222 respectively as first argument and prefix the log message with the
223 corresponding device or interface name.
226 .Fn aprint_get_error_count
227 function reports the number of errors and resets the counter to 0.
231 is set, none of the autoconfiguration message printing routines send output
244 functions return the number of characters placed in the buffer
246 This is different to the user-space functions of the same name.
252 if no terminal handle could be acquired.
261 .Pa sys/kern/subr_prf.c
267 unsized string formatting functions are supported for compatibility only,
268 and are not documented here.
269 New code should use the size-limited
279 supported more format strings than the user space
281 These nonstandard format strings are no longer supported.
282 For the functionality provided by the former
293 functions first appeared in
300 functions should be used sparingly, if at all.
301 Where multiple lines of output are required to reach a process's
302 controlling terminal,