AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
printk.h
Go to the documentation of this file.
1
#ifndef _PRINTK_H
2
#define _PRINTK_H
3
4
#include <
stdarg.h
>
5
6
/* The kernel's messages (core/printk.c). */
7
8
/* The levels of a subsystem's log messages (LOGGER_DEFINE()), the most
9
* important first: a message is printed if its level is at most the
10
* subsystem's. */
11
#define LOG_NONE 0
12
#define LOG_EMERG 1
13
#define LOG_ALERT 2
14
#define LOG_CRIT 3
15
#define LOG_ERR 4
16
#define LOG_WARNING 5
17
#define LOG_NOTICE 6
18
#define LOG_INFO 7
19
#define LOG_DEBUG 8
20
21
/* Writes a kernel message. */
22
int
vprintk
(
const
char
*fmt,
va_list
args);
23
int
printk
(
const
char
*fmt, ...);
24
25
/* Defines `name(level, fmt, ...)`, a logging function for a subsystem
26
* that prints the messages of `level` up to `_level`, prefixed with the
27
* subsystem's name. */
28
#define LOGGER_DEFINE(module, name, _level) \
29
int name(int level, const char *fmt, ...) \
30
{ \
31
if (level <= _level) { \
32
va_list args; \
33
va_start(args, fmt); \
34
printk("%s: ", #module); \
35
vprintk(fmt, args); \
36
va_end(args); \
37
} \
38
return 0; \
39
}
40
41
/* Declares a logging function that LOGGER_DEFINE() defines elsewhere. */
42
#define LOGGER_DECLARE(name) \
43
int name(int level, const char *fmt, ...);
44
45
#endif
/* ! _PRINTK_H */
printk
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
Definition
printk.c:249
vprintk
int vprintk(const char *fmt, va_list args)
Writes a kernel message, with its arguments in a va_list.
Definition
printk.c:164
stdarg.h
va_list
#define va_list
Definition
stdarg.h:6
kernel
include
core
printk.h
Generated by
1.18.0