Kernel logging module. More...
Go to the source code of this file.
Data Structures | |
struct | record_t |
A log record represents a single logged event. More... | |
struct | callback_t |
Used for registering logging callback functions. More... | |
struct | context |
The log context describes the state of the log buffers. More... | |
Macros | |
#define | RBUFSHIFT 10 |
#define | RBUFSIZE (1 << RBUFSHIFT) |
#define | RBUFMASK (RBUFSIZE - 1) |
#define | MBUFSHIFT 16 |
#define | MBUFSIZE (1 << MBUFSHIFT) |
#define | MBUFMASK (MBUFSIZE - 1) |
#define | MAX_CALLBACKS 8 |
Functions | |
static void | evict_record () |
static void | evict_msg (int chars) |
static void | evict_oldest_msg () |
static int | add_msg (const char *str) |
static void | add_record (int offset, loglevel_t level, const char *str) |
void | log_addcallback (loglevel_t maxlevel, log_callback cb) |
Add a callback handler for log messages. More... | |
void | log_removecallback (log_callback cb) |
Remove a callback handler for log messages. More... | |
void | log (loglevel_t level, const char *str) |
Log a message to the kernel log buffer. More... | |
void | logf (loglevel_t level, const char *format,...) |
Log a printf-formatted message to the kernel log buffer. More... | |
void | logvf (loglevel_t level, const char *format, va_list args) |
Log a printf-formatted string using a variable argument list. More... | |
Variables | |
static struct context | lc |
Kernel logging module.
Definition in file log.c.
struct record_t |
Data Fields | ||
---|---|---|
loglevel_t | level | |
int | moffset | Offset of message in context::mbuf. |
struct callback_t |
Data Fields | ||
---|---|---|
loglevel_t | maxlevel | |
log_callback | cb |
struct context |
The log context describes the state of the log buffers.
There are two buffers: the record buffer and the message buffer. The record buffer is a circular queue that contains records describing the most recent 1024 log messages. The message buffer contains the text messages associated with each of the records in the log buffer.
Data Fields | ||
---|---|---|
record_t | rbuf[RBUFSIZE] | Circular record buffer. |
int | rhead | index of oldest record in rbuf |
int | rtail | rbuf index of next record to write |
int | rbufsz | number of records in rbuf |
char | mbuf[MBUFSIZE] | Circular message text buffer. |
int | mhead | index of oldest char in mbuf |
int | mtail | mbuf index of next char to write |
int | mbufsz | the number of characters in mbuf |
callback_t | callbacks[MAX_CALLBACKS] | |
int | callbacks_size | number of registrations |
#define RBUFSIZE (1 << RBUFSHIFT) |
Definition at line 16 of file log.c.
Referenced by add_record().
#define RBUFMASK (RBUFSIZE - 1) |
Definition at line 17 of file log.c.
Referenced by add_record(), and evict_record().
#define MBUFMASK (MBUFSIZE - 1) |
Definition at line 22 of file log.c.
Referenced by evict_msg(), and evict_oldest_msg().
#define MAX_CALLBACKS 8 |
Definition at line 25 of file log.c.
Referenced by log_addcallback().
|
static |
Definition at line 68 of file log.c.
Referenced by add_record(), and evict_msg().
|
static |
|
static |
Definition at line 100 of file log.c.
Referenced by add_record().
|
static |
|
static |
void log_addcallback | ( | loglevel_t | maxlevel, |
log_callback | cb | ||
) |
void log_removecallback | ( | log_callback | cb | ) |
void log | ( | loglevel_t | level, |
const char * | str | ||
) |
void logf | ( | loglevel_t | level, |
const char * | format, | ||
... | |||
) |
Log a printf-formatted message to the kernel log buffer.
[in] | level | The importance level of the logged message. |
[in] | format | The null-terminated format string used to format the text to be printed. |
[in] | ... | Variable arguments list to be initialized with va_start. |
Definition at line 195 of file log.c.
Referenced by acpi_init(), read_rsdt(), and read_xsdt().
void logvf | ( | loglevel_t | level, |
const char * | format, | ||
va_list | args | ||
) |
Log a printf-formatted string using a variable argument list.
[in] | level | The importance level of the logged message. |
[in] | format | The null-terminated format string used to format the text to be printed. |
[in] | args | Variable arguments list to be initialized with va_start. |
Definition at line 204 of file log.c.
Referenced by logf().
|
static |
Definition at line 65 of file log.c.
Referenced by add_msg(), add_record(), evict_msg(), evict_oldest_msg(), evict_record(), log_addcallback(), and log_removecallback().