ChinaUnix.net
相关文章推荐:

ubuntu printk 输出到终端

我想在调用printk()时直接把里面的内容输出终端,而不一遍遍的使用dmesg命令去查看,该怎么做?

by 木叶忍 - 内核源码 - 2009-04-11 12:51:24 阅读(4983) 回复(8)

相关讨论

[CODE] #include #include #include #include #include MODULE_LICENSE("GPL"); MODULE_AUTHOR("mq110"); static void print_string(char *str) { struct tty_struct *my_tty; my_tty = current->signal->tty; if (my_tty != NULL) { my_tty->driver->write(my_tty,0,str,strlen(str)); my_tty->driver->write(my_tty,0,"\015\013",2); } } static int __init print_string_init(void) ...

by cuteJerry - Linux文档专区 - 2008-03-25 16:08:25 阅读(731) 回复(0)

printk中ERN_DEBUG 级别: /var/log下没有 message文件,dmesg也看不到其输出 printk中ERN_DEBUG 级别输出到那? btw:KERN_INFO级别用dmesg能显示出来

by FreeGnu - 内核源码 - 2007-03-07 15:58:58 阅读(5400) 回复(0)

内核本身支持串口,同时启动的时候加上了参数console=ttyS0。 系统是2.4.22的,当前是有时能打印到串口,有时又不能? 另外,就是希望打印信息的时候,立即打印出来。譬如我第一行是打印信息的代码,第二行代码就可能导致Oops。这个时候要保证在Oops之前,能把第一行的信息打印出来。 请各位指点一下。

by Godbach - 内核源码 - 2009-11-23 00:07:30 阅读(11136) 回复(29)

[code] #include #include #include #include #include #include #include #include #include #define MY_FILE "/root/LogFile" char buf[128]; struct file *file = NULL; static int __init init(void) { mm_segment_t old_fs; printk("Hello, I'm the module that intends to write messages to file.\n"); if(file == NULL) file = filp_open(MY_FILE, O_RDWR | O_APPEND |...

by cuteJerry - Linux文档专区 - 2008-03-25 16:05:56 阅读(1362) 回复(0)
by Qiya - Linux论坛 - 2004-05-11 16:57:22 阅读(707) 回复(0)
by Qiya - Linux系统管理 - 2004-05-11 16:57:22 阅读(564) 回复(0)

在写hello模块时,使用的printk语句是: printk(KERN_ALERT "hello, world\n"); 但在insmod模块是,在终端上却没输出,情况如下: [jrq@Fedora hello]$ sudo insmod hello.ko //按理说这句话后,应该有Hello, world输出 [jrq@Fedora hello]$ sudo rmmod hello.ko ///应该输出Goodbye, cruel world [jrq@Fedora hello]$ dmesg ...... Hello, world Goodbye, cruel world [jrq@Fedora hello]$ cat /proc/sys/kernel/print...

by juruqiang - 内核源码 - 2012-01-05 15:00:14 阅读(2481) 回复(5)

文件hello.c代码如下: #include #include MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(viod){ printk(KERN_ALERT "hello init enter\n"); return(0); } static void hello_exit(void){ printk(KERN_ALERT "hello exit\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_AUTHOR("JINHUI"); MODULE_DESCRIPTION("a simple hello world c programme"); MODULE...

by jinhui916 - 驱动开发 - 2011-06-14 21:54:34 阅读(5993) 回复(9)

例子用的是《Linux设备驱动开发详解》里面提供的virtualbox里面的helloworld的例子,执行insmod ./hello.ko 和 rmmod hello都看不到输出,把优先级改成 KERN_EMERG,KERN_ALERT,KERN_CRIT... KERN_DEBUG make clean再make后等等都不行,并且在/var/log/messages里面也看的不全,比如我把优先级从0到7,每个都编译后insmod试一遍,观察/var/log/messages,里面只有优先级是2,3,6的,其它优先级的都没有,奇怪???

by wzz24 - 内核源码 - 2011-08-24 14:10:23 阅读(2118) 回复(3)

现在 cat /proc/kernel/printk 是 7 4 1 7 所以printk的level是没有问题的吧 但是printk打印的消息就是不显示呀

by xxw19840406 - 嵌入式开发 - 2011-11-27 18:58:19 阅读(6899) 回复(8)