[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: char driver module prob.
On Tue, 2005-03-29 at 12:07 +0200, Christophe Lucas wrote:
> Mandeep Sandhu (Mandeep_Sandhu@xxxxxxxxxxx) wrote:
> > hi all,
> >
> > I had written a small character driver under kernel 2.4.20.
> > For starters I had implemented it's read method only. This
> > would put a constant string "hello" into the user-space
> > buffer. The problem I'm seeing is that when i "cat" my device
> > it does not print anything on the console (i.e cat and not the
> > printk's in my driver...they get printed fine!). strace of cat
> > shows that it calls my drivers read method twice...first time
> > i copy the constant string into the user's buffer and return the
> > bytes copied....and on the second invocation i return 0 as there's
> > nothing more to read. strace shows cat writing out to the std.
> > output after the first read....but nothing comes on the console!!
> > if I put '\n' character in my constant string it prints out the
> > string correctly! I'm guessing the newline char causes the o/p
> > stream to be flushed....is this expected behavior??
> >
> > TIA,
> > -mandeep
>
hi christophe,
i don't have my own userland prog........it's whatever cat is doing...
so u mean cat could be using print instead of printf???
Amicalement :)
-mandeep
> If in your userland program, you print with a printf, it is normal, it
> can not be print...
>
> man flush
>
> ~Christophe
>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/