vt_kmsg_redirect(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vt_kmsg_redirect(9) πŸ’–

🌸 NAME 🌸

vt_kmsg_redirect β€” sets/gets the kernel message console. yes bestie, this is the Kernel API Manual entry for vt_kmsg_redirect(9), and it's giving β€œtiny function, very specific job” energy. πŸ’…

✨ SYNOPSIS ✨

int vt_kmsg_redirect (int new );

πŸŽ€ ARGUMENTS πŸŽ€

  • new β€” the new virtual terminal number or -1 if the console should stay unchanged. that's the whole argument, bestie 🫢

πŸ’… DESCRIPTION πŸ’…

okay so by default, the kernel messages are always printed on the current virtual console. but the user may modify that default with the TIOCL_SETKMSGREDIRECT ioctl call. no cap, that's the official switch-up. ✨

this function sets the kernel message console to be new. it returns the old virtual console number. think β€œset it, then hand back the previous one” energy. πŸ‘‘

the virtual terminal number 0 β€” both as parameter and return value β€” means no redirection (i.e. always printed on the currently active console). so 0 is literally β€œno redirect, bestie.” πŸŒ€

the parameter -1 means that only the current console is returned, but the value is not modified. you may use the macro vt_get_kmsg_redirect in that case to make the code more understandable. iykyk, it's the polite β€œjust peek, don't touch” move. πŸ™ˆ

when the kernel is compiled without CONFIG_VT_CONSOLE, this function ignores the parameter and always returns 0. that's the whole exception, periodt. πŸ’€

bestie reminder: 0 = no redirection, and -1 = only return the current console without modifying the value. iconic behavior, honestly. πŸŽ€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file: ./drivers/tty/vt/vt.c β€” yes, that's the file dropped right in the refs. and here's the whole squad:


k bye bestie πŸ‘‹ β€” source/version: ./drivers/tty/vt, date: October 2026, and it's still the vt_kmsg_redirect(9) manual. mwah πŸ’–

πŸ“¦ where this page comes from