"Fossies" - the Fresh Open Source Software Archive

Member "tor-0.4.1.6/src/lib/fs/mmap.h" (10 Jun 2019, 1081 Bytes) of package /linux/misc/tor-0.4.1.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "mmap.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 0.4.0.5_vs_0.4.1.5.

    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 
    6 /**
    7  * \file mmap.h
    8  *
    9  * \brief Header for mmap.c
   10  **/
   11 
   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 
   22 /** Represents an mmaped file. Allocated via tor_mmap_file; freed with
   23  * tor_munmap_file. */
   24 typedef struct tor_mmap_t {
   25   const char *data; /**< Mapping of the file's contents. */
   26   size_t size; /**< Size of the file. */
   27 
   28   /* None of the fields below should be accessed from outside compat.c */
   29 #ifdef HAVE_MMAP
   30   size_t mapping_size; /**< Size of the actual mapping. (This is this file
   31                         * size, rounded up to the nearest page.) */
   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) */