tlm,
As I mentioned in /msg, the standard way would be fileno. Are these other filehandles available to you in your main code though? If not, it seems like symbol table hackery may in fact be the way to go.
You actually want to stat stuff and compare the resulting device, inode, etc. fileno returns the descriptor, but dup creates a new file descriptor pointing to the same underlying file.