public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* more fun with procfs (netfilter)
@ 2001-11-19  7:13 Alexander Viro
  2001-11-19  7:17 ` Alexander Viro
  2001-11-20  0:48 ` Rusty Russell
  0 siblings, 2 replies; 9+ messages in thread
From: Alexander Viro @ 2001-11-19  7:13 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, Linus Torvalds

% cat /proc/net/ip_conntrack |od -c
0000000   t   c   p                           6       1   2   1   0   7
[snip]
0005137
% od -c </proc/net/ip_conntrack
0000000
% cat /proc/net/ip_tables_names | od -c -w8
0000000   n   a   t  \n   f   i   l   t
0000010   e   r  \n
0000013
% od -c -w8 </proc/net/ip_tables_names
0000000   n   a   t  \n
0000004

Reason: netfilter procfs files try to fit entire records into the user
buffer.  Do a read shorter than record size and you've got zero.  And
read() returning 0 means you-know-what...

BTW, from strace output in cpuinfo bug report SuSE bash does reads by 128
bytes.  Which means that while read i; do echo $i; done </proc/net/ip_conntrack
will come out empty (lots of lines are longer than 160 characters).

I'll try to see if seq_file is suitable there, but in any case something
needs to be done - read() should return 0 _only_ at EOF and 128 bytes
definitely counts as reasonable buffer size.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-11-21  0:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-19  7:13 more fun with procfs (netfilter) Alexander Viro
2001-11-19  7:17 ` Alexander Viro
2001-11-19  9:17   ` Herbert Xu
2001-11-19  9:22     ` Alexander Viro
2001-11-19 19:18       ` H. Peter Anvin
2001-11-20  0:48 ` Rusty Russell
2001-11-20 10:19   ` Alexander Viro
2001-11-21  0:14     ` Jamie Lokier
2001-11-21  0:23       ` Alexander Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox