file-dotlock.h revision fdcb22a688c4676face8db865736b217d9c07d19
2690N/A /* Dotlock files are created by first creating a temp file and then 2690N/A link()ing it to the dotlock. temp_prefix specifies the prefix to 2690N/A use for temp files. It may contain a full path. Default is 2690N/A /* Use this suffix for dotlock filenames. Default is ".lock". */ 2690N/A /* Abort after this many seconds. */ 2690N/A /* Override the lock file when it and the file we're protecting is 2690N/A older than stale_timeout. */ 3158N/A /* Callback is called once in a while. stale is set to TRUE if stale 2690N/A lock is detected and will be overridden in secs_left. If callback 2690N/A returns FALSE then, the lock will not be overridden. */ 2690N/A /* Rely on O_EXCL locking to work instead of using hardlinks. 2690N/A It's faster, but doesn't work with all NFS implementations. */ 2690N/A /* Use io_add_notify() to speed up finding out when an existing 2690N/A /* If lock already exists, fail immediately */ 2690N/A /* Don't actually create the lock file, only make sure it doesn't 2690N/A exist. This is racy, so you shouldn't rely on it much. */ 2690N/A /* Check that lock file hasn't been overridden before renaming. */ 2690N/A /* Don't close the file descriptor. */ 2690N/A/* Create dotlock. Returns 1 if successful, 0 if timeout or -1 if error. 2690N/A When returning 0, errno is also set to EAGAIN. */ 2690N/A/* Delete the dotlock file. Returns 1 if successful, 0 if the file was already 2690N/A been deleted or reused by someone else, -1 if error. */ 2690N/A/* Use dotlock as the new content for file. This provides read safety without 2690N/A locks, but it's not very good for large files. Returns fd for lock file. 2690N/A If locking timed out, returns -1 and errno = EAGAIN. */ 2690N/A/* Replaces the file dotlock protects with the dotlock file itself. */ 2690N/A/* Update dotlock's mtime. If you're keeping the dotlock for a long time, 2690N/A it's a good idea to update it once in a while so others won't override it. 2690N/A If the timestamp is less than a second old, it's not updated. */ 2690N/A/* Returns the lock file path. */