2 * Copyright (C) 2023 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef COMMON_LOCKFILE_H
9 #define COMMON_LOCKFILE_H
12 * Create lock file to the given path and filename.
13 * Returns the associated file descriptor, -1 on error.
15 * Note that on systems that don't support flock, POSIX file locks are used.
16 * As such, the file lock is dropped whenever any of the file descriptors
17 * associated to the file's description is closed.
19 * For instance, the lock file is dropped if the process forks+exits or
20 * forks+execve as the child process closes a file descriptor referencing
21 * the file description of 'filepath'.
23 int utils_create_lock_file(const char *filepath);
25 #endif /* COMMON_LOCKFILE_H */