mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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 <gniibe@fsij.org>
This commit is contained in:
parent
1c5584c395
commit
6b4fd3a5da
2 changed files with 138 additions and 11 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue