print(9)
π print(9) π
okay so this is a page from the Kernel API Manual, section 9, and it's literally just about print β yes that's the whole name, she's simple, she's iconic π
β¨ NAME β¨
print β a cute lil wrapper for dev_printk, seq_printf, etc. π«Ά The whole point? So you can use the same debug code for both debugfs and printk logging. one function, two destinations, no cap. no duplicating your logging code like a clown π€‘
πΈ DESCRIPTION πΈ
okay bestie, here's the vibe in code form β look at how log_some_info() gets reused with a different printer each time, and it does not care even a little bit:
void log_some_info(struct drm_printer *p)
{
drm_printf(p, "foo=d0, foo);
drm_printf(p, "bar=d0, bar);
}
#ifdef CONFIG_DEBUG_FS
void debugfs_show(struct seq_file *f)
{
struct drm_printer p = drm_seq_file_printer(f);
log_some_info(p);
}
#endif
void some_other_function(...)
{
struct drm_printer p = drm_info_printer(drm->dev);
log_some_info(p);
}
like β see what she did there?? log_some_info() takes a struct drm_printer *p, and every caller just hands her a different printer. same debug code, different output. that's the entire flex π₯
ngl, those drm_printf(p, "foo=d0, foo); lines are exactly how they appear in the original β quoting looks wonky, so don't come for me, I'm just the messenger π
π¦ SEE ALSO π¦
all the siblings and cousins, gathered for the family reunion π
- kernel file
./include/drm/drm_print.h enum drm_debug_category(9)struct drm_printer(9)drm_vprintf(9)drm_printf_indent(9)struct drm_print_iterator(9)drm_coredump_printer(9)drm_coredump_printer_is_full(9)drm_seq_file_printer(9)drm_info_printer(9)drm_dbg_printer(9)drm_err_printer(9)drm_line_printer(9)DRM_DEV_ERROR(9)DRM_DEV_ERROR_RATELIMITED(9)DRM_DEV_DEBUG(9)DRM_DEV_DEBUG_DRIVER(9)DRM_DEV_DEBUG_KMS(9)
aaaand that's the whole page, bestie π mwah π
π§ sign-off szn: this lil masterpiece lives under ./include/drm and it's dated October 2026. yes, the future. she's ahead of her time. periodt β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms