Re: Problem reading from procfile.

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

 



On Monday 11 December 2006 13:44, Johannes Held wrote:
> Hello,
>
>
> I attached the stripped down part of the code.
>
> I pen&papered it. It's working.
> If all data is written, I return 0 to signal EOF.
>
> But - and here's the problem - cat or joe don't bother. They start reading
> again (but without opening the file again).
> I did some printks. And right after returning 0, the function is called
> again in an endless loop.
>
> Now I've written a very simple programm to read form a file until read
> says: "O. You reached EOF."
>
> AND: It works.
> I write two lines (~54Bytes) into my file and read the data back.
> cat gives me millions of lines..
> and joe "dies" by filling his internal buffer.
>
> So, what's the problem in this code?
>

Hi Johannes,

You need to update off_ to the file current position. Basically, your static 
variable len should dissapear and instead all operations with it should be 
done with off_.


Regards,
tavi

--
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