Re: char driver module prob.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux