root/eaccelerator/branches/0.9.4/mm.h

Revision 123, 3.6 kB (checked in by zoeloelip, 3 years ago)

* Renamed some macros from MMC (mmcache) to EA (eg MMCG is now EAG)
* Added eA file header to mm.c, mm.h and x86-spinlocks.h
* Readded a hack to the loader to prevent zend2 segfaults

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2    +----------------------------------------------------------------------+
3    | eAccelerator project                                                 |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2004 - 2005 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    | Author(s): Dmitry Stogov <dstogov@users.sourceforge.net>             |
26    +----------------------------------------------------------------------+
27    $Id$
28 */
29
30 /* libmm replacement */
31
32 #ifndef INCLUDED_MM_H
33 #define INCLUDED_MM_H
34
35 #include <sys/types.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #ifndef MM_PRIVATE
42 #  ifdef MM
43 #    undef MM
44 #  endif
45 #  define MM void
46 #endif
47
48 #define MM_LOCK_RW 1
49 #define MM_LOCK_RD 0
50
51 #if (_MSC_VER < 1400)
52 MM*    _mm_create(size_t size, const char* key);
53 void   _mm_set_attach(MM* mm, void* attach_addr);
54 void*  _mm_attach(size_t size, const char* key);
55 size_t _mm_size(MM* mm);
56 void   _mm_destroy(MM* mm);
57 int    _mm_lock(MM* mm, int kind);
58 int    _mm_unlock(MM* mm);
59 size_t _mm_available(MM* mm);
60 size_t _mm_maxsize(MM* mm);
61 void*  _mm_malloc_lock(MM* mm, size_t size);
62 void   _mm_free_lock(MM* mm, void* p);
63 void*  _mm_malloc_nolock(MM* mm, size_t size);
64 void   _mm_free_nolock(MM* mm, void* p);
65 size_t _mm_sizeof(MM* mm, void* x);
66 #endif
67
68
69 const char* mm_shm_type();
70 const char* mm_sem_type();
71
72 #define MM_PROT_NONE  1
73 #define MM_PROT_READ  2
74 #define MM_PROT_WRITE 4
75 #define MM_PROT_EXEC  8
76
77 int mm_protect(MM* mm, int mode);
78
79 #if (_MSC_VER < 1400)
80 #define mm_create(A, B)        _mm_create(A, B)
81 #define mm_set_attach(A, B)    _mm_set_attach(A, B)
82 #define mm_attach(A, B)        _mm_attach(A, B)
83 #define mm_size(A)             _mm_size(A)
84 #define mm_destroy(A)          _mm_destroy(A)
85 #define mm_lock(A, B)          _mm_lock(A, B)
86 #define mm_unlock(A)           _mm_unlock(A)
87 #define mm_available(A)        _mm_available(A)
88 #define mm_maxsize(A)          _mm_maxsize(A)
89 #define mm_malloc_lock(A, B)   _mm_malloc_lock(A, B)
90 #define mm_free_lock(A, B)     _mm_free_lock(A, B)
91 #define mm_malloc_nolock(A, B) _mm_malloc_nolock(A, B)
92 #define mm_free_nolock(A, B)   _mm_free_nolock(A, B)
93 #define mm_sizeof(A, B)        _mm_sizeof(A, B)
94 #endif
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif
Note: See TracBrowser for help on using the browser.