univ.i 4.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/***************************************************************************
Version control for database, common definitions, and include files

(c) 1994 - 2000 Innobase Oy

Created 1/20/1994 Heikki Tuuri
****************************************************************************/

#ifndef univ_i
#define univ_i

12 13
#undef UNIV_INTEL_X86

14
#if (defined(_WIN32) || defined(_WIN64)) && !defined(MYSQL_SERVER)
15 16 17
#define __WIN__
#include <windows.h>

18 19 20 21 22 23
/* If you want to check for errors with compiler level -W4,
comment out the above include of windows.h and let the following defines
be defined:
#define HANDLE void*
#define CRITICAL_SECTION	ulint
*/
24

25 26 27 28
#ifdef _NT_
#define __NT__
#endif

29 30 31
#else
/* The Unix version */

32
/* Most C compilers other than gcc do not know 'extern inline' */ 
33
#if !defined(__GNUC__) && !defined(__WIN__)
34 35 36
#define UNIV_MUST_NOT_INLINE
#endif

37 38 39 40 41 42
/* Include two header files from MySQL to make the Unix flavor used
in compiling more Posix-compatible. We assume that 'innobase' is a
subdirectory of 'mysql'. */
#include <global.h>
#include <my_pthread.h>

43
#ifndef __WIN__
44 45
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
#include <sys/stat.h>
46
#endif
47

48 49 50 51 52 53
#undef PACKAGE
#undef VERSION

/* Include the header file generated by GNU autoconf */
#include "../ib_config.h"

54 55 56 57
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif

58 59 60 61 62 63 64 65 66
#ifdef HAVE_PREAD
#define HAVE_PWRITE
#endif

#endif

/*			DEBUG VERSION CONTROL
			===================== */
/* Make a non-inline debug version */
67
/*
68 69 70 71 72 73 74 75 76
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
#define UNIV_SEARCH_DEBUG

#define UNIV_IBUF_DEBUG

#define UNIV_SYNC_PERF_STAT
#define UNIV_SEARCH_PERF_STAT
77 78

#define UNIV_DEBUG_FILE_ACCESSES
79
*/
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
#define UNIV_LIGHT_MEM_DEBUG

#define YYDEBUG			1

/*
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
*/
			/* the above option prevents forcing of log to disk
			at a buffer page write: it should be tested with this
			option off; also some ibuf tests are suppressed */
/*
#define UNIV_BASIC_LOG_DEBUG
*/
			/* the above option enables basic recovery debugging:
			new allocated file pages are reset */

97
#if (!defined(UNIV_DEBUG) && !defined(INSIDE_HA_INNOBASE_CC) && !defined(UNIV_MUST_NOT_INLINE))
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
/* Definition for inline version */

#ifdef __WIN__
#define UNIV_INLINE  	__inline
#else
/* config.h contains the right def for 'inline' for the current compiler */
#define UNIV_INLINE  extern inline

#endif

#else
/* If we want to compile a noninlined version we use the following macro
definitions: */

#define UNIV_NONINL
#define UNIV_INLINE

#endif	/* UNIV_DEBUG */

#ifdef _WIN32
#define UNIV_WORD_SIZE		4
#elif defined(_WIN64)
#define UNIV_WORD_SIZE		8
#else
122 123
/* MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
#define UNIV_WORD_SIZE		SIZEOF_LONG
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
#endif

/* The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
#define UNIV_MEM_ALIGNMENT      8

/* The following alignment is used in aligning lints etc. */
#define UNIV_WORD_ALIGNMENT	UNIV_WORD_SIZE

/*
			DATABASE VERSION CONTROL
			========================
*/

/* The universal page size of the database */
#define UNIV_PAGE_SIZE          (2 * 8192) /* NOTE! Currently, this has to be a
					power of 2 */
/* The 2-logarithm of UNIV_PAGE_SIZE: */
#define UNIV_PAGE_SIZE_SHIFT	14					

/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM	32

/*
			UNIVERSAL TYPE DEFINITIONS
			==========================
*/

/* Note that inside MySQL 'byte' is defined as char on Linux! */
#define byte	unsigned char

/* Another basic type we use is unsigned long integer which is intended to be
equal to the word size of the machine. */

typedef unsigned long int	ulint;

typedef long int		lint;

162 163 164 165 166 167
#ifdef __WIN__
typedef __int64       ib_longlong;
#else
typedef longlong ib_longlong;
#endif

168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
/* The following type should be at least a 64-bit floating point number */
typedef double		utfloat;

/* The 'undefined' value for a ulint */
#define ULINT_UNDEFINED		((ulint)(-1))

/* The undefined 32-bit unsigned integer */
#define	ULINT32_UNDEFINED	0xFFFFFFFF

/* Maximum value for a ulint */
#define ULINT_MAX		((ulint)(-2))

/* This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
#define ibool	ulint

#ifndef TRUE

#define TRUE    1
#define FALSE   0

#endif

/* The following number as the length of a logical field means that the field
has the SQL NULL as its value. */
#define UNIV_SQL_NULL 	ULINT_UNDEFINED

195 196 197 198 199
/* The following definition of __FILE__ removes compiler warnings
associated with const char* / char* mismatches with __FILE__ */

#define IB__FILE__	((char*)__FILE__)

200 201 202 203 204 205
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.h"

#endif