Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does %r mean in kernel printf formats?

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

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 is:

        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 in the sprintf man page I can not find any reference to the 'r' format specifier.

What does it do and where is it documented?

like image 841
Good Person Avatar asked Oct 16 '22 23:10

Good Person


1 Answers

check out the sprintf man page. it is stated :

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

here are more informations about DDB.

like image 117
nabil.douss Avatar answered Oct 21 '22 00:10

nabil.douss