Results 1 to 4 of 4
Hello,
I use the seq_file interface to interact with my module. My entries are located in /proc/ip_vs_sip/ (/proc/ip_vs_sip/context_table, /proc/ip_vs_sip/provider_table, ...). So far so good. But when I read from user ...
- 05-20-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 5
seq_file output buffer size
Hello,
I use the seq_file interface to interact with my module. My entries are located in /proc/ip_vs_sip/ (/proc/ip_vs_sip/context_table, /proc/ip_vs_sip/provider_table, ...). So far so good. But when I read from user space, and the output reaches 4095 bytes, seq_printf returns -1.
What's the solution to get around that limit ?
Looking at the ip_conntrack module source code, the only main difference I see with my module are :
- the entries are in /proc/net
- the use of proc_net_fops_create before create_proc_entry
Any idea ?
Thanks in advance
Christian
- 05-20-2011 #2Just Joined!
- Join Date
- May 2011
- Posts
- 5
I've just tried to create my entries in /proc/net/ (instead of /proc/ip_vs_sip/), and I get to the same point ...
- 05-27-2011 #3Just Joined!
- Join Date
- May 2011
- Posts
- 5
Anyone ?
It's really related to the seq_file structure, cause when I printk instead of using seq_printf, all the buffer (~15k) is logged to /var/log/messages.
- 08-05-2011 #4Just Joined!
- Join Date
- May 2011
- Posts
- 5
OK, I got all sorted out. I had started writing my module from this seq_start sample code, without really understanding it by then :
static void *my_seq_start(struct seq_file *s, loff_t *pos)
{
if ( *pos == 0 )
{
return myPointer;
}
else
{
*pos = 0;
return NULL;
}
}
Given the data to be output is greater than the page size, the first iteration stopped when it reached 4k, and when the my_seq_start function got called again, *pos being greater than zero, it stopped.
My function should have been something like :
static void *my_seq_start(struct seq_file *s, loff_t *pos)
{
if ( *pos == 0 )
return ptr;
else if (*pos < dataToBeOutputLength )
return ptr+dataOutputSoFarLength);
else {
*pos = 0;
return NULL;
}
}
And it now works like a charm !


Reply With Quote

