我试图找出锁定了文本文件的进程。
我希望用Carbon或Cocoa来做这件事。
我是MacAPI的新手,我来自WinAPI。
由于
编辑:添加了corefoundation标签,因为我听说碳已被弃用
答案 0 :(得分:1)
您可以通过运行命令lsof
例如
lsof | grep file.txt
来自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.