Is there any way in C (using some system call or whatever) to determine how
many processes have a certain file open for writing/reading? Or are there
any system calls that do anything related (similar) to that?
Thanks,
-Maran
Is there any way in C (using some system call or whatever) to determine how
many processes have a certain file open for writing/reading? Or are there
any system calls that do anything related (similar) to that?
Thanks,
-Maran
Maran> Is there any way in C (using some system call or whatever) to
Maran> determine how many processes have a certain file open for
Maran> writing/reading? Or are there any system calls that do
Maran> anything related (similar) to that?
This typically involves grovelling in kernel memory.
In 99.9% of cases, the answer is "you don't want to do that". Really.
(For the other cases, get hold of lsof, and invoke it from your
program via popen or similar, and remember that the information you
get is already out of date by the time you read it.)
--
Andrew.
comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
or <URL: http://www.whitefang.com/unix/>
> Is there any way in C (using some system call or whatever) to determine how
> many processes have a certain file open for writing/reading? Or are there
> any system calls that do anything related (similar) to that?
See the program 'lsof', "list open files".
AJ
1. How I could add a new system call to linux or modify a system calls
Dear masters
How I could add a new system call to linux or modify a system calls.
Any help/pointers will be appreciated.
regards
Maryam
2. Perl's DBD::mysql will 'make' but won't 'make test' on Solaris 10
3. How to use open system call in a new system call
5. "Interrupted system call" at "low level" - system calls
6. "No processes available" on boot
7. Can I get info about current filesystem by using system calls?
8. Newbie Alert: :) Fresh install, everything but telnetd & ftpd seems to work
9. system call to get calling processes tty?
10. Calling a Loadable System Call
11. System Call, Library Call and Process Size
12. Reentrant system calls (can be called from signal handler)