Swarm-NG  1.1
fakemmap.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Mario Juric *
3  * mjuric@astro.Princeton.EDU *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
33 #include <stdlib.h>
34 
35 #ifdef _WIN32
36 #include <wchar.h>
37 #include <io.h>
38 #include <fcntl.h>
39 inline int getpagesize() { return 4096; }
40 #else
41 #include <unistd.h>
42 #endif
43 
44 
45 void *fakemmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
46 int fakemunmap(void *addr, size_t length);
47 int fakemsync(void *addr, size_t length, int flags);
48 
49 
50 #define PROT_READ 0x1 /* Page can be read. */
51 #define PROT_WRITE 0x2 /* Page can be written. */
52 #define PROT_EXEC 0x4 /* Page can be executed. */
53 #define PROT_NONE 0x0 /* Page can not be accessed. */
54 #define MAP_FAILED ((void *) -1)
55 #define MAP_SHARED 0x01 /* Share changes. */
56 #define MAP_PRIVATE 0x02 /* Changes are private. */
57 /* Flags to `msync'. */
58 #define MS_ASYNC 1 /* Sync memory asynchronously. */
59 #define MS_SYNC 4 /* Synchronous memory sync. */
60 #define MS_INVALIDATE 2 /* Invalidate the caches. */
61