|
AquilaOS documentation
How it works, and its code
|
printk(): the kernel's messages. More...
#include <core/system.h>#include <ds/queue.h>#include <sys/waitq.h>#include <core/string.h>#include <console/earlycon.h>#include <ds/ringbuf.h>Go to the source code of this file.
Macros | |
| #define | KMSG_SIZE 8192 |
Functions | |
| void | earlycon_disable () |
| Stops sending the kernel's messages to the early console, once a real console has taken over. | |
| void | printk_console (void(*write)(const char *s, size_t len)) |
| Registers the console that the kernel's messages are written to, besides the message buffer. | |
| static int | putc (char c) |
| Writes one character of a message. | |
| static int | puts (char *s) |
| Writes a string of a message ("(null)" for NULL). | |
| static int | putx (uint32_t val) |
| Writes a 32-bit number in hexadecimal, without leading zeros. | |
| static int | putlx (uint64_t val) |
| Writes a 64-bit number in hexadecimal, all 16 digits. | |
| static int | putud (uint32_t val) |
| Writes an unsigned 32-bit number in decimal. | |
| static int | putul (uint64_t val) |
| Writes an unsigned 64-bit number in decimal. | |
| static int | putb (uint8_t val) |
| Writes a byte in binary, all 8 digits. | |
| int | vprintk (const char *fmt, va_list args) |
| Writes a kernel message, with its arguments in a va_list. | |
| int | printk (const char *fmt,...) |
| Writes a kernel message, to the message buffer and the consoles. | |
Variables | |
| struct ringbuf * | kmsg = RINGBUF_NEW(KMSG_SIZE) |
| struct waitq * | kmsg_wait = &(struct waitq){0} |
| static int | use_earlycon = 1 |
| static void(*) | console_write (const char *s, size_t len) |
printk(): the kernel's messages.
A message goes to three places: the kernel's message buffer (kmsg, which /dev/kmsg reads, the oldest messages overwritten when it's full), the console if one has registered (printk_console()), and the early console until it's disabled. printk() understands a small set of formats: c, s, d and u (32-bit), ld and lu (64-bit), x and lx (hexadecimal), b (binary) and p. The l formats take a 64-bit argument on every architecture: cast a long to int64_t or uint64_t.
Definition in file printk.c.
| void earlycon_disable | ( | void | ) |
Stops sending the kernel's messages to the early console, once a real console has taken over.
Definition at line 34 of file printk.c.
References earlycon_disable(), and use_earlycon.
Referenced by earlycon_disable(), kmain(), and vt_probe().
| int printk | ( | const char * | fmt, |
| ... ) |
Writes a kernel message, to the message buffer and the consoles.
| fmt | the format (see the top of this file for what it supports) |
Definition at line 249 of file printk.c.
References printk(), va_end, va_list, va_start, and vprintk().
Referenced by aarch64_bad(), aarch64_init(), abort(), acpi_tables(), apic_route(), arch_stack_trace(), ata_detect_drive(), ata_poll(), ata_probe(), buddy_set_unusable(), buddy_setup(), cpio_load(), dma_transfer(), dump(), e1000_probe(), enqueue(), ext2_load(), fbdev_vesa_prope(), fdt_boot(), i8042_init(), initramfs_archiver_register(), isr_dispatch(), kargs_parse(), kdev_blkdev_register(), kdev_chrdev_register(), kdev_init(), kernel_ctrlaltdel(), kernel_reboot(), kfree(), kmain(), kmsgdev_write(), kvmem_guardtest(), kvmem_selftest(), load_ramdisk(), mm_page_fault(), mm_setup(), modules_init(), netif_config(), netif_register(), pci_assign(), pci_host_set(), pio_read_sectors(), platform_init(), pmap_init(), printk(), proc_kill(), scan_device(), sync_dispatch(), syscall_dispatch(), time_resync(), timer_setup(), uart_8250_attach(), uart_register(), vfs_mount_root_dev(), vm_object_page(), vnode_pages_update(), vt_probe(), x86_acpi_poweroff(), x86_apic_setup(), x86_clock_init(), x86_clock_ticks(), x86_cmos_setup(), x86_cpu_init(), x86_dump_registers(), x86_hpet_init(), x86_lapic_timer_setup(), x86_pc_irq_init(), x86_pic_setup(), x86_pit_delay(), x86_pit_period_set(), x86_pit_setup(), and x86_smp_init().
| void printk_console | ( | void(* | write )(const char *s, size_t len) | ) |
Registers the console that the kernel's messages are written to, besides the message buffer.
| write | the console's write function |
Definition at line 47 of file printk.c.
References console_write, and printk_console().
Referenced by printk_console(), and vt_probe().
|
static |
|
static |
Writes one character of a message.
Returns what the early console's write returned, or 0.
Definition at line 54 of file printk.c.
References console_write, earlycon_putc(), kmsg, putc(), and use_earlycon.
|
static |
|
static |
Writes a string of a message ("(null)" for NULL).
Definition at line 67 of file printk.c.
References console_write, earlycon_puts(), kmsg, puts(), and use_earlycon.
Referenced by putb(), putlx(), puts(), putud(), putul(), putx(), and vprintk().
|
static |
|
static |
|
static |
| int vprintk | ( | const char * | fmt, |
| va_list | args ) |
Writes a kernel message, with its arguments in a va_list.
| fmt | the format (see the top of this file for what it supports) |
| args | the arguments |
Definition at line 164 of file printk.c.
References putb(), putc(), putlx(), puts(), putud(), putul(), putx(), va_arg, va_list, and vprintk().
Definition at line 39 of file printk.c.
Referenced by printk_console(), putc(), and puts().
| struct ringbuf* kmsg = RINGBUF_NEW(KMSG_SIZE) |
Definition at line 25 of file printk.c.
Referenced by kmsgdev_read(), putc(), puts(), and vt_kmsg_replay().
Definition at line 26 of file printk.c.
Referenced by kmsg_file_open().
|
static |
Definition at line 28 of file printk.c.
Referenced by earlycon_disable(), putc(), and puts().