"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/file-lock.h" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

file-lock.h  (dovecot-2.3.16):file-lock.h  (dovecot-2.3.17)
skipping to change at line 18 skipping to change at line 18
struct file_lock; struct file_lock;
struct dotlock; struct dotlock;
enum file_lock_method { enum file_lock_method {
FILE_LOCK_METHOD_FCNTL, FILE_LOCK_METHOD_FCNTL,
FILE_LOCK_METHOD_FLOCK, FILE_LOCK_METHOD_FLOCK,
FILE_LOCK_METHOD_DOTLOCK FILE_LOCK_METHOD_DOTLOCK
}; };
struct file_lock_settings {
enum file_lock_method lock_method;
/* When the lock is freed, close the fd automatically. This can
be useful for files that are only created to exist as lock files. */
bool unlink_on_free:1;
/* When the lock is freed, unlink() the file automatically, unless other
processes are already waiting on the lock. This can be useful for
files that are only created to exist as lock files. */
bool close_on_free:1;
/* Do not panic when the kernel returns EDEADLK while acquiring the
lock. */
bool allow_deadlock:1;
};
/* Parse lock method from given string. Returns TRUE if ok, /* Parse lock method from given string. Returns TRUE if ok,
FALSE if name is unknown. */ FALSE if name is unknown. */
bool file_lock_method_parse(const char *name, enum file_lock_method *method_r); bool file_lock_method_parse(const char *name, enum file_lock_method *method_r);
/* Convert lock method to string. */ /* Convert lock method to string. */
const char *file_lock_method_to_str(enum file_lock_method method); const char *file_lock_method_to_str(enum file_lock_method method);
/* Lock the file. Returns 1 if successful, 0 if file is already locked, /* 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. */ or -1 if error. lock_type is F_WRLCK or F_RDLCK. */
int file_try_lock(int fd, const char *path, int lock_type, int file_try_lock(int fd, const char *path, int lock_type,
enum file_lock_method lock_method, const struct file_lock_settings *set,
struct file_lock **lock_r); struct file_lock **lock_r, const char **error_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 /* Like lock_try_lock(), but return 0 only after having tried to lock for
timeout_secs. */ timeout_secs. */
int file_wait_lock(int fd, const char *path, int lock_type, int file_wait_lock(int fd, const char *path, int lock_type,
enum file_lock_method lock_method, const struct file_lock_settings *set,
unsigned int timeout_secs, unsigned int timeout_secs,
struct file_lock **lock_r); struct file_lock **lock_r, const char **error_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,
struct file_lock **lock_r, const char **error_r);
/* Change the lock type. WARNING: This isn't an atomic operation! /* Change the lock type. WARNING: This isn't an atomic operation!
The result is the same as file_unlock() + file_try_lock(). */ The result is the same as file_unlock() + file_try_lock(). */
int file_lock_try_update(struct file_lock *lock, int lock_type); int file_lock_try_update(struct file_lock *lock, int lock_type);
/* When the lock is freed, unlink() the file automatically, unless other /* When the lock is freed, unlink() the file automatically, unless other
processes are already waiting on the lock. This can be useful for files that processes are already waiting on the lock. This can be useful for files that
are only created to exist as lock files. */ are only created to exist as lock files. */
void file_lock_set_unlink_on_free(struct file_lock *lock, bool set); void file_lock_set_unlink_on_free(struct file_lock *lock, bool set);
/* When the lock is freed, close the fd automatically. This can /* When the lock is freed, close the fd automatically. This can
be useful for files that are only created to exist as lock files. */ be useful for files that are only created to exist as lock files. */
void file_lock_set_close_on_free(struct file_lock *lock, bool set); void file_lock_set_close_on_free(struct file_lock *lock, bool set);
 End of changes. 4 change blocks. 
15 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)