tor  0.4.2.0-alpha-dev
mmap.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
12 #ifndef TOR_MMAP_H
13 #define TOR_MMAP_H
14 
15 #include "lib/cc/compat_compiler.h"
16 #include <stddef.h>
17 
18 #ifdef _WIN32
19 #include <windef.h>
20 #endif
21 
24 typedef struct tor_mmap_t {
25  const char *data;
26  size_t size;
28  /* None of the fields below should be accessed from outside compat.c */
29 #ifdef HAVE_MMAP
30  size_t mapping_size;
32 #elif defined _WIN32
33  HANDLE mmap_handle;
34 #endif /* defined(HAVE_MMAP) || ... */
35 
36 } tor_mmap_t;
37 
38 tor_mmap_t *tor_mmap_file(const char *filename);
39 int tor_munmap_file(tor_mmap_t *handle);
40 
41 #endif /* !defined(TOR_MMAP_H) */
size_t size
Definition: mmap.h:26
Utility macros to handle different features and behavior in different compilers.
const char * data
Definition: mmap.h:25
struct tor_mmap_t tor_mmap_t