From c4da7817b4c8dd71b2a07d4d1c46b486ec57eeb4 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 5 Mar 2018 17:27:04 -0800 Subject: fixes #265 nngcat should support persistent ZT nodes fixes #267 zerotier transport should lock ZT_HOME --- src/core/platform.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/core/platform.h') diff --git a/src/core/platform.h b/src/core/platform.h index 3f336f11..d5fc40f7 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -434,6 +434,18 @@ typedef int (*nni_plat_file_walker)(const char *, void *); // with the path name, and the supplied void * argument. extern int nni_plat_file_walk(const char *, nni_plat_file_walker, void *, int); +typedef struct nni_plat_flock nni_plat_flock; + +// nni_plat_file_lock locks the file. This usually means open it (creating +// if it does not exist) and doing a lock operation. The nni_plat_flock +// is our handle for the lock, to unlock. Usually its just a file descriptor, +// and we can unlock by doing close(). Note that this is a "try-lock" +// operation -- if the file is already locked then NNG_EBUSY is returned. +extern int nni_plat_file_lock(const char *path, nni_plat_flock *); + +// nni_plat_file_unlock unlocks the previously locked file. +extern void nni_plat_file_unlock(nni_plat_flock *); + // nni_plat_dir_open attempts to "open a directory" for listing. The // handle for further operations is returned in the first argument, and // the directory name is supplied in the second. -- cgit v1.2.3-70-g09d2