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