portable: release 0.93
[got-portable.git] / lib / got_lib_lockfile.h
blobdecb643f317e45f572f429fd41d02f2c578772b0
1 /*
2 * Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * Git-compatible lock file implementation. Lock files are used to
19 * ensure exclusive access when files in a Git repository are modified.
22 #define GOT_LOCKFILE_SUFFIX ".lock"
24 struct got_lockfile {
25 char *path;
26 char *locked_path;
27 int fd;
30 const struct got_error *got_lockfile_lock(struct got_lockfile **,
31 const char *, int);
32 const struct got_error *got_lockfile_unlock(struct got_lockfile *, int);