Brian Candler <b.candler / pobox.com> wrote:

> > The traditional Unix utilities to solve this problem are "lsof" and
> > "fuser". I don't know if OSX has either of these as standard, but they
> > are probably available as ports.
> 
> Or it might be "fstat", given that OSX is BSD-derived.
> http://netbsd.gw.com/cgi-bin/man-cgi?fstat++NetBSD-4.0

seems fstat doesn't exists on OS X :

zsh-% which fstat
fstat not found

however lsof and fuser does exists.

then i did some experiment ))

assuming the file is opened in a text editor i get :
zsh-% fuser -fu /Users/yt/dev/Signature/signatures.txt
/Users/yt/dev/Signature/signatures.txt: 

or, with lsof :
zsh-% lsof /Users/yt/dev/Signature/signatures.txt
zsh-% 


i get the correct answer when the file is selected by the Finder :
with fuser :
zsh-% fuser -fu /Users/yt/dev/Signature/signatures.txt
/Users/yt/dev/Signature/signatures.txt: 106(yt)

and, with lsof :
zsh-% lsof /Users/yt/dev/Signature/signatures.txt     
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
Finder  106   yt   14r   REG   14,2     3082 7364119
/Users/yt/dev/Signature/signatures.txt

then, i think, may be i'm wrong, that any text editor open a file show
it and close it afterwards even the file is still visible in that text
editor where the Finder lock the file when it is selected.

then lsof nor fuser are no help in my case because i want to avoid
opening a file under editing...

-- 
? L'essence m?me du g?nie, c'est de mettre en pratique 
les id?es les plus simples. ? 
(Charles Peguy)