1 /*
2    Copyright (c) 2003, 2021, Oracle and/or its affiliates.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 
25 #ifndef NDB_MEM_H
26 #define NDB_MEM_H
27 
28 #include <ndb_global.h>
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 
35 /**
36  * NdbMem_Create
37  * Create and initalise internal data structures for Ndb
38  */
39 void NdbMem_Create(void);
40 
41 
42 /**
43  * NdbMem_Destroy
44  * Destroy all memory allocated by NdbMem
45  */
46 void NdbMem_Destroy(void);
47 
48 /**
49  * NdbMem_Allocate
50  * Allocate size of memory
51  * @parameter size - size in bytes of memory to allocate
52  * @returns - pointer to memory if succesful otherwise NULL
53  */
54 void* NdbMem_Allocate(size_t size);
55 
56 /**
57  * NdbMem_AllocateAlign
58  * Allocate size of memory
59  * @parameter size - size in bytes of memory to allocate
60  * @paramter alignment - byte boundary to align the data at
61  * @returns - pointer to memory if succesful otherwise NULL
62  */
63 void* NdbMem_AllocateAlign(size_t size, size_t alignment);
64 
65 
66 /**
67  * NdbMem_Free
68  *  Free the memory that ptr points to
69  *  @parameter ptr - pointer to the memory to free
70  */
71 void NdbMem_Free(void* ptr);
72 
73 /**
74  * NdbMem_MemLockAll
75  *   Locks virtual memory in main memory
76  */
77 int NdbMem_MemLockAll(int);
78 
79 /**
80  * NdbMem_MemUnlockAll
81  *   Unlocks virtual memory
82  */
83 int NdbMem_MemUnlockAll(void);
84 
85 /**
86  * Memlock region
87  */
88 int NdbMem_MemLock(const void * ptr, size_t len);
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif
95