summaryrefslogtreecommitdiff
path: root/src/lib/fs/mmap.c
diff options
context:
space:
mode:
authorAmreshVenugopal <amresh.venugopal@gmail.com>2019-09-17 00:11:18 +0530
committerteor <teor@torproject.org>2019-10-21 13:54:55 +1000
commit6413b2102f4ac968092a6b1bc58b78d4bb7f90de (patch)
tree9cbe813f849e1db7685f8d94b839f5e4c164247c /src/lib/fs/mmap.c
parent6846d14868b561e51e5f6afc27a1f1e8a0da94ce (diff)
downloadtor-6413b2102f4ac968092a6b1bc58b78d4bb7f90de.tar.gz
tor-6413b2102f4ac968092a6b1bc58b78d4bb7f90de.zip
control: Add GETINFO support for dumping microdesc consensus
- Allows control port to read microdesc consensus using: GETINFO dir/status-vote/microdesc/consensus add: Helper function `getinfo_helper_current_consensus` test: check if GETINFO commands return expected consensus data. Resolves 31684.
Diffstat (limited to 'src/lib/fs/mmap.c')
-rw-r--r--src/lib/fs/mmap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/fs/mmap.c b/src/lib/fs/mmap.c
index f71c0cff7a..9d50a476bd 100644
--- a/src/lib/fs/mmap.c
+++ b/src/lib/fs/mmap.c
@@ -42,8 +42,8 @@
* failure, return NULL. Sets errno properly, using ERANGE to mean
* "empty file". Must only be called on trusted Tor-owned files, as changing
* the underlying file's size causes unspecified behavior. */
-tor_mmap_t *
-tor_mmap_file(const char *filename)
+MOCK_IMPL(tor_mmap_t *,
+tor_mmap_file,(const char *filename))
{
int fd; /* router file */
char *string;
@@ -111,8 +111,8 @@ tor_mmap_file(const char *filename)
}
/** Release storage held for a memory mapping; returns 0 on success,
* or -1 on failure (and logs a warning). */
-int
-tor_munmap_file(tor_mmap_t *handle)
+MOCK_IMPL(int,
+tor_munmap_file,(tor_mmap_t *handle))
{
int res;
@@ -132,8 +132,8 @@ tor_munmap_file(tor_mmap_t *handle)
return res;
}
#elif defined(_WIN32)
-tor_mmap_t *
-tor_mmap_file(const char *filename)
+MOCK_IMPL(tor_mmap_t *,
+tor_mmap_file,(const char *filename))
{
TCHAR tfilename[MAX_PATH]= {0};
tor_mmap_t *res = tor_malloc_zero(sizeof(tor_mmap_t));
@@ -213,8 +213,8 @@ tor_mmap_file(const char *filename)
}
/* Unmap the file, and return 0 for success or -1 for failure */
-int
-tor_munmap_file(tor_mmap_t *handle)
+MOCK_IMPL(int,
+tor_munmap_file,(tor_mmap_t *handle))
{
if (handle == NULL)
return 0;