Mercurial > dovecot > original-hg > dovecot-1.2
view src/lib/file-lock.h @ 903:fd8888f6f037 HEAD
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 05 Jan 2003 15:09:51 +0200 |
parents | b7aefd0d7611 |
children | 411006be3c66 |
line wrap: on
line source
#ifndef __FILE_LOCK_H #define __FILE_LOCK_H #include <unistd.h> #include <fcntl.h> #define DEFAULT_LOCK_TIMEOUT 120 /* Lock whole file descriptor. Returns 1 if successful, 0 if lock failed, or -1 if error. lock_type is F_WRLCK, F_RDLCK or F_UNLCK. */ int file_try_lock(int fd, int lock_type); /* Lock whole file descriptor. Returns 1 if successful, 0 if timeout or -1 if error. When returning 0, errno is also set to EAGAIN. Timeouts after DEFAULT_LOCK_TIMEOUT. */ int file_wait_lock(int fd, int lock_type); /* Like file_wait_lock(), but you can specify the timout and a function which is called once in a while if waiting takes longer. */ int file_wait_lock_full(int fd, int lock_type, unsigned int timeout, void (*func)(unsigned int secs_left, void *context), void *context); #endif