Log In

Home
    - Create Journal
    - Update
    - Download

Scribbld
    - News
    - Paid Accounts
    - Invite
    - To-Do list
    - Contributors

Customize
    - Customize
    - Create Style
    - Edit Style

Find Users
    - Random!
    - By Region
    - By Interest
    - Search

Edit ...
    - User Info
    - Settings
    - Your Friends
    - Old Entries
    - Userpics
    - Password

Need Help?
    - Password?
    - FAQs
    - Support Area


xb95 ([info]xb95) wrote,
@ 2008-10-21 19:04:00


Previous Entry  Add to memories!  Tell a Friend!  Next Entry
pondering linux fd stuff
Lazyweb:

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 new comment)



scribbld is part of the horse.13 network
Design by Jimmy B.
Logo created by hitsuzen.
Scribbld System Status