Method Fuse.Operations()->lock()
- Method
lock
mapping
(string
:int
)|int
lock(string
path
,int
mode
,mapping
(string
:int
)how
)- Description
Lock, unlock or test for the existence of record locks (POSIX file locking). The owner of the lock is identified by
how->owner
If you only need local file-locking on the computer the filesystem is mounted on you do not need to implement this interface. This is only needed for network filesystems that want locking to work over the network.
The operation mode depends on the mode argument.
F_SETLK
Acquire a lock (when
how->type
is F_RDLCK or F_WRLCK) or release a lock (whenhow->type
is F_UNLCK) on the bytes specified by the how->whence, how->start, and how->len fields of lock. If a conflicting lock is held by another process, you should return EACCES or EAGAIN.F_SETLKW
Identical to SETLK, but if a lock is held on the file, wait for it to be released before returning. You are allowed to return EINTR, to signal that the waiting has been interrupted and must be restarted.
F_GETLK
Identical to SETLK, but do not actually aquire the lock if it can be aquired. If one or more incompatible locks would prevent this lock being placed, then fcntl() returns details about one of these locks in the type, whence, start, and len fields of
how
and setpid
to be the PID of the process holding that lock. Then return the mapping.