[PATCH v3] Print ip and port associated with descriptor with -yy

Masatake YAMATO yamato at redhat.com
Thu Aug 7 14:24:03 UTC 2014


On Thu, 7 Aug 2014 19:19:47 +0530, Zubin Mithra <zubin.mithra at gmail.com> wrote:
>> System calls that adding and removing a socket from fd table of process are
>> enumerable. So you can cache the response from the netlink socket safely
>> if the target program is not multi-threaded.
>> * adding
>>   + socket
>>   + accept
>>   + passing
>> * removing
>>   + close
>>   + shutdown?
>> Could the technique I used in commit 1d78d22058da04eac7bf726c059d5c3fb193da08
>> help you?
> I'll check this commit out and reply asap.

After thinking, you may not have to track the adding.
Not in a long span, we can use inode number of socket can be used as a
key for search information from cache. The inode number can be used as 
an identifier in system global. Nice.

close() and shutdown() must be tracked to avoid overflowing of cache
area. consider stracing following broken code:

   while (1)
	n = socket (...);

In the latest linux What  I checked are


	inode->i_ino = get_next_ino();


	*p = ++res;
	return res;

Masatake YAMATO

More information about the Strace-devel mailing list