file-dotlock.h revision 94f9cf3436f949d6450e8cda523979fc1b11f103
#ifndef __FILE_DOTLOCK_H
#define __FILE_DOTLOCK_H
#include <unistd.h>
#include <fcntl.h>
struct dotlock {
};
/* Create dotlock. Returns 1 if successful, 0 if timeout or -1 if error.
When returning 0, errno is also set to EAGAIN.
If file specified in path doesn't change in stale_timeout seconds and it's
still locked, override the lock file.
If checkonly is TRUE, we don't actually create the lock file, only make
sure that it doesn't exist. This is racy, so you shouldn't rely on it.
callback is called once in a while. stale is set to TRUE if stale lock is
detected and will be overridden in secs_left. If callback returns FALSE
then, the lock will not be overridden. */
unsigned int timeout, unsigned int stale_timeout,
void *context),
/* Delete the dotlock file. Returns 1 if successful, 0 if the file was already
been deleted or reused by someone else, -1 if error. */
#endif