为什么'printk'在linux中? [英] Why 'printk' in linux?
本文介绍了为什么'printk'在linux中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我查看了linux源代码,发现没有'printf'
而不是'pirntf','startf'在start_kernel()中使用。
为什么有'printk'而不是'printf'?为什么我们不能使用'printf'?
I looked over linux source code and i found that there is no 'printf'
Instead of 'pirntf', 'printf' was used in start_kernel().
Why is there 'printk' instead of 'printf'? Why can't we use 'printf'?
推荐答案
查看此链接
printk() [ ^ ]
printk
是你内核中可用的函数在编写内核代码时没有标准库,请参阅: http://www.makelinux.net/books/lkd2/ ch18lev1sec3 [ ^ ]
printk
is a function available within the kernel since you do not have the standard library when you are writing kernel code, see : http://www.makelinux.net/books/lkd2/ch18lev1sec3[^]
因为libc函数(如 printf
)在内核空间中不可用,例如,请参阅此页面:3.用户空间和libc界面 [ ^ ]。
Because libc functions (like printf
) are not available in kernel space, see, for instance, this page: "3. User space and the libc interface"[^].
这篇关于为什么'printk'在linux中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文