diff options
author | NIIBE Yutaka <[email protected]> | 2023-12-19 06:59:41 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-12-19 06:59:41 +0000 |
commit | 6b4fd3a5da7e018166d154d6514161d939f5c4f1 (patch) | |
tree | d9169a8093b588d8eb341eba63655bd945bc9664 /common/dotlock.h | |
parent | kbx: Create public-keys.d, after creating the homedir. (diff) | |
download | gnupg-6b4fd3a5da7e018166d154d6514161d939f5c4f1.tar.gz gnupg-6b4fd3a5da7e018166d154d6514161d939f5c4f1.zip |
common: Enhance dotlock, so that we can have a CLI util.
* common/dotlock.h (DOTLOCK_LOCK_BY_PARENT, DOTLOCK_LOCKED): New.
* common/dotlock.c [HAVE_POSIX_SYSTEM]: Include <dirent.h>.
(dotlock_get_process_id, dotlock_detect_tname): New.
(dotlock_create_unix): Handle the case when no_write option is
specified. Not creating the lock file, but detect the the file of
tname.
(dotlock_create) [HAVE_POSIX_SYSTEM]: Add support of
DOTLOCK_LOCK_BY_PARENT and DOTLOCK_LOCKED for dotlock CLI util.
(dotlock_take_unix): Support the case of DOTLOCK_LOCK_BY_PARENT.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/dotlock.h')
-rw-r--r-- | common/dotlock.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/dotlock.h b/common/dotlock.h index 915279176..0f52d4037 100644 --- a/common/dotlock.h +++ b/common/dotlock.h @@ -108,7 +108,10 @@ enum dotlock_reasons DOTLOCK_WAITING /* Waiting for the lock - may be terminated. */ }; -#define DOTLOCK_PREPARE_CREATE (1<<5) /* Require dotlock_finish_create. */ +/* 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); |