Hi,
I am new to Linux programming and is trying to program a /proc read function to save data for debugging. I know that the /proc file size is limited to a page memory (4kB) if the *start pointer is not used. I have the following code working already reading <4kB of data, but when the data size > 4kB I received an error. I don't know how to use the *start pointer and *page to make it read larger files, can someone helped me in what I need to add? Examples?? Any known website/reference that covers this? Thanks a bunch!
static int proc_read_t1(char *page, char **start, off_t off, int count, int *eof, void *data)
{
int len=0, i;
struct t1_data_t *t1=(struct t1_data_t *)data;
for (i=0; i< DEBUG_SIZE; i++){
len += sprintf(page+len, "%d %d %d \n",t1[i].rlen, t1[i].tlen, t1[i].latency);
}
return (len);
static int proc_read_t1(char *page, char **start, off_t off, int count, int *eof, void *data)
{
int len=0, i;
struct t1_data_t *t1=(struct t1_data_t *)data;
for (i=0; i< DEBUG_SIZE; i++){
len += sprintf(page+len, "%d %d %d \n",t1[i].rlen, t1[i].tlen, t1[i].latency);
}
return (len);
Thanks in advance