netdev
[Top] [All Lists]

Re: Wrong UIDs reported in /proc/net/tcp

To: David Stevens <dlstevens@xxxxxxxxxx>
Subject: Re: Wrong UIDs reported in /proc/net/tcp
From: "Chad N. Tindel" <chad@xxxxxxxxxx>
Date: Thu, 18 Nov 2004 18:49:11 -0500
Cc: linux-net@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, netdev-bounce@xxxxxxxxxxx, Stephen Hemminger <shemminger@xxxxxxxx>
In-reply-to: <OFE512064F.DBA4A3CD-ON88256F50.007A2A62-88256F50.007A5E0F@xxxxxxxxxx>
References: <20041118220719.GA9890@xxxxxxxxxxxxxxxxxxx> <OFE512064F.DBA4A3CD-ON88256F50.007A2A62-88256F50.007A5E0F@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
> Assuming so, another solution would be to stat/fstat the file, add some to 
> it to account
> for growth, allocate a buffer that big and read the whole thing in one 
> shot. Then the
> results should be self-consistent.

Yeah the kernel doesn't let you read more than 1 page of data.  Thats how big
the block of memory that it passes to the proc handler is.

http://lxr.linux.no/source/fs/proc/generic.c#L61

IIRC, each line in /proc/net/tcp is 115 bytes or something like that, so if
a page is 4k, then you can only read 4096/115 = 35 sockets worth of info per 
read() call.

Chad

<Prev in Thread] Current Thread [Next in Thread>