]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Added file_lock_find() to find which process has a file locked.
authorTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:12:14 +0000 (18:12 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:12:14 +0000 (18:12 +0300)
src/lib/file-lock.c
src/lib/file-lock.h

index 8c450f698bcb74c6ec91390d1faf7575721e831a..d818bad1d2759802dec43f6e4c477600cd8c3b80 100644 (file)
@@ -131,8 +131,8 @@ file_lock_find_proc_locks(int lock_fd ATTR_UNUSED)
 #endif
 }
 
-static const char *
-file_lock_find(int lock_fd, enum file_lock_method lock_method, int lock_type)
+const char *file_lock_find(int lock_fd, enum file_lock_method lock_method,
+                          int lock_type)
 {
        const char *ret;
 
index 52765ae352183c57d77baf6e03e9110f01a5d154..189c162136d787a2e7dbae14da7014c847663989 100644 (file)
@@ -50,4 +50,9 @@ void file_unlock(struct file_lock **lock);
 /* Free the lock without unlocking it (because you're closing the fd anyway). */
 void file_lock_free(struct file_lock **lock);
 
+/* Returns human-readable string containing the process that has the file
+   currently locked. Returns "" if unknown, otherwise " (string)". */
+const char *file_lock_find(int lock_fd, enum file_lock_method lock_method,
+                          int lock_type);
+
 #endif