简体   繁体   English

%r在内核printf格式中的含义是什么?

[英]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. 但如果我查看sprintf手册页,我找不到对'r'格式说明符的任何引用。

What does it do and where is it documented? 它做了什么以及在哪里记录?

check out the sprintf man page. 查看sprintf手册页。 it is stated : 它说:

%r Displays an integer using the current DDB radix. %r使用当前DDB基数显示整数。 This non-standard interpretation of %r is only available to db_printf(). 这种对%r的非标准解释仅适用于db_printf()。

here are more informations about DDB. 这里有关于DDB的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM