2 * Copyright (C) 1999 Miquel van Smoorenburg
4 * This library is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * On Debian GNU/Linux systems, the complete text of the GNU Library
10 * General Public License can be found in `/usr/doc/copyright/LGPL'.
11 * You can also find a copy on the GNU website at http://www.gnu.org/
23 int lockfile_create(const char *lockfile
, int retries
, int flags
);
24 int lockfile_remove(const char *lockfile
);
25 int lockfile_touch(const char *lockfile
);
26 int lockfile_check(const char *lockfile
, int flags
);
29 * Return values for lockfile_create()
31 #define L_SUCCESS 0 /* Lockfile created */
32 #define L_NAMELEN 1 /* Recipient name too long */
33 #define L_TMPLOCK 2 /* Error creating temp lockfile */
34 #define L_TMPWRITE 3 /* Can't write pid into temp lockfile */
35 #define L_MAXTRYS 4 /* Failed after max. number of attempts */
36 #define L_ERROR 5 /* Unknown error; check errno */
37 #define L_MANLOCK 6 /* Cannot set mandatory lock on tempfile */
38 #define L_ORPHANED 7 /* Called with L_PPID but parent is gone */
39 #define L_RMSTALE 8 /* Failed to remove stale lockfile */
42 * Flag values for lockfile_create()
44 #define L_PID 16 /* Put PID in lockfile */
45 #define L_PPID 32 /* Put PPID in lockfile */
51 int interval
; /* Static interval between retries */
53 #define L_INTERVAL_D_ 64 /* Specify consistent retry interval */
54 #ifdef LOCKFILE_EXPERIMENTAL
55 #define lockargs lockargs_s_
56 #define L_INTERVAL L_INTERVAL_D_
57 int lockfile_create2(const char *lockfile
, int retries
,
58 int flags
, struct lockargs
*args
, int args_sz
);
62 int check_sleep(int, int);
64 int is_maillock(const char *lockfile
);
65 int lockfile_create_set_tmplock(const char *lockfile
, volatile char **tmplock
,
66 int retries
, int flags
, const struct lockargs_s_
*);
72 #endif /* _LOCKFILE_H */