i_unreached();
}
-int file_try_lock(int fd, const char *path, int lock_type,
- enum file_lock_method lock_method,
- struct file_lock **lock_r)
-{
- return file_wait_lock(fd, path, lock_type, lock_method, 0, lock_r);
-}
-
int file_try_lock_error(int fd, const char *path, int lock_type,
enum file_lock_method lock_method,
struct file_lock **lock_r, const char **error_r)
return 1;
}
-int file_wait_lock(int fd, const char *path, int lock_type,
- enum file_lock_method lock_method,
- unsigned int timeout_secs,
- struct file_lock **lock_r)
-{
- const char *error;
- int ret;
-
- ret = file_wait_lock_error(fd, path, lock_type, lock_method,
- timeout_secs, lock_r, &error);
- if (ret < 0)
- i_error("%s", error);
- return ret;
-}
-
int file_wait_lock_error(int fd, const char *path, int lock_type,
enum file_lock_method lock_method,
unsigned int timeout_secs,
/* Lock the file. Returns 1 if successful, 0 if file is already locked,
or -1 if error. lock_type is F_WRLCK or F_RDLCK. */
-int file_try_lock(int fd, const char *path, int lock_type,
- enum file_lock_method lock_method,
- struct file_lock **lock_r);
-/* Like file_try_lock(), but return the error message as a string instead
- of logging it. Also when returning 0 an error message is returned. */
int file_try_lock_error(int fd, const char *path, int lock_type,
enum file_lock_method lock_method,
struct file_lock **lock_r, const char **error_r);
/* Like lock_try_lock(), but return 0 only after having tried to lock for
timeout_secs. */
-int file_wait_lock(int fd, const char *path, int lock_type,
- enum file_lock_method lock_method,
- unsigned int timeout_secs,
- struct file_lock **lock_r);
-/* Like file_wait_lock(), but return the error message as a string instead
- of logging it. Also when returning 0 an error message is returned. */
int file_wait_lock_error(int fd, const char *path, int lock_type,
enum file_lock_method lock_method,
unsigned int timeout_secs,