Re: character device driver reading only last character of buffer

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

 





On Sun, Sep 26, 2010 at 1:00 PM, Venkatram Tummala <venkatram867@xxxxxxxxx> wrote:

Try writing a user space file handling program in C. I repeat what other have already said before. Before starting kernel development, you need to know the user space basics.
I have done what you are saying in user space not once many times. Since you have been able to debug my code so I am mentioning
I have made programs to insert ,delete a node in a link list ,reverse a link list,stack que implementations via link list,binary search trees,
algorithms mentioned in the graphs chapter of Coreman book I have programmed,
I have made socket programs which can read and write data to a socket stream (very basic network programming done)
used seek,lseek methods in user space.


The first read comes in with a *f_pos of 0. If you dont update the file pointer, the user space program will keep reading from f_pos 0 indefinitely. As file pointer is at offset 0 always because you dont update *f_pos, every read(..) called by user space will succeed. So, your command cat /dev/bond will never return. user space programs generally look for a specific return code to know that it is the end of the file.
 
Thanks a lot for this one I was not clear on this part.
 


[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