LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-20-2010, 11:12 AM   #1
abhibare
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
How to find open file offset


Hi all,

I have a program that takes a long time processing a large file. I am running it on SLES 10 (kernel 2.6.16.60). The process will most probably read the file from start to end. Is there a way to find out where the process currently is - like file offset?

lsof has "-o" option. But I read in some forums that it does not work on Linux. Does anybody know of any other way?

Thank you,
Abhijit
 
Old 01-20-2010, 11:51 AM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
--Nothing to deal the linux kernel--
By the way, assuming you're working in C, "ftell" is the function you're looking for
 
Old 01-20-2010, 01:09 PM   #3
abhibare
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Oops I didn't write the question clearly.

This is not my program. I want to know if it is possible to find file offset externally while a process is running. Does kernel allow that somehow?

Thanks for your reply.
 
Old 01-20-2010, 03:03 PM   #4
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
AFAIK, you can tell what program hold which file descriptor with lsof and fuser, but not sure if you can get more from that since the file descriptor offset is quite versatile...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
view parts of file by offset (how to use a command such as head -c to start later) doug23 Linux - General 6 08-20-2009 02:44 AM
sorting a file at a certain offset in bash matt007 Linux - Software 4 06-24-2008 04:03 PM
We browser can't find file when I try to open it JosephS Linux - Software 6 04-19-2008 04:03 PM
[Flex] How can I get a file offset during scanning? chuanyung Programming 2 03-07-2004 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration