MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ndb_global.h
1
/*
2
Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
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 as published by
6
the Free Software Foundation; version 2 of the License.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
18
#ifndef NDB_GLOBAL_H
19
#define NDB_GLOBAL_H
20
21
#ifdef _WIN32
22
/* Workaround for Bug#32082: VOID refdefinition results in compile errors */
23
#ifndef DONT_DEFINE_VOID
24
#define DONT_DEFINE_VOID
25
#endif
26
#endif
27
28
#include <my_global.h>
29
30
#ifdef HAVE_NDB_CONFIG_H
31
#include "ndb_config.h"
32
#endif
33
34
#include <mysql_com.h>
35
#include <ndb_types.h>
36
37
#ifndef NDB_PORT
38
/* Default port used by ndb_mgmd */
39
#define NDB_PORT 1186
40
#endif
41
42
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
43
#define NDB_WIN32 1
44
#define NDB_WIN 1
45
#define PATH_MAX 256
46
#define DIR_SEPARATOR "\\"
47
48
/* Disable a few compiler warnings on Windows */
49
/* 4355: 'this': used in base member initializer list */
50
#pragma warning(disable: 4355)
51
52
#else
53
#undef NDB_WIN32
54
#undef NDB_WIN
55
#define DIR_SEPARATOR "/"
56
#endif
57
58
#if ! (NDB_SIZEOF_CHAR == SIZEOF_CHAR)
59
#error "Invalid define for Uint8"
60
#endif
61
62
#if ! (NDB_SIZEOF_INT == SIZEOF_INT)
63
#error "Invalid define for Uint32"
64
#endif
65
66
#if ! (NDB_SIZEOF_LONG_LONG == SIZEOF_LONG_LONG)
67
#error "Invalid define for Uint64"
68
#endif
69
70
#include <signal.h>
71
72
#ifdef _AIX
73
#undef _H_STRINGS
74
#endif
75
#include <m_string.h>
76
77
#ifndef NDB_REMOVE_BZERO
78
/*
79
Make it possible to use bzero in NDB although
80
MySQL headers redefines it to an invalid symbol
81
*/
82
#ifdef bzero
83
#undef bzero
84
#endif
85
86
#ifdef HAVE_STRINGS_H
87
#include <strings.h>
88
#endif
89
90
#if !defined(bzero) && !defined(HAVE_BZERO)
91
#define bzero(A,B) memset((A),0,(B))
92
#endif
93
#endif
94
95
#include <m_ctype.h>
96
#include <ctype.h>
97
98
#ifdef HAVE_STDARG_H
99
#include <stdarg.h>
100
#endif
101
102
#ifdef TIME_WITH_SYS_TIME
103
#include <time.h>
104
#endif
105
106
#ifdef HAVE_FCNTL_H
107
#include <fcntl.h>
108
#endif
109
110
#include <sys/stat.h>
111
112
#ifdef HAVE_SYS_PARAM_H
113
#include <sys/param.h>
114
#endif
115
116
#ifdef HAVE_SYS_RESOURCE_H
117
#include <sys/resource.h>
118
#endif
119
120
#ifdef HAVE_SYS_WAIT_H
121
#include <sys/wait.h>
122
#endif
123
124
#ifdef HAVE_SYS_MMAN_H
125
#include <sys/mman.h>
126
#endif
127
128
#ifndef HAVE_STRDUP
129
extern
char
* strdup(
const
char
*s);
130
#endif
131
132
static
const
char
table_name_separator =
'/'
;
133
134
#if defined(_AIX) || defined(WIN32) || defined(NDB_VC98)
135
#define STATIC_CONST(x) enum { x }
136
#else
137
#define STATIC_CONST(x) static const Uint32 x
138
#endif
139
140
#ifdef __cplusplus
141
extern
"C"
{
142
#endif
143
144
#include <assert.h>
145
146
#ifdef __cplusplus
147
}
148
#endif
149
150
#include "ndb_init.h"
151
152
#ifndef PATH_MAX
153
#define PATH_MAX 1024
154
#endif
155
156
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
157
#define LINT_SET_PTR = {0,0}
158
#else
159
#define LINT_SET_PTR
160
#endif
161
162
#ifndef MIN
163
#define MIN(x,y) (((x)<(y))?(x):(y))
164
#endif
165
166
#ifndef MAX
167
#define MAX(x,y) (((x)>(y))?(x):(y))
168
#endif
169
170
/*
171
Dont allow use of min() or max() macros
172
- in order to enforce forward compatibilty
173
*/
174
175
#ifdef min
176
#undef min
177
#endif
178
179
#ifdef max
180
#undef max
181
#endif
182
183
#define NDB_O_DIRECT_WRITE_ALIGNMENT 512
184
185
#ifndef STATIC_ASSERT
186
#if defined VM_TRACE
187
192
#define STATIC_ASSERT(expr) { char static_assert[(expr)? 1 : 0] = {'\0'}; if (static_assert[0]) {}; }
193
#else
194
#define STATIC_ASSERT(expr)
195
#endif
196
#endif
197
198
#define NDB_ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
199
200
201
/*
202
NDB_STATIC_ASSERT(expr)
203
- Check coding assumptions during compile time
204
by laying out code that will generate a compiler error
205
if the expression is false.
206
*/
207
208
#if (_MSC_VER > 1500) || (defined __GXX_EXPERIMENTAL_CXX0X__)
209
210
/*
211
Prefer to use the 'static_assert' function from C++0x
212
to get best error message
213
*/
214
#define NDB_STATIC_ASSERT(expr) static_assert(expr, #expr)
215
216
#else
217
218
/*
219
Fallback to use home grown solution
220
(i.e use mysys version)
221
*/
222
223
#define NDB_STATIC_ASSERT(expr) compile_time_assert(expr)
224
225
#endif
226
227
228
#if (_MSC_VER > 1500)
229
#define HAVE___HAS_TRIVIAL_CONSTRUCTOR
230
#define HAVE___IS_POD
231
#endif
232
233
#ifdef HAVE___HAS_TRIVIAL_CONSTRUCTOR
234
#define ASSERT_TYPE_HAS_CONSTRUCTOR(x) \
235
NDB_STATIC_ASSERT(!__has_trivial_constructor(x))
236
#else
237
#define ASSERT_TYPE_HAS_CONSTRUCTOR(x)
238
#endif
239
246
#ifdef HAVE___HAS_TRIVIAL_CONSTRUCTOR
247
#define NDB_ASSERT_POD(x) \
248
NDB_STATIC_ASSERT(__has_trivial_constructor(x))
249
#else
250
#define NDB_ASSERT_POD(x)
251
#endif
252
256
#if (GCC_VERSION >= 2005)
257
#define ATTRIBUTE_NORETURN __attribute__((noreturn))
258
#else
259
#define ATTRIBUTE_NORETURN
260
#endif
261
265
#if (GCC_VERSION >= 3001)
266
#define ATTRIBUTE_NOINLINE __attribute__((noinline))
267
#else
268
#define ATTRIBUTE_NOINLINE
269
#endif
270
271
/*
272
* require is like a normal assert, only it's always on (eg. in release)
273
*/
274
C_MODE_START
276
typedef
int(*RequirePrinter)(
const
char
*
fmt
, ...);
277
void
require_failed(
int
exitcode, RequirePrinter p,
278
const
char
* expr,
const
char
*
file
,
int
line);
279
int
ndbout_printer(
const
char
*
fmt
, ...);
280
C_MODE_END
281
/*
282
* this allows for an exit() call if exitcode is not zero
283
* and takes a Printer to print the error
284
*/
285
#define require_exit_or_core_with_printer(v, exitcode, printer) \
286
do { if (likely(!(!(v)))) break; \
287
require_failed((exitcode), (printer), #v, __FILE__, __LINE__); \
288
} while (0)
289
290
/*
291
* this allows for an exit() call if exitcode is not zero
292
*/
293
#define require_exit_or_core(v, exitcode) \
294
require_exit_or_core_with_printer((v), (exitcode), 0)
295
296
/*
297
* this require is like a normal assert. (only it's always on)
298
*/
299
#define require(v) require_exit_or_core_with_printer((v), 0, 0)
300
301
#endif
storage
ndb
include
ndb_global.h
Generated on Sat Nov 9 2013 01:26:58 for MySQL 5.6.14 Source Code Document by
1.8.1.2