file-lock.h revision 0dc7891233a973829f00371b27810f849b987c66
#ifndef FILE_LOCK_H
#define FILE_LOCK_H
#include <unistd.h>
#include <fcntl.h>
#define DEFAULT_LOCK_TIMEOUT 120
struct file_lock;
enum file_lock_method {
};
/* Parse lock method from given string. Returns TRUE if ok,
FALSE if name is unknown. */
/* Convert lock method to string. */
/* 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. */
enum file_lock_method lock_method,
/* 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. */
enum file_lock_method lock_method,
/* Like lock_try_lock(), but return 0 only after having tried to lock for
timeout_secs. */
enum file_lock_method lock_method,
unsigned int timeout_secs,
/* 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. */
enum file_lock_method lock_method,
unsigned int timeout_secs,
/* Change the lock type. */
/* Unlock and free the lock. */
/* Free the lock without unlocking it (because you're closing the fd anyway). */
#endif