Im trying to identify the processes that have a text file locked.
Im looking to do this with Carbon or Cocoa please.
I am new to MacAPI, I come from WinAPI.
Thanks
edit: added corefoundation tag as i hear carbon is deprecated
You can check which process is using a file by running the command lsof
e.g.
lsof | grep file.txt
From the manpage of lsof
The mode character is followed by one of these lock characters, describing the type of lock applied to the
file:
N for a Solaris NFS lock of unknown type;
r for read lock on part of the file;
R for a read lock on the entire file;
w for a write lock on part of the file;
W for a write lock on the entire file;
u for a read and write lock of any length;
U for a lock of unknown type;
x for an SCO OpenServer Xenix lock on part of the file;
X for an SCO OpenServer Xenix lock on the entire file;
space if there is no lock.
See the LOCKS section for more information on the lock information character.