481.2.1
by Monty Taylor
Split iocache definitions into their own header. |
1 |
/* - mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 MySQL
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
1
by brian
clean slate |
20 |
|
21 |
#ifndef _my_sys_h
|
|
22 |
#define _my_sys_h
|
|
23 |
||
12.4.2
by Stewart Smith
my_errno => errno |
24 |
#include <errno.h> |
25 |
#define my_errno (errno)
|
|
26 |
||
212.5.13
by Monty Taylor
Moved my_sys/my_pthread/my_nosys and mysys_err to mysys. |
27 |
#include <mysys/my_pthread.h> |
1
by brian
clean slate |
28 |
|
212.5.18
by Monty Taylor
Moved m_ctype, m_string and my_bitmap. Removed t_ctype. |
29 |
#include <mystrings/m_ctype.h> /* for CHARSET_INFO */ |
1
by brian
clean slate |
30 |
#include <stdarg.h> |
212.5.32
by Monty Taylor
Moved typelib to mysys. |
31 |
#include <mysys/typelib.h> |
481.2.2
by Monty Taylor
Split out aio_result.h into its own header. |
32 |
#include <mysys/aio_result.h> |
1
by brian
clean slate |
33 |
|
492.1.1
by Monty Taylor
Moved MEM_ROOT functions into my_alloc.h. |
34 |
#include <mysys/my_alloc.h> |
35 |
||
520.4.43
by mordred
A set of Solaris fixes. |
36 |
/* Sun Studio does not inject this into main namespace yet */
|
37 |
#if defined(__cplusplus)
|
|
38 |
using std::FILE; |
|
39 |
#endif
|
|
40 |
||
1
by brian
clean slate |
41 |
#define MY_INIT(name); { my_progname= name; my_init(); }
|
42 |
||
43 |
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ |
|
44 |
#define NRERRBUFFS (2) /* Buffers for parameters */ |
|
45 |
#define MY_FILE_ERROR ((size_t) -1)
|
|
46 |
||
47 |
/* General bitmaps for my_func's */
|
|
48 |
#define MY_FFNF 1 /* Fatal if file not found */ |
|
49 |
#define MY_FNABP 2 /* Fatal if not all bytes read/writen */ |
|
50 |
#define MY_NABP 4 /* Error if not all bytes read/writen */ |
|
51 |
#define MY_FAE 8 /* Fatal if any error */ |
|
52 |
#define MY_WME 16 /* Write message on error */ |
|
53 |
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ |
|
54 |
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ |
|
55 |
#define MY_SYNC_DIR 1024 /* my_create/delete/rename: sync directory */ |
|
56 |
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ |
|
57 |
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ |
|
58 |
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ |
|
59 |
#define MY_COPYTIME 64 /* my_redel() copys time */ |
|
60 |
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ |
|
61 |
#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ |
|
62 |
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ |
|
63 |
#define MY_REDEL_MAKE_BACKUP 256
|
|
64 |
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ |
|
65 |
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ |
|
66 |
#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ |
|
67 |
#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ |
|
68 |
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ |
|
69 |
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ |
|
70 |
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ |
|
71 |
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ |
|
72 |
||
73 |
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ |
|
74 |
#define MY_GIVE_INFO 2 /* Give time info about process*/ |
|
75 |
||
76 |
#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ |
|
77 |
#define MY_REMOVE_OPTION 1
|
|
78 |
#define MY_REMOVE_SECTION 2
|
|
79 |
||
80 |
#define ME_HIGHBYTE 8 /* Shift for colours */ |
|
81 |
#define ME_NOCUR 1 /* Don't use curses message */ |
|
82 |
#define ME_OLDWIN 2 /* Use old window */ |
|
83 |
#define ME_BELL 4 /* Ring bell then printing message */ |
|
84 |
#define ME_HOLDTANG 8 /* Don't delete last keys */ |
|
85 |
#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ |
|
86 |
#define ME_WAITTANG 32 /* Wait for a user action */ |
|
87 |
#define ME_NOREFRESH 64 /* Dont refresh screen */ |
|
88 |
#define ME_NOINPUT 128 /* Dont use the input libary */ |
|
89 |
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ |
|
90 |
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
|
|
91 |
#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
|
|
92 |
#define ME_FATALERROR 1024 /* Fatal statement error */ |
|
93 |
||
94 |
/* Bits in last argument to fn_format */
|
|
95 |
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ |
|
96 |
#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ |
|
97 |
#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ |
|
98 |
#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ |
|
99 |
#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ |
|
100 |
#define MY_RETURN_REAL_PATH 32 /* return full path for file */ |
|
101 |
#define MY_SAFE_PATH 64 /* Return NULL if too long path */ |
|
102 |
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ |
|
103 |
#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ |
|
104 |
||
105 |
||
106 |
/* My seek flags */
|
|
107 |
#define MY_SEEK_SET 0
|
|
108 |
#define MY_SEEK_CUR 1
|
|
109 |
#define MY_SEEK_END 2
|
|
110 |
||
111 |
/* Some constants */
|
|
112 |
#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ |
|
113 |
#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ |
|
114 |
#define DFLT_INIT_HITS 3
|
|
115 |
||
116 |
/* root_alloc flags */
|
|
117 |
#define MY_KEEP_PREALLOC 1
|
|
118 |
#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ |
|
119 |
||
120 |
/* Internal error numbers (for assembler functions) */
|
|
121 |
#define MY_ERRNO_EDOM 33
|
|
122 |
#define MY_ERRNO_ERANGE 34
|
|
123 |
||
124 |
/* Bits for get_date timeflag */
|
|
125 |
#define GETDATE_DATE_TIME 1
|
|
126 |
#define GETDATE_SHORT_DATE 2
|
|
127 |
#define GETDATE_HHMMSSTIME 4
|
|
128 |
#define GETDATE_GMT 8
|
|
129 |
#define GETDATE_FIXEDLENGTH 16
|
|
130 |
||
131 |
/* defines when allocating data */
|
|
132 |
#define my_checkmalloc()
|
|
133 |
#undef TERMINATE
|
|
134 |
#define TERMINATE(A,B) {}
|
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
135 |
|
136 |
#ifdef __cplusplus
|
|
137 |
extern "C" { |
|
138 |
#endif
|
|
139 |
||
472
by Monty Taylor
Moved qsort declarations. |
140 |
typedef int (*qsort_cmp)(const void *,const void *); |
141 |
typedef int (*qsort_cmp2)(void*, const void *,const void *); |
|
142 |
||
1
by brian
clean slate |
143 |
extern void *my_malloc(size_t Size,myf MyFlags); |
144 |
#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
|
|
145 |
extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags); |
|
146 |
extern void my_no_flags_free(void *ptr); |
|
147 |
extern void *my_memdup(const void *from,size_t length,myf MyFlags); |
|
148 |
extern char *my_strdup(const char *from,myf MyFlags); |
|
149 |
extern char *my_strndup(const char *from, size_t length, |
|
150 |
myf MyFlags); |
|
151 |
#define TRASH(A,B) /* nothing */ |
|
152 |
||
153 |
#ifdef HAVE_ALLOCA
|
|
154 |
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
|
|
155 |
#define alloca __builtin_alloca
|
|
156 |
#endif /* GNUC */ |
|
478
by Monty Taylor
Made my_alloc actually always use malloc. |
157 |
#define my_alloca(SZ) malloc((size_t) (SZ))
|
158 |
#define my_afree(PTR) free((PTR))
|
|
1
by brian
clean slate |
159 |
#else
|
478
by Monty Taylor
Made my_alloc actually always use malloc. |
160 |
#define my_alloca(SZ) malloc((SZ))
|
161 |
#define my_afree(PTR) free((PTR))
|
|
1
by brian
clean slate |
162 |
#endif /* HAVE_ALLOCA */ |
163 |
||
164 |
#ifndef errno /* did we already get it? */ |
|
165 |
#ifdef HAVE_ERRNO_AS_DEFINE
|
|
166 |
#include <errno.h> /* errno is a define */ |
|
167 |
#else
|
|
168 |
extern int errno; /* declare errno */ |
|
169 |
#endif
|
|
170 |
#endif /* #ifndef errno */ |
|
171 |
extern char errbuff[NRERRBUFFS][ERRMSGSIZE]; |
|
172 |
extern char *home_dir; /* Home directory for user */ |
|
173 |
extern const char *my_progname; /* program-name (printed in errors) */ |
|
482
by Brian Aker
Remove uint. |
174 |
extern void (*error_handler_hook)(uint32_t my_err, const char *str,myf MyFlags); |
175 |
extern void (*fatal_error_handler_hook)(uint32_t my_err, const char *str, |
|
1
by brian
clean slate |
176 |
myf MyFlags); |
482
by Brian Aker
Remove uint. |
177 |
extern uint32_t my_file_limit; |
298
by Brian Aker
ulong conversion. |
178 |
extern uint32_t my_thread_stack_size; |
1
by brian
clean slate |
179 |
|
180 |
/* charsets */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
181 |
extern const CHARSET_INFO *default_charset_info; |
1
by brian
clean slate |
182 |
extern CHARSET_INFO *all_charsets[256]; |
183 |
extern CHARSET_INFO compiled_charsets[]; |
|
184 |
||
185 |
/* statistics */
|
|
298
by Brian Aker
ulong conversion. |
186 |
extern uint32_t my_file_opened,my_stream_opened, my_tmp_file_created; |
187 |
extern uint32_t my_file_total_opened; |
|
1
by brian
clean slate |
188 |
extern uint mysys_usage_id; |
146
by Brian Aker
my_bool cleanup. |
189 |
extern bool my_init_done; |
1
by brian
clean slate |
190 |
|
191 |
/* Point to current my_message() */
|
|
192 |
extern void (*my_sigtstp_cleanup)(void), |
|
193 |
/* Executed before jump to shell */
|
|
194 |
(*my_sigtstp_restart)(void), |
|
195 |
(*my_abort_hook)(int); |
|
196 |
/* Executed when comming from shell */
|
|
197 |
extern int my_umask, /* Default creation mask */ |
|
198 |
my_umask_dir, |
|
199 |
my_recived_signals, /* Signals we have got */ |
|
200 |
my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ |
|
201 |
my_dont_interrupt; /* call remember_intr when set */ |
|
146
by Brian Aker
my_bool cleanup. |
202 |
extern bool mysys_uses_curses, my_use_symdir; |
298
by Brian Aker
ulong conversion. |
203 |
extern uint32_t sf_malloc_cur_memory, sf_malloc_max_memory; |
1
by brian
clean slate |
204 |
|
298
by Brian Aker
ulong conversion. |
205 |
extern uint32_t my_default_record_cache_size; |
77.1.96
by Monty Taylor
Removed skip-external-locking. |
206 |
extern bool my_disable_async_io, |
1
by brian
clean slate |
207 |
my_disable_flush_key_blocks, my_disable_symlinks; |
208 |
extern char wild_many, wild_one, wild_prefix; |
|
209 |
extern const char *charsets_dir; |
|
210 |
/* from default.c */
|
|
211 |
extern char *my_defaults_extra_file; |
|
212 |
extern const char *my_defaults_group_suffix; |
|
213 |
extern const char *my_defaults_file; |
|
214 |
||
146
by Brian Aker
my_bool cleanup. |
215 |
extern bool timed_mutexes; |
1
by brian
clean slate |
216 |
|
217 |
typedef struct wild_file_pack /* Struct to hold info when selecting files */ |
|
218 |
{
|
|
219 |
uint wilds; /* How many wildcards */ |
|
220 |
uint not_pos; /* Start of not-theese-files */ |
|
221 |
char * *wild; /* Pointer to wildcards */ |
|
222 |
} WF_PACK; |
|
223 |
||
224 |
enum loglevel { |
|
225 |
ERROR_LEVEL, |
|
226 |
WARNING_LEVEL, |
|
227 |
INFORMATION_LEVEL
|
|
228 |
};
|
|
229 |
||
230 |
enum cache_type |
|
231 |
{
|
|
232 |
TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, |
|
233 |
SEQ_READ_APPEND /* sequential read or append */, |
|
234 |
READ_FIFO, READ_NET,WRITE_NET}; |
|
235 |
||
236 |
typedef struct st_record_cache /* Used when cacheing records */ |
|
237 |
{
|
|
238 |
File file; |
|
239 |
int rc_seek,error,inited; |
|
240 |
uint rc_length,read_length,reclength; |
|
241 |
my_off_t rc_record_pos,end_of_file; |
|
481
by Brian Aker
Remove all of uchar. |
242 |
unsigned char *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; |
1
by brian
clean slate |
243 |
#ifdef HAVE_AIOWAIT
|
244 |
int use_async_io; |
|
245 |
my_aio_result aio_result; |
|
246 |
#endif
|
|
247 |
enum cache_type type; |
|
248 |
} RECORD_CACHE; |
|
249 |
||
250 |
enum file_type |
|
251 |
{
|
|
252 |
UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, |
|
253 |
FILE_BY_MKSTEMP, FILE_BY_DUP |
|
254 |
};
|
|
255 |
||
256 |
struct st_my_file_info |
|
257 |
{
|
|
258 |
char * name; |
|
259 |
enum file_type type; |
|
28.1.35
by Monty Taylor
Removed all references to THREAD. |
260 |
#if !defined(HAVE_PREAD)
|
1
by brian
clean slate |
261 |
pthread_mutex_t mutex; |
262 |
#endif
|
|
263 |
};
|
|
264 |
||
265 |
extern struct st_my_file_info *my_file_info; |
|
266 |
||
267 |
typedef struct st_dynamic_array |
|
268 |
{
|
|
481
by Brian Aker
Remove all of uchar. |
269 |
unsigned char *buffer; |
482
by Brian Aker
Remove uint. |
270 |
uint32_t elements,max_element; |
271 |
uint32_t alloc_increment; |
|
272 |
uint32_t size_of_element; |
|
1
by brian
clean slate |
273 |
} DYNAMIC_ARRAY; |
274 |
||
275 |
typedef struct st_my_tmpdir |
|
276 |
{
|
|
277 |
DYNAMIC_ARRAY full_list; |
|
278 |
char **list; |
|
482
by Brian Aker
Remove uint. |
279 |
uint32_t cur, max; |
1
by brian
clean slate |
280 |
pthread_mutex_t mutex; |
281 |
} MY_TMPDIR; |
|
282 |
||
283 |
||
284 |
typedef int (*qsort2_cmp)(const void *, const void *, const void *); |
|
285 |
||
286 |
/* defines for mf_iocache */
|
|
287 |
||
288 |
/* Test if buffer is inited */
|
|
289 |
#define my_b_clear(info) (info)->buffer=0
|
|
290 |
#define my_b_inited(info) (info)->buffer
|
|
291 |
#define my_b_EOF INT_MIN
|
|
292 |
||
293 |
#define my_b_read(info,Buffer,Count) \
|
|
294 |
((info)->read_pos + (Count) <= (info)->read_end ?\
|
|
295 |
(memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \
|
|
296 |
((info)->read_pos+=(Count)),0) :\
|
|
297 |
(*(info)->read_function)((info),Buffer,Count))
|
|
298 |
||
299 |
#define my_b_write(info,Buffer,Count) \
|
|
300 |
((info)->write_pos + (Count) <=(info)->write_end ?\
|
|
301 |
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
|
|
302 |
((info)->write_pos+=(Count)),0) : \
|
|
303 |
(*(info)->write_function)((info),(Buffer),(Count)))
|
|
304 |
||
305 |
#define my_b_get(info) \
|
|
306 |
((info)->read_pos != (info)->read_end ?\
|
|
481
by Brian Aker
Remove all of uchar. |
307 |
((info)->read_pos++, (int) (unsigned char) (info)->read_pos[-1]) :\
|
1
by brian
clean slate |
308 |
_my_b_get(info))
|
309 |
||
310 |
/* my_b_write_byte dosn't have any err-check */
|
|
311 |
#define my_b_write_byte(info,chr) \
|
|
312 |
(((info)->write_pos < (info)->write_end) ?\
|
|
313 |
((*(info)->write_pos++)=(chr)) :\
|
|
314 |
(_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
|
|
315 |
||
316 |
#define my_b_fill_cache(info) \
|
|
317 |
(((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
|
|
318 |
||
319 |
#define my_b_tell(info) ((info)->pos_in_file + \
|
|
320 |
(size_t) (*(info)->current_pos - (info)->request_pos))
|
|
321 |
||
322 |
#define my_b_get_buffer_start(info) (info)->request_pos
|
|
323 |
#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \
|
|
324 |
(char*) my_b_get_buffer_start(info)
|
|
325 |
#define my_b_get_pos_in_file(info) (info)->pos_in_file
|
|
326 |
||
327 |
||
328 |
#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
|
|
329 |
*(info)->current_pos)
|
|
330 |
||
205
by Brian Aker
uint32 -> uin32_t |
331 |
typedef uint32_t ha_checksum; |
1
by brian
clean slate |
332 |
|
333 |
/* Define the type of function to be passed to process_default_option_files */
|
|
334 |
typedef int (*Process_option_func)(void *ctx, const char *group_name, |
|
335 |
const char *option); |
|
336 |
||
212.5.8
by Monty Taylor
Moved my_alloc.h to mysys. |
337 |
#include <mysys/my_alloc.h> |
1
by brian
clean slate |
338 |
|
339 |
||
340 |
/* Prototypes for mysys and my_func functions */
|
|
341 |
||
342 |
extern int my_copy(const char *from,const char *to,myf MyFlags); |
|
343 |
extern int my_delete(const char *name,myf MyFlags); |
|
344 |
extern void *my_once_alloc(size_t Size,myf MyFlags); |
|
345 |
extern void my_once_free(void); |
|
346 |
extern char *my_once_strdup(const char *src,myf myflags); |
|
347 |
extern void *my_once_memdup(const void *src, size_t len, myf myflags); |
|
348 |
extern File my_open(const char *FileName,int Flags,myf MyFlags); |
|
349 |
extern File my_register_filename(File fd, const char *FileName, |
|
350 |
enum file_type type_of_file, |
|
482
by Brian Aker
Remove uint. |
351 |
uint32_t error_message_number, myf MyFlags); |
1
by brian
clean slate |
352 |
extern File my_create(const char *FileName,int CreateFlags, |
353 |
int AccessFlags, myf MyFlags); |
|
354 |
extern int my_close(File Filedes,myf MyFlags); |
|
355 |
extern File my_dup(File file, myf MyFlags); |
|
356 |
extern int my_mkdir(const char *dir, int Flags, myf MyFlags); |
|
357 |
extern int my_readlink(char *to, const char *filename, myf MyFlags); |
|
358 |
extern int my_realpath(char *to, const char *filename, myf MyFlags); |
|
359 |
extern File my_create_with_symlink(const char *linkname, const char *filename, |
|
360 |
int createflags, int access_flags, |
|
361 |
myf MyFlags); |
|
362 |
extern int my_delete_with_symlink(const char *name, myf MyFlags); |
|
363 |
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); |
|
364 |
extern int my_symlink(const char *content, const char *linkname, myf MyFlags); |
|
481
by Brian Aker
Remove all of uchar. |
365 |
extern size_t my_read(File Filedes,unsigned char *Buffer,size_t Count,myf MyFlags); |
1
by brian
clean slate |
366 |
extern int my_rename(const char *from,const char *to,myf MyFlags); |
367 |
extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); |
|
368 |
extern my_off_t my_tell(File fd,myf MyFlags); |
|
481
by Brian Aker
Remove all of uchar. |
369 |
extern size_t my_write(File Filedes,const unsigned char *Buffer,size_t Count, |
1
by brian
clean slate |
370 |
myf MyFlags); |
481
by Brian Aker
Remove all of uchar. |
371 |
extern size_t my_fwrite(FILE *stream,const unsigned char *Buffer,size_t Count, |
1
by brian
clean slate |
372 |
myf MyFlags); |
373 |
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); |
|
374 |
extern void *_mymalloc(size_t uSize,const char *sFile, |
|
482
by Brian Aker
Remove uint. |
375 |
uint32_t uLine, myf MyFlag); |
1
by brian
clean slate |
376 |
extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile, |
482
by Brian Aker
Remove uint. |
377 |
uint32_t uLine, myf MyFlag); |
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
378 |
extern void * my_multi_malloc (myf MyFlags, ...); |
482
by Brian Aker
Remove uint. |
379 |
extern void _myfree(void *pPtr, const char *sFile, uint32_t uLine, myf MyFlag); |
380 |
extern int _sanity(const char *sFile, uint32_t uLine); |
|
1
by brian
clean slate |
381 |
extern void *_my_memdup(const void *from, size_t length, |
482
by Brian Aker
Remove uint. |
382 |
const char *sFile, uint32_t uLine,myf MyFlag); |
383 |
extern char * _my_strdup(const char *from, const char *sFile, uint32_t uLine, |
|
1
by brian
clean slate |
384 |
myf MyFlag); |
385 |
extern char *_my_strndup(const char *from, size_t length, |
|
482
by Brian Aker
Remove uint. |
386 |
const char *sFile, uint32_t uLine, |
1
by brian
clean slate |
387 |
myf MyFlag); |
388 |
||
389 |
#define my_access access
|
|
390 |
extern int check_if_legal_filename(const char *path); |
|
391 |
extern int check_if_legal_tablename(const char *path); |
|
392 |
||
393 |
#define my_delete_allow_opened(fname,flags) my_delete((fname),(flags))
|
|
394 |
||
395 |
#ifndef TERMINATE
|
|
482
by Brian Aker
Remove uint. |
396 |
extern void TERMINATE(FILE *file, uint32_t flag); |
1
by brian
clean slate |
397 |
#endif
|
398 |
extern void init_glob_errs(void); |
|
399 |
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); |
|
400 |
extern int my_fclose(FILE *fd,myf MyFlags); |
|
401 |
extern int my_sync(File fd, myf my_flags); |
|
402 |
extern int my_sync_dir(const char *dir_name, myf my_flags); |
|
403 |
extern int my_sync_dir_by_file(const char *file_name, myf my_flags); |
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
404 |
extern void my_error(int nr,myf MyFlags, ...); |
482
by Brian Aker
Remove uint. |
405 |
extern void my_printf_error(uint32_t my_err, const char *format, |
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
406 |
myf MyFlags, ...) |
407 |
__attribute__((format(printf, 2, 4))); |
|
1
by brian
clean slate |
408 |
extern int my_error_register(const char **errmsgs, int first, int last); |
409 |
extern const char **my_error_unregister(int first, int last); |
|
482
by Brian Aker
Remove uint. |
410 |
extern void my_message(uint32_t my_err, const char *str,myf MyFlags); |
411 |
extern void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags); |
|
146
by Brian Aker
my_bool cleanup. |
412 |
extern bool my_init(void); |
1
by brian
clean slate |
413 |
extern void my_end(int infoflag); |
414 |
extern int my_redel(const char *from, const char *to, int MyFlags); |
|
415 |
extern int my_copystat(const char *from, const char *to, int MyFlags); |
|
416 |
extern char * my_filename(File fd); |
|
417 |
||
418 |
#ifdef EXTRA_DEBUG
|
|
419 |
void my_print_open_files(void); |
|
420 |
#else
|
|
421 |
#define my_print_open_files()
|
|
422 |
#endif
|
|
423 |
||
146
by Brian Aker
my_bool cleanup. |
424 |
extern bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); |
1
by brian
clean slate |
425 |
extern char *my_tmpdir(MY_TMPDIR *tmpdir); |
426 |
extern void free_tmpdir(MY_TMPDIR *tmpdir); |
|
427 |
||
454
by Monty Taylor
Removed RETSIGHANDLER to sig_handler define. |
428 |
extern void my_remember_signal(int signal_number,RETSIGTYPE (*func)(int)); |
1
by brian
clean slate |
429 |
extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); |
430 |
extern size_t dirname_length(const char *name); |
|
431 |
#define base_name(A) (A+dirname_length(A))
|
|
575.4.6
by Monty Taylor
Removed my_getwd. |
432 |
bool test_if_hard_path(const char *dir_name); |
1
by brian
clean slate |
433 |
extern char *convert_dirname(char *to, const char *from, const char *from_end); |
434 |
extern void to_unix_path(char * name); |
|
435 |
extern char * fn_ext(const char *name); |
|
436 |
extern char * fn_same(char * toname,const char *name,int flag); |
|
437 |
extern char * fn_format(char * to,const char *name,const char *dir, |
|
482
by Brian Aker
Remove uint. |
438 |
const char *form, uint32_t flag); |
1
by brian
clean slate |
439 |
extern size_t strlength(const char *str); |
440 |
extern void pack_dirname(char * to,const char *from); |
|
441 |
extern size_t unpack_dirname(char * to,const char *from); |
|
442 |
extern size_t cleanup_dirname(char * to,const char *from); |
|
443 |
extern size_t system_filename(char * to,const char *from); |
|
444 |
extern size_t unpack_filename(char * to,const char *from); |
|
445 |
extern char * intern_filename(char * to,const char *from); |
|
446 |
extern char * directory_file_name(char * dst, const char *src); |
|
447 |
extern int pack_filename(char * to, const char *name, size_t max_length); |
|
448 |
extern char * my_path(char * to,const char *progname, |
|
449 |
const char *own_pathname_part); |
|
450 |
extern char * my_load_path(char * to, const char *path, |
|
451 |
const char *own_path_prefix); |
|
452 |
extern int wild_compare(const char *str,const char *wildstr, |
|
154
by Brian Aker
Removed oddball types in my_global.h |
453 |
bool str_is_pattern); |
1
by brian
clean slate |
454 |
extern WF_PACK *wf_comp(char * str); |
455 |
extern int wf_test(struct wild_file_pack *wf_pack,const char *name); |
|
456 |
extern void wf_end(struct wild_file_pack *buffer); |
|
146
by Brian Aker
my_bool cleanup. |
457 |
extern bool array_append_string_unique(const char *str, |
1
by brian
clean slate |
458 |
const char **array, size_t size); |
459 |
extern void get_date(char * to,int timeflag,time_t use_time); |
|
460 |
extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, |
|
154
by Brian Aker
Removed oddball types in my_global.h |
461 |
bool remove_garbage); |
1
by brian
clean slate |
462 |
extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, |
463 |
size_t reclength,enum cache_type type, |
|
154
by Brian Aker
Removed oddball types in my_global.h |
464 |
bool use_async_io); |
481
by Brian Aker
Remove all of uchar. |
465 |
extern int read_cache_record(RECORD_CACHE *info,unsigned char *to); |
1
by brian
clean slate |
466 |
extern int end_record_cache(RECORD_CACHE *info); |
467 |
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, |
|
481
by Brian Aker
Remove all of uchar. |
468 |
const unsigned char *record,size_t length); |
1
by brian
clean slate |
469 |
extern int flush_write_cache(RECORD_CACHE *info); |
454
by Monty Taylor
Removed RETSIGHANDLER to sig_handler define. |
470 |
extern RETSIGTYPE sigtstp_handler(int signal_number); |
1
by brian
clean slate |
471 |
extern void handle_recived_signals(void); |
472 |
||
454
by Monty Taylor
Removed RETSIGHANDLER to sig_handler define. |
473 |
extern RETSIGTYPE my_set_alarm_variable(int signo); |
482
by Brian Aker
Remove uint. |
474 |
extern void my_string_ptr_sort(unsigned char *base,uint32_t items,size_t size); |
475 |
extern void radixsort_for_str_ptr(unsigned char* base[], uint32_t number_of_elements, |
|
481
by Brian Aker
Remove all of uchar. |
476 |
size_t size_of_element,unsigned char *buffer[]); |
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
477 |
extern RETQSORTTYPE my_qsort(void *base_ptr, size_t total_elems, size_t size, |
478 |
qsort_cmp cmp); |
|
479 |
extern RETQSORTTYPE my_qsort2(void *base_ptr, size_t total_elems, size_t size, |
|
480 |
qsort2_cmp cmp, void *cmp_argument); |
|
1
by brian
clean slate |
481 |
extern qsort2_cmp get_ptr_compare(size_t); |
481
by Brian Aker
Remove all of uchar. |
482 |
void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos); |
483 |
my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length); |
|
1
by brian
clean slate |
484 |
File create_temp_file(char *to, const char *dir, const char *pfx, |
485 |
int mode, myf MyFlags); |
|
575.1.6
by Monty Taylor
Cleaned up some headers for PCH. |
486 |
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
|
487 |
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
|
|
488 |
#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
|
|
489 |
#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
|
|
482
by Brian Aker
Remove uint. |
490 |
extern bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint32_t element_size, |
491 |
void *init_buffer, uint32_t init_alloc, |
|
575.1.6
by Monty Taylor
Cleaned up some headers for PCH. |
492 |
uint32_t alloc_increment); |
1
by brian
clean slate |
493 |
/* init_dynamic_array() function is deprecated */
|
482
by Brian Aker
Remove uint. |
494 |
extern bool init_dynamic_array(DYNAMIC_ARRAY *array,uint32_t element_size, |
575.1.6
by Monty Taylor
Cleaned up some headers for PCH. |
495 |
uint32_t init_alloc,uint32_t alloc_increment); |
481
by Brian Aker
Remove all of uchar. |
496 |
extern bool insert_dynamic(DYNAMIC_ARRAY *array,unsigned char * element); |
497 |
extern unsigned char *alloc_dynamic(DYNAMIC_ARRAY *array); |
|
498 |
extern unsigned char *pop_dynamic(DYNAMIC_ARRAY*); |
|
482
by Brian Aker
Remove uint. |
499 |
extern bool set_dynamic(DYNAMIC_ARRAY *array,unsigned char * element,uint32_t array_index); |
500 |
extern bool allocate_dynamic(DYNAMIC_ARRAY *array, uint32_t max_elements); |
|
501 |
extern void get_dynamic(DYNAMIC_ARRAY *array,unsigned char * element,uint32_t array_index); |
|
1
by brian
clean slate |
502 |
extern void delete_dynamic(DYNAMIC_ARRAY *array); |
482
by Brian Aker
Remove uint. |
503 |
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint32_t array_index); |
1
by brian
clean slate |
504 |
extern void freeze_size(DYNAMIC_ARRAY *array); |
481
by Brian Aker
Remove all of uchar. |
505 |
extern int get_index_dynamic(DYNAMIC_ARRAY *array, unsigned char * element); |
1
by brian
clean slate |
506 |
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
|
507 |
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
|
|
508 |
#define push_dynamic(A,B) insert_dynamic((A),(B))
|
|
509 |
#define reset_dynamic(array) ((array)->elements= 0)
|
|
510 |
#define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
|
|
511 |
||
512 |
#define my_malloc_lock(A,B) my_malloc((A),(B))
|
|
513 |
#define alloc_root_inited(A) ((A)->min_malloc != 0)
|
|
514 |
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
|
|
515 |
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
|
|
516 |
extern int get_defaults_options(int argc, char **argv, |
|
517 |
char **defaults, char **extra_defaults, |
|
518 |
char **group_suffix); |
|
519 |
extern int load_defaults(const char *conf_file, const char **groups, |
|
520 |
int *argc, char ***argv); |
|
521 |
extern int modify_defaults_file(const char *file_location, const char *option, |
|
522 |
const char *option_value, |
|
523 |
const char *section_name, int remove_option); |
|
524 |
extern int my_search_option_files(const char *conf_file, int *argc, |
|
482
by Brian Aker
Remove uint. |
525 |
char ***argv, uint32_t *args_used, |
1
by brian
clean slate |
526 |
Process_option_func func, void *func_ctx); |
527 |
extern void free_defaults(char **argv); |
|
528 |
extern void my_print_default_files(const char *conf_file); |
|
529 |
extern void print_defaults(const char *conf_file, const char **groups); |
|
481
by Brian Aker
Remove all of uchar. |
530 |
extern ha_checksum my_checksum(ha_checksum crc, const unsigned char *mem, |
1
by brian
clean slate |
531 |
size_t count); |
298
by Brian Aker
ulong conversion. |
532 |
extern void my_sleep(uint32_t m_seconds); |
482
by Brian Aker
Remove uint. |
533 |
extern uint32_t my_set_max_open_files(uint32_t files); |
1
by brian
clean slate |
534 |
void my_free_open_file_info(void); |
535 |
||
536 |
extern time_t my_time(myf flags); |
|
151
by Brian Aker
Ulonglong to uint64_t |
537 |
extern uint64_t my_getsystime(void); |
538 |
extern uint64_t my_micro_time(void); |
|
539 |
extern uint64_t my_micro_time_and_time(time_t *time_arg); |
|
540 |
time_t my_time_possible_from_micro(uint64_t microtime); |
|
481
by Brian Aker
Remove all of uchar. |
541 |
extern bool my_gethwaddr(unsigned char *to); |
1
by brian
clean slate |
542 |
|
543 |
#ifdef HAVE_SYS_MMAN_H
|
|
544 |
#include <sys/mman.h> |
|
545 |
||
546 |
#ifndef MAP_NOSYNC
|
|
547 |
#define MAP_NOSYNC 0
|
|
548 |
#endif
|
|
549 |
#ifndef MAP_NORESERVE
|
|
550 |
#define MAP_NORESERVE 0 /* For irix and AIX */ |
|
551 |
#endif
|
|
552 |
||
553 |
#ifdef HAVE_MMAP64
|
|
554 |
#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f)
|
|
555 |
#else
|
|
556 |
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
|
|
557 |
#endif
|
|
558 |
#define my_munmap(a,b) munmap((a),(b))
|
|
559 |
||
560 |
#else
|
|
561 |
/* not a complete set of mmap() flags, but only those that nesessary */
|
|
562 |
#define PROT_READ 1
|
|
563 |
#define PROT_WRITE 2
|
|
564 |
#define MAP_NORESERVE 0
|
|
565 |
#define MAP_SHARED 0x0001
|
|
566 |
#define MAP_PRIVATE 0x0002
|
|
567 |
#define MAP_NOSYNC 0x0800
|
|
568 |
#define MAP_FAILED ((void *)-1)
|
|
569 |
#define MS_SYNC 0x0000
|
|
570 |
#define HAVE_MMAP
|
|
571 |
||
572 |
void *my_mmap(void *, size_t, int, int, int, my_off_t); |
|
573 |
int my_munmap(void *, size_t); |
|
574 |
#endif
|
|
575 |
||
576 |
/* character sets */
|
|
482
by Brian Aker
Remove uint. |
577 |
extern uint32_t get_charset_number(const char *cs_name, uint32_t cs_flags); |
578 |
extern uint32_t get_collation_number(const char *name); |
|
579 |
extern const char *get_charset_name(uint32_t cs_number); |
|
1
by brian
clean slate |
580 |
|
482
by Brian Aker
Remove uint. |
581 |
extern const CHARSET_INFO *get_charset(uint32_t cs_number, myf flags); |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
582 |
extern const CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); |
482
by Brian Aker
Remove uint. |
583 |
extern const CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint32_t cs_flags, myf my_flags); |
1
by brian
clean slate |
584 |
|
146
by Brian Aker
my_bool cleanup. |
585 |
extern bool resolve_charset(const char *cs_name, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
586 |
const CHARSET_INFO *default_cs, |
587 |
const CHARSET_INFO **cs); |
|
146
by Brian Aker
my_bool cleanup. |
588 |
extern bool resolve_collation(const char *cl_name, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
589 |
const CHARSET_INFO *default_cl, |
590 |
const CHARSET_INFO **cl); |
|
1
by brian
clean slate |
591 |
|
592 |
extern void free_charsets(void); |
|
593 |
extern char *get_charsets_dir(char *buf); |
|
236.3.9
by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets) |
594 |
extern bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2); |
146
by Brian Aker
my_bool cleanup. |
595 |
extern bool init_compiled_charsets(myf flags); |
1
by brian
clean slate |
596 |
extern void add_compiled_collation(CHARSET_INFO *cs); |
236.3.9
by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets) |
597 |
extern size_t escape_string_for_drizzle(const CHARSET_INFO *charset_info, |
598 |
char *to, size_t to_length, |
|
599 |
const char *from, size_t length); |
|
600 |
extern size_t escape_quotes_for_drizzle(const CHARSET_INFO *charset_info, |
|
236.3.4
by Andrey Hristov
Rename escape_(string|quotes)_for_mysql to escape_(string|quotes)_for_drizzle |
601 |
char *to, size_t to_length, |
602 |
const char *from, size_t length); |
|
1
by brian
clean slate |
603 |
|
298
by Brian Aker
ulong conversion. |
604 |
extern void thd_increment_bytes_sent(uint32_t length); |
605 |
extern void thd_increment_bytes_received(uint32_t length); |
|
606 |
extern void thd_increment_net_big_packet_count(uint32_t length); |
|
1
by brian
clean slate |
607 |
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
608 |
#ifdef __cplusplus
|
609 |
}
|
|
610 |
#endif
|
|
611 |
||
1
by brian
clean slate |
612 |
#endif /* _my_sys_h */ |