Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/cache.h | 12 |
1 file changed, 11 insertions, 1 deletion
diff --git a/source/cache.h b/source/cache.h index d3a7ec4..cfe1fbf 100644 --- a/source/cache.h +++ b/source/cache.h @@ -27,7 +27,7 @@ extern int cache_process(int size, const char *path, const char *key, int ttl, * Write one line per cache slot to stdout, giving its path, modification time, * size and key. */ -extern int cache_ls(const char *path); +extern void cache_ls(const char *path); /* * Give up on the slot being filled and put stdout back on the client, after @@ -40,4 +40,14 @@ extern int cache_abandon_fill(void); extern unsigned long cache_hash_str(const char *str); +/* + * Open the lock file at path, creating it if need be, then lock it without + * waiting and empty it, leaving the descriptor in *fd. The lock holds until + * the last descriptor on the file closes, and the caller renames or removes + * the file before that. Returns 0, EAGAIN or EWOULDBLOCK when another process + * holds the lock or has renamed the file away, or the errno of the step that + * failed, which has been logged. *fd is -1 on failure. + */ +extern int cache_lock_file(const char *path, int *fd); + #endif // CGIT_CACHE_H |
