What does% r mean in printf kernel formats?

In several places in the kernel source code, I could find this:

One example is

if (console_sc != NULL && console_sc->vtermid == sc->vtermid) { sc->outseqno = console_sc->outseqno; console_sc = sc; sprintf(uart_phyp_consdev.cn_name, "ttyu%r", unit); tty_init_console(sc->tp, 0); } 

Another example:

  if (!(vw->vw_flags & VWF_READY)) { callout_init(&vw->vw_proc_dead_timer, 0); terminal_maketty(vw->vw_terminal, "v%r", VT_UNIT(vw)); vw->vw_flags |= VWF_READY; if (vw->vw_flags & VWF_CONSOLE) { /* For existing console window. */ EVENTHANDLER_REGISTER(shutdown_pre_sync, vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT); } } 

but if I look into the sprintf man page, I cannot find a link to the r format specifier.

What does he do and where is it documented?

+5
source share
1 answer

view the sprintf page. it says:

% r Displays an integer using the current DDB edge. This non-standard interpretation of% r is only available for db_printf ().

here is more information about DDB.

+3
source

Source: https://habr.com/ru/post/1275164/


All Articles