file-lock.h revision 8c8f7ac580b661aee3d8b8dd37df4a9b41c77000
#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 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,
/* Change the lock type. */
/* Unlock and free the lock. */
/* Free the lock without unlocking it (because you're closing the fd anyway). */
#endif