xdwjack 发表于 2003-5-17 00:09:43

printk好像不能在虚拟的终端上打印!

好像printk只能在文本环境下打印,不能在X环境下打印,请问应该如何解决这个问题呢?谢谢!

Dragonfly 发表于 2003-5-17 02:58:43

adjust u dmesg level.

dmesg can still see the output from printk in konsole.

xdwjack 发表于 2003-5-17 09:26:22

我想把printk打印出的信息可以直接打印到xwindow中的终端里,就像在那里执行一个cd directory,而这个directory并不存在,系统就会告诉我没有这个文件夹,是不是这个信息就是通过printk来做的,或者有别的替代的办法?

我想在xwindow里的终端中显示的情况和在文本方式下显示的情况相同。如果用dmesg的话,是不是如果不敲dmesg命令就不能看到打印的结果,我想让打印的结果实时地显示出来。

Dragonfly 发表于 2003-5-17 09:49:05

no, the error message from shell comand is print out by printf. kernel system call will only return an error code.

u need to adjust the dmesg level. but i am not sure if that works for xterm. i always debug my code under text console. so crash can lead to less data loss.

xdwjack 发表于 2003-5-17 10:08:08

谢谢斑竹的耐心指导!

我还想问您,如果编写了内核的程序,想验证一下刚刚编好的那一部分程序是不是符合我的要求,即使是不多的代码,也要把内核从make proper这样的命令到make modules_install都执行一遍生成新的内核,然后重新启动计算机?

是不是还有其它的办法可以用来调试和观察程序。

好像按理说一个内核编译第2次以后,应该明显快,但是我每一次编译内核的时候都是比较慢,没有发现速度提高多少,特别是即使有时看到速度提高了一些,但是重新启动计算机的时候,发现编译的速度又和第一次编译内核的速度一样了,不知道这是为什么。

谢谢

Dragonfly 发表于 2003-5-17 10:11:54

make bzImage may be enough. but it depends. so that is why i suggest u to make u code as a module if possible. save u many pain.

what u intend to do? if u can tell us.

xdwjack 发表于 2003-5-17 10:30:03

我现在要做的就是实现LSM钩子程序,我想应该是可以变成内核模块的吧。

谢谢您的建议。

是不是在进行内核编程的调试和跟踪的时候,绝大多数情况都是用printk语句打印出相关的信息?我马上就要进行实际的内核编程调试了,不过我认为这种用printk方法好像还是相当原始,不知道您是怎么看这个问题的,是不是有更高效的方法呢?我看过1篇关于调试的方法的文章,好像调试的友好程度和效率好像不是太高,不知道您平常调试的时候用的是什么方法呢?

Dragonfly 发表于 2003-5-17 10:35:53

lsm? u are doing sth relate with security. hehe, u have a good future.
i am not so sure about lsm. but after u install a hook in kernel, u should try to do all u stuff outof that bzImage. otherwise u have to recompile it everytime.
printk can sleep, so all places that can not sleep can not use printk. for example. isr. sb suggest gdb. u can try. and i think u can try the user mode linux for u lsm debug. it turns linux kernel to a user program. much easier for debug.
for me, i use printk, gdb, ksymoops, ...

Dragonfly 发表于 2003-5-17 10:42:18

i check the lsm, most of them as access control code. what u want to do? enhance it? or use it?

xdwjack 发表于 2003-5-17 10:55:13

我现在把我对您的话的理解说一下吧,您看是不是和你的意思是一致的。

也就是说,我现在编写LSM程序的时候,我编写的这一部分完全可以作为一个模块来编写,它的独立性比较强,和内核的结合只是一些接口而已,所以在调试的时候,就可以在用户态来调试,来测试我编写的程序的逻辑是不是有问题,当我在用户态测试没有什么大的问题的时候,我再把这些和内核的东西一起编译,综合调试。

不知道我说的所有的这些和您的上一个贴子所说的解释是否基本等价。如果是的话还说明我理解您的意思了,如果不一样,还请您纠正。

我现在要做的是要加入增强的访问控制,并结合实际需要进行的访问控制。也就是作安全操作系统。

Dragonfly 发表于 2003-5-17 11:07:17

secure os? interesting.
u code is still a kernel module even u move it out of kernel. so that is still a kernel mode.

the user mode linux i mention is a different one , read this http://user-mode-linux.sourceforge.net/

enhanced ac? i browse the doc of lsm, it has mac already? u want to add what? rbac? mls? i remember there are some code also implement the mls in linux.

good luck.

xdwjack 发表于 2003-5-17 11:24:56

thank you for your help very much!

I think good beginning is a half of success,it is really the case.

indeed,there are mls,mac in lsm.

ac includes dac and mac,while mac use mls.this is a rule applied to the computer security field,not just in secure os.

what i will do is to use the rule to solve real problem,to apply the rule to our secure os to support special type of situations.

though there are some implementations code,but the security database,the rule of deciding ,the type and number of level,and the meaning of a lot of the same terms are perhaps different between the existing system and what i tend to do .

so perhaps i have a lot of work to do.

thank you for your help again.your quick answer and high quality impressed me. i think i can no doubt make great progress and rapid progress here.

Dragonfly 发表于 2003-5-17 11:32:36

welcome.
yes, ac is a complex topic and there is no total solution. u have to customize it. good luck.
:wink::-D

xdwjack 发表于 2003-5-17 15:23:31

http://user-mode-linux.sourceforge.net/是不是www.sourceforge.net的一个链接?如果敲入http://user-mode-linux.sourceforge.net/,找不到网页.

我到www.sourceforge.net\上面找,找不到和user mode相关的东西,可否指点小弟如何找到

Dragonfly 发表于 2003-5-17 20:57:01

http://sourceforge.net/projects/user-mode-linux/

u access may be blocked.i can access that site easily.
页: [1] 2
查看完整版本: printk好像不能在虚拟的终端上打印!