File: lock.h

package info (click to toggle)
dnssec-trigger 0.17%2Brepack-5.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,956 kB
  • sloc: ansic: 18,699; sh: 976; makefile: 495; xml: 444; objc: 421; cpp: 18
file content (32 lines) | stat: -rw-r--r-- 850 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Syncronization primitive to be used by the daemon and script in
 * order serialize execution. So far it should be just 1:1 rewrite of
 * the Python implementation.
 */

#if !defined LOCK_H && defined FWD_ZONES_SUPPORT
#define LOCK_H

#define __LOCK_FILE_DIR "/var/run/dnssec-trigger"
#define __LOCK_FILE_PATH "/var/run/dnssec-trigger/lock"

/** Check lock file presence and acquire the lock. If the file is
 * already locked, block until it is released.
 * TODO: possible errors
 */
void lock_acquire();

/** 
 * Release the lock.
 * TODO: possible errors
 */
void lock_release();

/**
 * Override lock file location. For testing purposes only. The function
 * stores the pointer, it does not copy the content, so the content must
 * live as long as the lock is used.
 */
void lock_override(const char *path, size_t len);

#endif /* LOCK_H */