如何在系统调用内打印到控制台(终端)

发布于 2024-09-30 09:55:34 字数 84 浏览 3 评论 0原文

我如何在 Linux 系统调用中打印一些内容(用于调试目的)到控制台?

或者有没有什么不太困难的调试内核代码的方法?

谢谢

how can i print something (for debugging purpose) to console inside a linux system call?

Or is there any not very diffucult way of debugging kernel code?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我最亲爱的 2024-10-07 09:55:34

在内核中进行打印的可接受的方式是通过 printk() 。

The accepted way of printing inside the kernel is via printk().

悲欢浪云 2024-10-07 09:55:34

您还应该检查 printk 的不同修饰符(例如 KERNEL_DEBUG),它将控制消息的打印位置/方式,包括它们是打印到所有活动终端还是仅打印到系统缓冲区

You should also check the different modifiers to printk (such as KERNEL_DEBUG) which will control where/how the messages are printed, including whether they are printed to all active terminals or just the system buffer

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文