printk_parse_prefix(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– printk_parse_prefix(9) β€” a Kernel API Manual moment πŸ’–

okay so bestie, we're in the Kernel API Manual today and the star of the show is printk_parse_prefix(9). she's a little parser, she's got main character energy, and honestly? she ate.


✨ NAME ✨

printk_parse_prefix β€” parse the level and the control flags. that's it, that's the whole job. πŸ’…


✨ SYNOPSIS ✨

u16 printk_parse_prefix (const char *text , int *level , enum
printk_info_flags *flags );

like, look at her signature. so clean. πŸŽ€


✨ ARGUMENTS ✨

  • text β€” the terminated text message. yes, terminated, as in null-terminated, please don't send her a rogue unterminated string, that's not the vibe πŸ™ˆ
  • level β€” a pointer to the current level value, and she will be updating it. coming for that variable, respectfully. πŸ”₯
  • flags β€” a pointer to the current printk_info flags, and same deal, she's updating it too. ✨

✨ DESCRIPTION ✨

okay so the rules of engagement, listen up 🫢

level may be NULL if the caller is genuinely not interested in the parsed value β€” no hard feelings, she gets it. Otherwise? the variable pointed to by level must be set to LOGLEVEL_DEFAULT in order to be updated with the parsed value. like, that's the entry fee. no LOGLEVEL_DEFAULT, no update. periodt. πŸ’€

flags may also be NULL if you're not interested in the parsed value β€” also fine, also valid. Otherwise, the variable pointed to by flags will be OR'd with the parsed value. not overwritten, not replaced β€” OR'd. lowkey important distinction, iykyk. 🌸


✨ RETURN ✨

she returns the length of the parsed level and control flags. the way that's literally the whole return value. iconic. πŸ‘‘


✨ SEE ALSO ✨

so. many. friends. she runs with a whole crowd πŸ¦‹ β€” the kernel file ./kernel/printk/printk.c plus:


ngl bestie, read the whole squad's pages before you go touching console locking. she's not gatekeeping but the kernel absolutely will. 😭

πŸ’– that's the whole page, you're so welcome πŸ’–

this little fairy godmother of a page lives in ./kernel/printk, and the calendar says October 2026 β€” so go forth, parse those prefixes, and slay. πŸ§šβ€β™€οΈβ­πŸ“

πŸ“¦ where this page comes from