pondering linux fd stuff
Does anybody know how to get what the current position is in an open fd? In effect, I'm looking at a process (for example, gzip, tar, cat, etc) and I want to see how far along a file it has read. I can see what file it's in with lsof, I can see what data it's reading with strace, but I can't seem to figure out how to determine how far along it is.
Notably, this would be useful for getting progress indicators on things. Yeah, it's going to be inaccurate for small files due to buffering, but for a large operation it should be reasonably reliable in telling you the general location of the operation.
I've pondered this for a while now and can't think of anything that doesn't involve writing my own kernel module or something that parses the strace output and then tries to find that sequence of bytes in the file (unreliable and inefficient) or just counting the bytes read (strikes me as still inefficient, and doesn't work on an already-started process).
Anybody have any ideas?
Post a comment in response:
scribbld is part of the horse.13 network
Design by Jimmy B.
Logo created by hitsuzen.
Scribbld System Status