| 1 | /* |
|---|
| 2 | +----------------------------------------------------------------------+ |
|---|
| 3 | | eAccelerator project | |
|---|
| 4 | +----------------------------------------------------------------------+ |
|---|
| 5 | | Copyright (c) 2004 - 2006 eAccelerator | |
|---|
| 6 | | http://eaccelerator.net | |
|---|
| 7 | +----------------------------------------------------------------------+ |
|---|
| 8 | | This program is free software; you can redistribute it and/or | |
|---|
| 9 | | modify it under the terms of the GNU General Public License | |
|---|
| 10 | | as published by the Free Software Foundation; either version 2 | |
|---|
| 11 | | of the License, or (at your option) any later version. | |
|---|
| 12 | | | |
|---|
| 13 | | This program is distributed in the hope that it will be useful, | |
|---|
| 14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|---|
| 15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|---|
| 16 | | GNU General Public License for more details. | |
|---|
| 17 | | | |
|---|
| 18 | | You should have received a copy of the GNU General Public License | |
|---|
| 19 | | along with this program; if not, write to the Free Software | |
|---|
| 20 | | Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
|---|
| 21 | | MA 02111-1307, USA. | |
|---|
| 22 | | | |
|---|
| 23 | | A copy is availble at http://www.gnu.org/copyleft/gpl.txt | |
|---|
| 24 | +----------------------------------------------------------------------+ |
|---|
| 25 | $Id$ |
|---|
| 26 | */ |
|---|
| 27 | |
|---|
| 28 | /* libmm replacement */ |
|---|
| 29 | |
|---|
| 30 | #ifndef INCLUDED_MM_H |
|---|
| 31 | #define INCLUDED_MM_H |
|---|
| 32 | |
|---|
| 33 | #include <sys/types.h> |
|---|
| 34 | |
|---|
| 35 | #ifdef __cplusplus |
|---|
| 36 | extern "C" { |
|---|
| 37 | #endif |
|---|
| 38 | |
|---|
| 39 | #ifndef MM_PRIVATE |
|---|
| 40 | # ifdef MM |
|---|
| 41 | # undef MM |
|---|
| 42 | # endif |
|---|
| 43 | # define MM void |
|---|
| 44 | #endif |
|---|
| 45 | |
|---|
| 46 | #define MM_LOCK_RW 1 |
|---|
| 47 | #define MM_LOCK_RD 0 |
|---|
| 48 | |
|---|
| 49 | #if (_MSC_VER < 1400) |
|---|
| 50 | MM* _mm_create(size_t size, const char* key); |
|---|
| 51 | void _mm_set_attach(MM* mm, void* attach_addr); |
|---|
| 52 | void* _mm_attach(size_t size, const char* key); |
|---|
| 53 | size_t _mm_size(MM* mm); |
|---|
| 54 | void _mm_destroy(MM* mm); |
|---|
| 55 | int _mm_lock(MM* mm, int kind); |
|---|
| 56 | int _mm_unlock(MM* mm); |
|---|
| 57 | size_t _mm_available(MM* mm); |
|---|
| 58 | size_t _mm_maxsize(MM* mm); |
|---|
| 59 | void* _mm_malloc_lock(MM* mm, size_t size); |
|---|
| 60 | void _mm_free_lock(MM* mm, void* p); |
|---|
| 61 | void* _mm_malloc_nolock(MM* mm, size_t size); |
|---|
| 62 | void _mm_free_nolock(MM* mm, void* p); |
|---|
| 63 | size_t _mm_sizeof(MM* mm, void* x); |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | const char* mm_shm_type(); |
|---|
| 68 | const char* mm_sem_type(); |
|---|
| 69 | |
|---|
| 70 | #define MM_PROT_NONE 1 |
|---|
| 71 | #define MM_PROT_READ 2 |
|---|
| 72 | #define MM_PROT_WRITE 4 |
|---|
| 73 | #define MM_PROT_EXEC 8 |
|---|
| 74 | |
|---|
| 75 | int mm_protect(MM* mm, int mode); |
|---|
| 76 | |
|---|
| 77 | #if (_MSC_VER < 1400) |
|---|
| 78 | #define mm_create(A, B) _mm_create(A, B) |
|---|
| 79 | #define mm_set_attach(A, B) _mm_set_attach(A, B) |
|---|
| 80 | #define mm_attach(A, B) _mm_attach(A, B) |
|---|
| 81 | #define mm_size(A) _mm_size(A) |
|---|
| 82 | #define mm_destroy(A) _mm_destroy(A) |
|---|
| 83 | #define mm_lock(A, B) _mm_lock(A, B) |
|---|
| 84 | #define mm_unlock(A) _mm_unlock(A) |
|---|
| 85 | #define mm_available(A) _mm_available(A) |
|---|
| 86 | #define mm_maxsize(A) _mm_maxsize(A) |
|---|
| 87 | #define mm_malloc_lock(A, B) _mm_malloc_lock(A, B) |
|---|
| 88 | #define mm_free_lock(A, B) _mm_free_lock(A, B) |
|---|
| 89 | #define mm_malloc_nolock(A, B) _mm_malloc_nolock(A, B) |
|---|
| 90 | #define mm_free_nolock(A, B) _mm_free_nolock(A, B) |
|---|
| 91 | #define mm_sizeof(A, B) _mm_sizeof(A, B) |
|---|
| 92 | #endif |
|---|
| 93 | |
|---|
| 94 | #ifdef __cplusplus |
|---|
| 95 | } |
|---|
| 96 | #endif |
|---|
| 97 | |
|---|
| 98 | #endif |
|---|