Method Fuse.Operations()->lock()
- Method
lock
mapping(string:int)|intlock(stringpath,intmode,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->ownerIf 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
modeargument.- Parameter
mode F_SETLKAcquire a lock (when
how->typeis F_RDLCK or F_WRLCK) or release a lock (whenhow->typeis F_UNLCK) on the bytes specified by thehow->whence,how->start, andhow->lenfields of lock. If a conflicting lock is held by another process, you should return System.EACCES or System.EAGAIN.F_SETLKWIdentical to F_SETLK, but if a lock is held on the file, wait for it to be released before returning. You are allowed to return System.EINTR, to signal that the waiting has been interrupted and must be restarted.
F_GETLKIdentical to F_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 lock() returns details about one of these locks in the
"type","whence",start, and"len"fields ofhowand sets the"pid"field to be the PID of the process holding that lock. Then return the mapping.- Parameter
how "owner":intUid of the lock owner (if any).
"type":intType of operation. One of
F_RDLCKAcquire a read lock.
F_WRLCKAcquite a write lock.
F_UNLCKRelease a lock.
"whence":intHow to interpret the
"start"field. One of Stdio.SEEK_CUR, Stdio.SEEK_SET or Stdio.SEEK_END."start":intStart offset of the file
pathto lock."len":intNumber of bytes starting at
"start"to lock."pid":intPid of the lock owner (if any).