aboutsummaryrefslogtreecommitdiffstats
path: root/common/dotlock.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-12-22 12:45:02 +0000
committerWerner Koch <[email protected]>2023-12-22 12:45:02 +0000
commit2764ee309a2e0c10cef606345f06dd37c637fc41 (patch)
tree4238a756e7624b31ade6e558a1c0794af691412d /common/dotlock.h
parentRegister DCO for Mario Haustein (diff)
parentdoc: Explain why socket activation is a problem (diff)
downloadgnupg-2764ee309a2e0c10cef606345f06dd37c637fc41.tar.gz
gnupg-2764ee309a2e0c10cef606345f06dd37c637fc41.zip
Merge branch 'STABLE-BRANCH-2-4'
-- Fixed conflicts in NEWS g10/encrypt.c sm/encrypt.c sm/sign.c
Diffstat (limited to 'common/dotlock.h')
-rw-r--r--common/dotlock.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/dotlock.h b/common/dotlock.h
index 03131bb0c..0f52d4037 100644
--- a/common/dotlock.h
+++ b/common/dotlock.h
@@ -97,12 +97,35 @@ extern "C"
struct dotlock_handle;
typedef struct dotlock_handle *dotlock_t;
+enum dotlock_reasons
+ {
+ DOTLOCK_CONFIG_TEST, /* Can't check system - function terminates. */
+ DOTLOCK_FILE_ERROR, /* General file error - function terminates. */
+ DOTLOCK_INV_FILE, /* Invalid file - function terminates. */
+ DOTLOCK_CONFLICT, /* Something is wrong - function terminates. */
+ DOTLOCK_NOT_LOCKED, /* Not locked - No action required. */
+ DOTLOCK_STALE_REMOVED, /* Stale lock file was removed - retrying. */
+ DOTLOCK_WAITING /* Waiting for the lock - may be terminated. */
+ };
+
+/* Flags for dotlock_create. */
+#define DOTLOCK_PREPARE_CREATE (1U << 5) /* Require dotlock_finish_create. */
+#define DOTLOCK_LOCK_BY_PARENT (1U << 6) /* Used by dotlock util. */
+#define DOTLOCK_LOCKED (1U << 7) /* Used by dotlock util. */
+
void dotlock_disable (void);
dotlock_t dotlock_create (const char *file_to_lock, unsigned int flags);
+dotlock_t dotlock_finish_create (dotlock_t h, const char *file_to_lock);
void dotlock_set_fd (dotlock_t h, int fd);
int dotlock_get_fd (dotlock_t h);
+void dotlock_set_info_cb (dotlock_t h,
+ int (*cb)(dotlock_t, void *,
+ enum dotlock_reasons reason,
+ const char *,...),
+ void *opaque);
void dotlock_destroy (dotlock_t h);
int dotlock_take (dotlock_t h, long timeout);
+int dotlock_is_locked (dotlock_t h);
int dotlock_release (dotlock_t h);
void dotlock_remove_lockfiles (void);