|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Go to the source code of this file.
Functions | |
| void | printk (const char *fmt,...) |
| Print kernel debugging message. | |
| void | vprintk (const char *fmt, va_list ap) |
| Print kernel debugging message, va_list version. | |
| void | printk_unlocked (const char *fmt,...) |
| Output a string without taking the printk lock. | |
| void | vprintk_unlocked (const char *fmt, va_list ap) |
| Output a string without any locking, va_list version. | |
| void | printk_panic (void) |
| Stop printk() taking its lock, for crash reporting. | |
| int | snprintk (char *str, size_t size, const char *fmt,...) |
| Print a kernel debugging message to a buffer. | |
| int | vsnprintk (char *str, size_t size, const char *fmt, va_list ap) |
| Print a kernel debugging message to a buffer, va_list version. | |
| void printk | ( | const char * | fmt, |
| ... ) |
Print kernel debugging message.
This routine prints a kernel debugging message to the system console. Output is send immediately, without any mutual exclusion or buffering.
A basic set of conversion specifier characters are supported:
Field width (with or without leading zeroes) is supported. Length attributes h, hh, l, ll and z are supported. However, integral values with lld and lli are only printed if they fit in a long otherwise 'ERR' is printed. Full 64-bit values may be printed with llx. Flags and precision attributes are not supported.
| fmt | Format string. |
| ... | Optional list of format arguments. |
| void printk_panic | ( | void | ) |
Stop printk() taking its lock, for crash reporting.
After this, printk() behaves as if every caller had used printk_unlocked(). Once a fatal error is being handled the lock cannot be trusted: the faulting context may have died holding it, or a CPU that will never run again may own it, and any later printk() would block for ever. Individual call sites cannot fix that, because code reached after the failure does not know it is in a crash.
Called by the fatal error path. One way, for the rest of the system's life.
| void printk_unlocked | ( | const char * | fmt, |
| ... ) |
Output a string without taking the printk lock.
Same output as printk(), but the spinlock is never taken and both the logging subsystem and the user mode buffer are bypassed: text goes straight to the platform's character output hook.
For callers that cannot take the lock: a crash whose lock holder is dead, output re-entered from inside printk() itself, or early boot before the atomics a spinlock needs are usable. Output may interleave with a concurrent printk(), which beats hanging or losing it.
| fmt | Format string. |
| ... | Optional list of format arguments. |
| int snprintk | ( | char * | str, |
| size_t | size, | ||
| const char * | fmt, | ||
| ... ) |
Print a kernel debugging message to a buffer.
Formats as printk() does, but writes to str instead of the console. The output is truncated if it does not fit, and is NUL terminated as long as size is not zero.
| str | Buffer to write to. |
| size | Size of the buffer, in bytes. |
| fmt | Format string. |
| ... | Optional list of format arguments. |
size or more means the output was truncated. | void vprintk | ( | const char * | fmt, |
| va_list | ap ) |
Print kernel debugging message, va_list version.
See printk() for the output format.
| fmt | Format string. |
| ap | Format arguments. |
| void vprintk_unlocked | ( | const char * | fmt, |
| va_list | ap ) |
Output a string without any locking, va_list version.
See printk_unlocked() for when this is appropriate and what it gives up.
| fmt | Format string. |
| ap | Format arguments. |
| int vsnprintk | ( | char * | str, |
| size_t | size, | ||
| const char * | fmt, | ||
| va_list | ap ) |
Print a kernel debugging message to a buffer, va_list version.
See snprintk() for the formatting and the buffer handling.
| str | Buffer to write to. |
| size | Size of the buffer, in bytes. |
| fmt | Format string. |
| ap | Format arguments. |