summaryrefslogtreecommitdiff
path: root/reftable/system.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-08-12 11:54:21 +0200
committerJunio C Hamano <gitster@pobox.com>2025-08-12 07:41:00 -0700
commit8fd7a0ebe100ac3ed757408bbafe478e205804f4 (patch)
treebbcaa4cae6fee868f3499a4000e1f1782033993b /reftable/system.h
parent54d25de3ea93d42457bfdec43949683544d0031b (diff)
reftable: don't second-guess errors from flock interface
The `flock` interface is implemented as part of "reftable/system.c" and thus needs to be implemented by the integrator between the reftable library and its parent code base. As such, we cannot rely on any specific implementation thereof. Regardless of that, users of the `flock` subsystem rely on `errno` being set to specific values. This is fragile and not documented anywhere and doesn't really make for a good interface. Refactor the code so that the implementations themselves are expected to return reftable-specific error codes. Our implementation of the `flock` subsystem already knows to do this for all error paths except one. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/system.h')
-rw-r--r--reftable/system.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/reftable/system.h b/reftable/system.h
index beb9d2431f..c54ed4cad6 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -81,7 +81,9 @@ struct reftable_flock {
* to acquire the lock. If `timeout_ms` is 0 we don't wait, if it is negative
* we block indefinitely.
*
- * Retrun 0 on success, a reftable error code on error.
+ * Retrun 0 on success, a reftable error code on error. Specifically,
+ * `REFTABLE_LOCK_ERROR` should be returned in case the target path is already
+ * locked.
*/
int flock_acquire(struct reftable_flock *l, const char *target_path,
long timeout_ms);