diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-09-01 20:06:26 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-09-01 20:06:26 +0000 |
commit | f80ac31d742c2d86f1812b895ef61a5885e2447e (patch) | |
tree | 9b223723aced9e7a8acc55044120cc406c77bd9b /src/common/compat.h | |
parent | 6a29ad853b630a1970fd95e17ecd79306e7c39e6 (diff) | |
download | tor-f80ac31d742c2d86f1812b895ef61a5885e2447e.tar.gz tor-f80ac31d742c2d86f1812b895ef61a5885e2447e.zip |
Add a lockfile to the Tor data directory to avoid situations where two Tors start with the same datadir, or where a --list-fingerprints races with a server to create keys, or such.
svn:r16722
Diffstat (limited to 'src/common/compat.h')
-rw-r--r-- | src/common/compat.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index a0f614f55e..2e1c14b7e1 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -266,6 +266,11 @@ struct tm *tor_gmtime_r(const time_t *timep, struct tm *result); int replace_file(const char *from, const char *to); int touch_file(const char *fname); +typedef struct tor_lockfile_t tor_lockfile_t; +tor_lockfile_t *tor_lockfile_lock(const char *filename, int blocking, + int *locked_out); +void tor_lockfile_unlock(tor_lockfile_t *lockfile); + #ifdef MS_WINDOWS #define PATH_SEPARATOR "\\" #else |