]> Pileus Git - ~andy/fetchmail/blob - lock.h
Fix typo repsonsible -> responsible.
[~andy/fetchmail] / lock.h
1 /** \file lock.h function declarations (API) for lock.c */
2
3 #ifndef FM_LOCK_H
4 #define FM_LOCK_H
5
6 /* from lock.c: concurrency locking */
7
8 /** Set up the global \a lockfile variable (but do not lock yet). */
9 void fm_lock_setup(struct runctl *);
10
11 /** Assert that we already possess a lock. */
12 void fm_lock_assert(void);
13
14 /** Obtain a lock or exit the program with PS_EXCLUDE. This function is
15  * idempotent, that means it can be run even if we already have the
16  * lock. Note that fm_lock_setup() has to be run beforehand; this
17  * function does not check that condition. */
18 void fm_lock_or_die(void);
19
20 /** Release the lock (unlink the lockfile). */
21 void fm_lock_release(void);
22
23 /** Check the state of the lock file. If there is an error opening or
24  * reading the lockfile, exit with PS_EXCLUDE. If a stale lock file
25  * cannot be unlinked, complain and try to truncate it to 0 size. If
26  * truncation fails, complain and exit with PS_EXCLUDE.  \return
27  * -  0 if no lock is set
28  * - >0 if a fetchmail is running, but not in daemon mode
29  * - <0 if a fetchmail is running in daemon mode.
30  */
31 int  fm_lock_state(void);
32
33 /** Register an atexit() exit handler to dipose of the lock on process exit. */
34 void fm_lock_dispose(void);
35
36 #endif