![]() |
|||||
|
00001 /* ///////////////////////////////////////////////////////////////////////// 00002 * File: unixem/sys/mman.h 00003 * 00004 * Purpose: Declaration of the mmap() and munmap() API functions. 00005 * 00006 * Created: 18th December 2003 00007 * Updated: 13th August 2010 00008 * 00009 * Home: http://synesis.com.au/software/ 00010 * 00011 * Copyright (c) 2003-2010, Matthew Wilson and Synesis Software 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are 00016 * met: 00017 * 00018 * - Redistributions of source code must retain the above copyright notice, 00019 * this list of conditions and the following disclaimer. 00020 * - Redistributions in binary form must reproduce the above copyright 00021 * notice, this list of conditions and the following disclaimer in the 00022 * documentation and/or other materials provided with the distribution. 00023 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the 00024 * names of any contributors may be used to endorse or promote products 00025 * derived from this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00028 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00029 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00030 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00031 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00032 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00033 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00034 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00035 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00036 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00037 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 * 00039 * ////////////////////////////////////////////////////////////////////// */ 00040 00041 00047 #ifndef SYNSOFT_UNIXEM_INCL_UNIXEM_SYS_H_MMAP 00048 #define SYNSOFT_UNIXEM_INCL_UNIXEM_SYS_H_MMAP 00049 00050 #ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION 00051 # define SYNSOFT_UNIXEM_VER_UNIXEM_SYS_H_MMAP_MAJOR 3 00052 # define SYNSOFT_UNIXEM_VER_UNIXEM_SYS_H_MMAP_MINOR 0 00053 # define SYNSOFT_UNIXEM_VER_UNIXEM_SYS_H_MMAP_REVISION 1 00054 # define SYNSOFT_UNIXEM_VER_UNIXEM_SYS_H_MMAP_EDIT 24 00055 #endif /* !UNIXEM_DOCUMENTATION_SKIP_SECTION */ 00056 00057 /* ///////////////////////////////////////////////////////////////////////// 00058 * Includes 00059 */ 00060 00061 #include <stddef.h> /* for size_t */ 00062 #include <sys/stat.h> /* for off_t */ 00063 #include <sys/types.h> 00064 00065 /* ////////////////////////////////////////////////////////////////////// */ 00066 00077 /* ////////////////////////////////////////////////////////////////////// */ 00078 00079 #ifndef _WIN32 00080 # error This file is only currently defined for compilation on Win32 systems 00081 #endif /* _WIN32 */ 00082 00083 /* ///////////////////////////////////////////////////////////////////////// 00084 * Constants and definitions 00085 */ 00086 00087 #define UNIXEM_PROT_READ (0x01) 00088 #define UNIXEM_PROT_WRITE (0x02) 00089 #define UNIXEM_PROT_EXEC (0x04) 00090 #define UNIXEM_PROT_NONE (0x00) 00092 #define UNIXEM_MAP_PRIVATE (0x02) 00093 #define UNIXEM_MAP_ANONYMOUS (0x20) 00094 #define UNIXEM_MAP_FIXED (0x10) 00096 #ifdef _WIN64 00097 # if defined(__GNUC__) 00098 # define UNIXEM_MAP_FAILED ((void*)(long long)~0) 00099 # elif defined(_MSC_VER) 00100 # define UNIXEM_MAP_FAILED ((void*)(__int64)~0) 00101 # else /* ? compiler */ 00102 # error Currently only GCC and VC++ compilers are recognised for Win64 00103 # endif /* compiler */ 00104 #else /* ? _WIN64 */ 00105 # define UNIXEM_MAP_FAILED ((void*)~0) 00106 #endif /* _WIN64 */ 00107 00108 /* ///////////////////////////////////////////////////////////////////////// 00109 * API functions 00110 */ 00111 00112 #ifdef __cplusplus 00113 extern "C" 00114 { 00115 #endif /* __cplusplus */ 00116 00135 void* unixem_mmap( 00136 void* addr 00137 , size_t len 00138 , int prot 00139 , int flags 00140 , int fd 00141 , off_t offset 00142 ); 00143 00157 int unixem_munmap( 00158 void* addr 00159 , size_t len 00160 ); 00161 00170 int unixem_msync( 00171 void* addr 00172 , size_t len 00173 , int flags 00174 ); 00175 00176 #ifdef __cplusplus 00177 } /* extern "C" */ 00178 #endif /* __cplusplus */ 00179 00180 /* ////////////////////////////////////////////////////////////////////// */ 00181 00184 /* ////////////////////////////////////////////////////////////////////// */ 00185 00186 #endif /* SYNSOFT_UNIXEM_INCL_UNIXEM_SYS_H_MMAP */ 00187 00188 /* ///////////////////////////// end of file //////////////////////////// */
|
UNIX Emulation for Win32 Libraries documentation © Synesis Software Pty Ltd, 2002-2010 |