diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-05 17:27:04 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-05 19:39:15 -0800 |
| commit | c4da7817b4c8dd71b2a07d4d1c46b486ec57eeb4 (patch) | |
| tree | b1166d49e6673fcbad28c0bd65630f5af37a86ab /src/core/platform.h | |
| parent | b6298c28473acbed2f1429176c7cae4fb514d98b (diff) | |
| download | nng-c4da7817b4c8dd71b2a07d4d1c46b486ec57eeb4.tar.gz nng-c4da7817b4c8dd71b2a07d4d1c46b486ec57eeb4.tar.bz2 nng-c4da7817b4c8dd71b2a07d4d1c46b486ec57eeb4.zip | |
fixes #265 nngcat should support persistent ZT nodes
fixes #267 zerotier transport should lock ZT_HOME
Diffstat (limited to 'src/core/platform.h')
| -rw-r--r-- | src/core/platform.h | 12 |
1 files changed, 12 insertions, 0 deletions
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. |
