How the printk() works .... printk() write the things to kernels internal data structure (which is implemented as circular queue). Now the question is how the message comes out from kernel data structure to user space. There is a daemon kernel thread (klogd) which keeps on fetching the information from this kernel circular queue and forward the messagfes to another process (syslogd). Now syslogd categorize the messages baed upon there priority and its configuration settings, if the priority level of message is greater than the default level of system then syslogd to console terminal (not to xterminal) else it sends the message to /var/log/messages. For more information read the 4th chapter of Rubini's book. The link to online chapter is as follows: http://www.xml.com/ldd/chapter/book/ch04.html Thanks & Regards, Gaurav Dhiman -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of manish regmi Sent: Wednesday, June 30, 2004 12:05 PM To: so_usp@yahoo.com.br Cc: kernelnewbies@nl.linux.org Subject: RE: KERN_ALERT doesn´t work >Hi, > >I´m implementing a syscall and I want to write some >information on the user terminal. I´ve heard that >using printk(KERN_ALERT"String") could return "String" >to the terminal, but it doesn´t. It just modifies the >file /var/log/messages. My distribution is Fedora Core >2 (kernel 2.6.5). Did somebody get the same problem? >Did I do something wrong? The syscall is working >perfectly, the only problem is that I want to return >information to the user, and using the copy_to_user >function isn´t appropriate, once there are lots of >information (more than 5) I want to retrieve, with >different types (not only string). > >Thanks The console prints the message according to the loglevel. You can change the loglevel of the console by klogd -c <priority> eg, If you want to print the message with priority equal or greater than 2. Then do, klogd -c 2 IF it is already running kill it and run the above command. You can print the message to any console by giving it highest priority <0> printk("<0> Hello world\n"); Learn it in detail here. http://www.xml.com/ldd/chapter/book/ch04.html regards manish _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/