On Tuesday 24 August 2004 05:26, Dhiman, Gaurav wrote: > > I am getting some problem in it ....... The problem is that when I > load the module and read the module created "/proc/timer_wait" file > using 'head' or 'cat' command, then my timer_read_proc() function > (see the use_timer.c file in attachment) is called by kernel twice. Sounds correct. Cat will have something similar to the following (but hopefully with error checks :-) while ((n = read(fd, buf, 1000)) > 0) { write(1, buf, n); } For a file less then 1000 bytes, how many times will read() be called? > I am not able to understand why it is called two times. I am > attaching the output of 'dmesg' command. The attached text file > (dmesg_output.txt) contains only the kernel messages related to my > module. > > The output of reading process is that, for the first time it displays > what I want it to display but after that it displays garbage and it > also make the shell prompt filled with garbage ..... it does not show > ascii characters after that on shell prompt. You don't appear to be taking off_set into account in your read handler. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/