[Samba] Re: Windows share modes and Linux file locking,
flock & fcntl
lothaine at gmail.com
Tue Jan 29 15:35:55 GMT 2008
> In particular I am looking at a machine running Linux exporting its
> local filesystem using Samba, with a Windows client accessing the
> file share. If I use byte range locking (fcntl() on Linux, LockFile()
> on Windows) things work as expected, and applications using the
> file system locally and remotely see the locks set by the other.
> However, if a program on the Windows client opens a file with a
> share mode that denies access to other processes, I can't seem to
> detect this in a local Linux process, either with fcntl() or with flock().
> I included the test programs I used below. I have seen references
> that this should be possible
> last paragraph) but I may be misunderstanding things.
There seems to be a library for accessing Samba's database of share modes
in the Samba source tree (for version 3.0.28). The relevant files are
On the other hand, it doesn't appear to be possible to use local system
calls to detect share modes because their semantics are too different from
file locks, see threads below.
More information about the samba