主题 : 如何linux增加打印输出 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 113
精华: 0
发帖: 26
金钱: 210 两
威望: 97 点
综合积分: 52 分
注册时间: 2008-02-18
最后登录: 2010-08-03
楼主  发表于: 2009-12-10 11:51

 如何linux增加打印输出

我是linux新手. 我现在运行友善之臂的linux2.6.29. 请问我想在驱动程序中增加打印信息. 便于调试驱动时候从打印口输出信息.
printf("socket creating err in udptalk\n");
我增加以上这种写法到内核驱动C程序中. 但编译警告提示:
warning: incompatible implicit dec laration of build-in function 'printf'
请问应按增加哪个函数来打印输出?
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-12-10 13:00
内核或驱动里用printk,用法和printf一样。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 113
精华: 0
发帖: 26
金钱: 210 两
威望: 97 点
综合积分: 52 分
注册时间: 2008-02-18
最后登录: 2010-08-03
2楼  发表于: 2009-12-10 17:14
是呵.   现在我在调试rt73 wifi驱动时候在很多地方加了printk打印程序. 加了打印程序后wifi卡就工作不正常.
wifi卡与2440通讯死循环了. printk难道有很大幅作用?