lkml.org 
[lkml]   [2003]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectBUG in fs/proc/generic.c:proc_file_read
In short:
The hack used to be able to read proc files larger than 4k, breaks if the
caller does lseek() after read()

Detailed:
I am providing a proc read interface to one of my proc files by using the
given hack symantics in which every call to read_proc() writes the data
starting at the begining of the page but sets "*start" artificially to
indicate how many fields have been read. proc_file_read then correctly
adjusts *ppos to signify the artificial position inside the proc file
where the read pointer points. It is *artificial* beacuse it is not the
byte offset but some other offset which only read_proc understands. Next
time around when read_proc gets the *ppos to start reading from it knows
how to calculate the exxat byte offset from the *artificial* *ppos
provided.
This works fine with cat which simply calls read(). The "more" command
though has the following call pattern

read(fd,buf,4096) = X
lseek(fd,X,SEEK_SET);

-- lseek modified file->f_pos to the byte offset value, which disturbed
read_proc ---

read(fd,buf,4096) = 0;


the effect is that more never gives me data more than 4096 bytes worth.

My Question is. Is it a known problem ?


Thanx
tomar

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.031 / U:3.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site