wibble 1.1
mmap.h
Go to the documentation of this file.
1#ifndef WIBBLE_SYS_MMAP_H
2#define WIBBLE_SYS_MMAP_H
3
8/*
9 * Copyright (C) 2006--2008 Enrico Zini <enrico@enricozini.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <wibble/sys/macros.h>
27#include <string>
28
29namespace wibble {
30namespace sys {
31#if __cplusplus >= 201103L
32inline namespace v1 {
33#endif
44struct MMap
45{
46public:
48 MMap(const MMap& mmap);
49 MMap(const std::string& filename);
51
53
54 void map(const std::string& filename);
55 void unmap();
56
57 std::string filename;
58 size_t size;
59 int fd;
60 const char* buf;
61
62};
63
64#if __cplusplus >= 201103L
65}
66#endif
67}
68}
69
70// vim:set ts=4 sw=4:
71#endif
Definition amorph.h:17
Definition amorph.h:30
Map a file into memory.
Definition mmap.h:45
size_t size
Definition mmap.h:58
const char * buf
Definition mmap.h:60
MMap(const std::string &filename)
MMap & operator=(const MMap &mmap)
std::string filename
Definition mmap.h:57
void map(const std::string &filename)
int fd
Definition mmap.h:59
MMap(const MMap &mmap)