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; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
39 |
#endif
|
520.4.43
by mordred
A set of Solaris fixes. |
40 |
|
1
by brian
clean slate |
41 |
#define MY_INIT(name); { my_progname= name; my_init(); }
|
42 |
||
722.1.3
by Monty Taylor
Cleaned up a few build things. |
43 |
/* Max width of screen (for error messages) */
|
44 |
#define SC_MAXWIDTH 256
|
|
1
by brian
clean slate |
45 |
#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ |
46 |
#define NRERRBUFFS (2) /* Buffers for parameters */ |
|
47 |
#define MY_FILE_ERROR ((size_t) -1)
|
|
48 |
||
49 |
/* General bitmaps for my_func's */
|
|
50 |
#define MY_FFNF 1 /* Fatal if file not found */ |
|
51 |
#define MY_FNABP 2 /* Fatal if not all bytes read/writen */ |
|
52 |
#define MY_NABP 4 /* Error if not all bytes read/writen */ |
|
53 |
#define MY_FAE 8 /* Fatal if any error */ |
|
54 |
#define MY_WME 16 /* Write message on error */ |
|
55 |
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ |
|
56 |
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ |
|
57 |
#define MY_SYNC_DIR 1024 /* my_create/delete/rename: sync directory */ |
|
58 |
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ |
|
59 |
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ |
|
60 |
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ |
|
61 |
#define MY_COPYTIME 64 /* my_redel() copys time */ |
|
62 |
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ |
|
63 |
#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ |
|
64 |
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ |
|
65 |
#define MY_REDEL_MAKE_BACKUP 256
|
|
66 |
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ |
|
656.1.26
by Monty Taylor
Finally removed all of the my_malloc stuff. |
67 |
#define MY_ZEROFILL 32 /* my_multi_malloc(), fill array with zero */ |
1
by brian
clean slate |
68 |
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ |
69 |
#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ |
|
70 |
||
71 |
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ |
|
72 |
#define MY_GIVE_INFO 2 /* Give time info about process*/ |
|
73 |
||
74 |
#define ME_HIGHBYTE 8 /* Shift for colours */ |
|
75 |
#define ME_NOCUR 1 /* Don't use curses message */ |
|
76 |
#define ME_OLDWIN 2 /* Use old window */ |
|
77 |
#define ME_BELL 4 /* Ring bell then printing message */ |
|
78 |
#define ME_HOLDTANG 8 /* Don't delete last keys */ |
|
79 |
#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ |
|
80 |
#define ME_WAITTANG 32 /* Wait for a user action */ |
|
81 |
#define ME_NOREFRESH 64 /* Dont refresh screen */ |
|
82 |
#define ME_NOINPUT 128 /* Dont use the input libary */ |
|
83 |
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ |
|
84 |
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
|
|
85 |
#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
|
|
86 |
#define ME_FATALERROR 1024 /* Fatal statement error */ |
|
87 |
||
88 |
/* Bits in last argument to fn_format */
|
|
89 |
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ |
|
90 |
#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ |
|
91 |
#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ |
|
92 |
#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ |
|
93 |
#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ |
|
94 |
#define MY_RETURN_REAL_PATH 32 /* return full path for file */ |
|
95 |
#define MY_SAFE_PATH 64 /* Return NULL if too long path */ |
|
96 |
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ |
|
97 |
#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ |
|
98 |
||
99 |
||
100 |
/* Some constants */
|
|
101 |
#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */ |
|
102 |
#define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */ |
|
103 |
#define DFLT_INIT_HITS 3
|
|
104 |
||
105 |
/* root_alloc flags */
|
|
106 |
#define MY_KEEP_PREALLOC 1
|
|
107 |
#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ |
|
108 |
||
109 |
/* Internal error numbers (for assembler functions) */
|
|
110 |
#define MY_ERRNO_EDOM 33
|
|
111 |
#define MY_ERRNO_ERANGE 34
|
|
112 |
||
113 |
/* Bits for get_date timeflag */
|
|
114 |
#define GETDATE_DATE_TIME 1
|
|
115 |
#define GETDATE_SHORT_DATE 2
|
|
116 |
#define GETDATE_HHMMSSTIME 4
|
|
117 |
#define GETDATE_GMT 8
|
|
118 |
#define GETDATE_FIXEDLENGTH 16
|
|
119 |
||
120 |
/* defines when allocating data */
|
|
121 |
#define my_checkmalloc()
|
|
122 |
#undef TERMINATE
|
|
123 |
#define TERMINATE(A,B) {}
|
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
124 |
|
125 |
#ifdef __cplusplus
|
|
126 |
extern "C" { |
|
127 |
#endif
|
|
128 |
||
472
by Monty Taylor
Moved qsort declarations. |
129 |
typedef int (*qsort_cmp)(const void *,const void *); |
130 |
typedef int (*qsort_cmp2)(void*, const void *,const void *); |
|
131 |
||
1
by brian
clean slate |
132 |
#define TRASH(A,B) /* nothing */ |
133 |
||
134 |
#ifndef errno /* did we already get it? */ |
|
135 |
#ifdef HAVE_ERRNO_AS_DEFINE
|
|
136 |
#include <errno.h> /* errno is a define */ |
|
137 |
#else
|
|
138 |
extern int errno; /* declare errno */ |
|
139 |
#endif
|
|
140 |
#endif /* #ifndef errno */ |
|
141 |
extern char *home_dir; /* Home directory for user */ |
|
142 |
extern const char *my_progname; /* program-name (printed in errors) */ |
|
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
143 |
typedef void (*error_handler_func)(uint32_t my_err, const char *str,myf MyFlags); |
144 |
extern error_handler_func error_handler_hook; |
|
482
by Brian Aker
Remove uint. |
145 |
extern uint32_t my_file_limit; |
1
by brian
clean slate |
146 |
|
147 |
/* charsets */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
148 |
extern const CHARSET_INFO *default_charset_info; |
1
by brian
clean slate |
149 |
extern CHARSET_INFO *all_charsets[256]; |
150 |
extern CHARSET_INFO compiled_charsets[]; |
|
151 |
||
152 |
/* statistics */
|
|
298
by Brian Aker
ulong conversion. |
153 |
extern uint32_t my_file_opened,my_stream_opened, my_tmp_file_created; |
154 |
extern uint32_t my_file_total_opened; |
|
1
by brian
clean slate |
155 |
extern uint mysys_usage_id; |
146
by Brian Aker
my_bool cleanup. |
156 |
extern bool my_init_done; |
1
by brian
clean slate |
157 |
|
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
158 |
typedef void (*void_ptr_func)(void); |
159 |
typedef void (*void_ptr_int_func)(int); |
|
160 |
||
1
by brian
clean slate |
161 |
/* Point to current my_message() */
|
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
162 |
extern void_ptr_func my_sigtstp_cleanup, |
1
by brian
clean slate |
163 |
/* Executed before jump to shell */
|
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
164 |
my_sigtstp_restart; |
1
by brian
clean slate |
165 |
/* Executed when comming from shell */
|
166 |
extern int my_umask, /* Default creation mask */ |
|
167 |
my_umask_dir, |
|
168 |
my_recived_signals, /* Signals we have got */ |
|
169 |
my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ |
|
170 |
my_dont_interrupt; /* call remember_intr when set */ |
|
146
by Brian Aker
my_bool cleanup. |
171 |
extern bool mysys_uses_curses, my_use_symdir; |
298
by Brian Aker
ulong conversion. |
172 |
extern uint32_t sf_malloc_cur_memory, sf_malloc_max_memory; |
1
by brian
clean slate |
173 |
|
298
by Brian Aker
ulong conversion. |
174 |
extern uint32_t my_default_record_cache_size; |
77.1.96
by Monty Taylor
Removed skip-external-locking. |
175 |
extern bool my_disable_async_io, |
1
by brian
clean slate |
176 |
my_disable_flush_key_blocks, my_disable_symlinks; |
177 |
extern char wild_many, wild_one, wild_prefix; |
|
178 |
extern const char *charsets_dir; |
|
179 |
/* from default.c */
|
|
180 |
extern char *my_defaults_extra_file; |
|
181 |
extern const char *my_defaults_group_suffix; |
|
182 |
extern const char *my_defaults_file; |
|
183 |
||
146
by Brian Aker
my_bool cleanup. |
184 |
extern bool timed_mutexes; |
1
by brian
clean slate |
185 |
|
186 |
typedef struct wild_file_pack /* Struct to hold info when selecting files */ |
|
187 |
{
|
|
188 |
uint wilds; /* How many wildcards */ |
|
189 |
uint not_pos; /* Start of not-theese-files */ |
|
190 |
char * *wild; /* Pointer to wildcards */ |
|
191 |
} WF_PACK; |
|
192 |
||
193 |
enum loglevel { |
|
194 |
ERROR_LEVEL, |
|
195 |
WARNING_LEVEL, |
|
196 |
INFORMATION_LEVEL
|
|
197 |
};
|
|
198 |
||
199 |
enum cache_type |
|
200 |
{
|
|
201 |
TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE, |
|
202 |
SEQ_READ_APPEND /* sequential read or append */, |
|
203 |
READ_FIFO, READ_NET,WRITE_NET}; |
|
204 |
||
205 |
typedef struct st_record_cache /* Used when cacheing records */ |
|
206 |
{
|
|
207 |
File file; |
|
208 |
int rc_seek,error,inited; |
|
209 |
uint rc_length,read_length,reclength; |
|
210 |
my_off_t rc_record_pos,end_of_file; |
|
481
by Brian Aker
Remove all of uchar. |
211 |
unsigned char *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; |
1
by brian
clean slate |
212 |
#ifdef HAVE_AIOWAIT
|
213 |
int use_async_io; |
|
214 |
my_aio_result aio_result; |
|
215 |
#endif
|
|
216 |
enum cache_type type; |
|
217 |
} RECORD_CACHE; |
|
218 |
||
219 |
||
220 |
typedef int (*qsort2_cmp)(const void *, const void *, const void *); |
|
221 |
||
222 |
/* defines for mf_iocache */
|
|
223 |
||
224 |
/* Test if buffer is inited */
|
|
225 |
#define my_b_clear(info) (info)->buffer=0
|
|
226 |
#define my_b_inited(info) (info)->buffer
|
|
227 |
#define my_b_EOF INT_MIN
|
|
228 |
||
229 |
#define my_b_read(info,Buffer,Count) \
|
|
230 |
((info)->read_pos + (Count) <= (info)->read_end ?\
|
|
231 |
(memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \
|
|
232 |
((info)->read_pos+=(Count)),0) :\
|
|
233 |
(*(info)->read_function)((info),Buffer,Count))
|
|
234 |
||
235 |
#define my_b_write(info,Buffer,Count) \
|
|
236 |
((info)->write_pos + (Count) <=(info)->write_end ?\
|
|
237 |
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
|
|
238 |
((info)->write_pos+=(Count)),0) : \
|
|
239 |
(*(info)->write_function)((info),(Buffer),(Count)))
|
|
240 |
||
241 |
#define my_b_get(info) \
|
|
242 |
((info)->read_pos != (info)->read_end ?\
|
|
481
by Brian Aker
Remove all of uchar. |
243 |
((info)->read_pos++, (int) (unsigned char) (info)->read_pos[-1]) :\
|
1
by brian
clean slate |
244 |
_my_b_get(info))
|
245 |
||
246 |
/* my_b_write_byte dosn't have any err-check */
|
|
247 |
#define my_b_write_byte(info,chr) \
|
|
248 |
(((info)->write_pos < (info)->write_end) ?\
|
|
249 |
((*(info)->write_pos++)=(chr)) :\
|
|
250 |
(_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
|
|
251 |
||
252 |
#define my_b_fill_cache(info) \
|
|
253 |
(((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
|
|
254 |
||
255 |
#define my_b_tell(info) ((info)->pos_in_file + \
|
|
256 |
(size_t) (*(info)->current_pos - (info)->request_pos))
|
|
257 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
258 |
#define my_b_get_buffer_start(info) (info)->request_pos
|
1
by brian
clean slate |
259 |
#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \
|
260 |
(char*) my_b_get_buffer_start(info)
|
|
261 |
#define my_b_get_pos_in_file(info) (info)->pos_in_file
|
|
262 |
||
263 |
||
264 |
#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
|
|
265 |
*(info)->current_pos)
|
|
266 |
||
205
by Brian Aker
uint32 -> uin32_t |
267 |
typedef uint32_t ha_checksum; |
1
by brian
clean slate |
268 |
|
269 |
/* Define the type of function to be passed to process_default_option_files */
|
|
270 |
typedef int (*Process_option_func)(void *ctx, const char *group_name, |
|
271 |
const char *option); |
|
272 |
||
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
273 |
int handle_default_option(void *in_ctx, const char *group_name, |
274 |
const char *option); |
|
275 |
||
212.5.8
by Monty Taylor
Moved my_alloc.h to mysys. |
276 |
#include <mysys/my_alloc.h> |
1
by brian
clean slate |
277 |
|
278 |
||
279 |
/* Prototypes for mysys and my_func functions */
|
|
280 |
||
281 |
extern int my_copy(const char *from,const char *to,myf MyFlags); |
|
282 |
extern int my_delete(const char *name,myf MyFlags); |
|
283 |
extern File my_open(const char *FileName,int Flags,myf MyFlags); |
|
284 |
extern File my_register_filename(File fd, const char *FileName, |
|
482
by Brian Aker
Remove uint. |
285 |
uint32_t error_message_number, myf MyFlags); |
1
by brian
clean slate |
286 |
extern File my_create(const char *FileName,int CreateFlags, |
287 |
int AccessFlags, myf MyFlags); |
|
288 |
extern int my_close(File Filedes,myf MyFlags); |
|
289 |
extern File my_dup(File file, myf MyFlags); |
|
290 |
extern int my_mkdir(const char *dir, int Flags, myf MyFlags); |
|
291 |
extern int my_realpath(char *to, const char *filename, myf MyFlags); |
|
292 |
extern File my_create_with_symlink(const char *linkname, const char *filename, |
|
293 |
int createflags, int access_flags, |
|
294 |
myf MyFlags); |
|
295 |
extern int my_delete_with_symlink(const char *name, myf MyFlags); |
|
296 |
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); |
|
481
by Brian Aker
Remove all of uchar. |
297 |
extern size_t my_read(File Filedes,unsigned char *Buffer,size_t Count,myf MyFlags); |
1
by brian
clean slate |
298 |
extern int my_rename(const char *from,const char *to,myf MyFlags); |
481
by Brian Aker
Remove all of uchar. |
299 |
extern size_t my_write(File Filedes,const unsigned char *Buffer,size_t Count, |
1
by brian
clean slate |
300 |
myf MyFlags); |
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
301 |
extern void * my_multi_malloc (myf MyFlags, ...); |
482
by Brian Aker
Remove uint. |
302 |
extern int _sanity(const char *sFile, uint32_t uLine); |
1
by brian
clean slate |
303 |
|
304 |
#define my_access access
|
|
305 |
extern int check_if_legal_filename(const char *path); |
|
306 |
extern int check_if_legal_tablename(const char *path); |
|
307 |
||
308 |
#define my_delete_allow_opened(fname,flags) my_delete((fname),(flags))
|
|
309 |
||
310 |
#ifndef TERMINATE
|
|
482
by Brian Aker
Remove uint. |
311 |
extern void TERMINATE(FILE *file, uint32_t flag); |
1
by brian
clean slate |
312 |
#endif
|
313 |
extern void init_glob_errs(void); |
|
314 |
extern int my_sync(File fd, myf my_flags); |
|
315 |
extern int my_sync_dir(const char *dir_name, myf my_flags); |
|
316 |
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. |
317 |
extern void my_error(int nr,myf MyFlags, ...); |
482
by Brian Aker
Remove uint. |
318 |
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. |
319 |
myf MyFlags, ...) |
320 |
__attribute__((format(printf, 2, 4))); |
|
1
by brian
clean slate |
321 |
extern int my_error_register(const char **errmsgs, int first, int last); |
322 |
extern const char **my_error_unregister(int first, int last); |
|
482
by Brian Aker
Remove uint. |
323 |
extern void my_message(uint32_t my_err, const char *str,myf MyFlags); |
324 |
extern void my_message_no_curses(uint32_t my_err, const char *str,myf MyFlags); |
|
146
by Brian Aker
my_bool cleanup. |
325 |
extern bool my_init(void); |
1
by brian
clean slate |
326 |
extern void my_end(int infoflag); |
327 |
extern int my_redel(const char *from, const char *to, int MyFlags); |
|
328 |
extern int my_copystat(const char *from, const char *to, int MyFlags); |
|
329 |
extern char * my_filename(File fd); |
|
330 |
||
331 |
#ifdef EXTRA_DEBUG
|
|
332 |
void my_print_open_files(void); |
|
333 |
#else
|
|
334 |
#define my_print_open_files()
|
|
335 |
#endif
|
|
336 |
||
779.2.11
by Monty Taylor
General build cleanup - removed cruft, removed depreated checks. |
337 |
extern void my_remember_signal(int signal_number,void (*func)(int)); |
1
by brian
clean slate |
338 |
extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); |
339 |
extern size_t dirname_length(const char *name); |
|
340 |
#define base_name(A) (A+dirname_length(A))
|
|
1022.2.29
by Monty Taylor
Fixed some no-inline warnings. |
341 |
bool test_if_hard_path(const char *dir_name); |
779.1.19
by Monty Taylor
Removed stuff that gcov showed we weren't using. |
342 |
|
1
by brian
clean slate |
343 |
extern char *convert_dirname(char *to, const char *from, const char *from_end); |
344 |
extern char * fn_ext(const char *name); |
|
345 |
extern char * fn_same(char * toname,const char *name,int flag); |
|
346 |
extern char * fn_format(char * to,const char *name,const char *dir, |
|
482
by Brian Aker
Remove uint. |
347 |
const char *form, uint32_t flag); |
1
by brian
clean slate |
348 |
extern size_t strlength(const char *str); |
349 |
extern size_t unpack_dirname(char * to,const char *from); |
|
350 |
extern size_t cleanup_dirname(char * to,const char *from); |
|
351 |
extern size_t system_filename(char * to,const char *from); |
|
352 |
extern size_t unpack_filename(char * to,const char *from); |
|
353 |
extern char * intern_filename(char * to,const char *from); |
|
354 |
extern char * directory_file_name(char * dst, const char *src); |
|
355 |
extern int pack_filename(char * to, const char *name, size_t max_length); |
|
356 |
extern char * my_load_path(char * to, const char *path, |
|
357 |
const char *own_path_prefix); |
|
358 |
extern int wild_compare(const char *str,const char *wildstr, |
|
154
by Brian Aker
Removed oddball types in my_global.h |
359 |
bool str_is_pattern); |
1
by brian
clean slate |
360 |
extern WF_PACK *wf_comp(char * str); |
361 |
extern int wf_test(struct wild_file_pack *wf_pack,const char *name); |
|
362 |
extern void wf_end(struct wild_file_pack *buffer); |
|
146
by Brian Aker
my_bool cleanup. |
363 |
extern bool array_append_string_unique(const char *str, |
1
by brian
clean slate |
364 |
const char **array, size_t size); |
365 |
extern void get_date(char * to,int timeflag,time_t use_time); |
|
366 |
extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file, |
|
367 |
size_t reclength,enum cache_type type, |
|
154
by Brian Aker
Removed oddball types in my_global.h |
368 |
bool use_async_io); |
481
by Brian Aker
Remove all of uchar. |
369 |
extern int read_cache_record(RECORD_CACHE *info,unsigned char *to); |
1
by brian
clean slate |
370 |
extern int end_record_cache(RECORD_CACHE *info); |
371 |
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, |
|
481
by Brian Aker
Remove all of uchar. |
372 |
const unsigned char *record,size_t length); |
1
by brian
clean slate |
373 |
extern int flush_write_cache(RECORD_CACHE *info); |
779.2.11
by Monty Taylor
General build cleanup - removed cruft, removed depreated checks. |
374 |
extern void sigtstp_handler(int signal_number); |
1
by brian
clean slate |
375 |
extern void handle_recived_signals(void); |
376 |
||
779.2.11
by Monty Taylor
General build cleanup - removed cruft, removed depreated checks. |
377 |
extern void my_set_alarm_variable(int signo); |
482
by Brian Aker
Remove uint. |
378 |
extern void my_string_ptr_sort(unsigned char *base,uint32_t items,size_t size); |
379 |
extern void radixsort_for_str_ptr(unsigned char* base[], uint32_t number_of_elements, |
|
481
by Brian Aker
Remove all of uchar. |
380 |
size_t size_of_element,unsigned char *buffer[]); |
779.2.11
by Monty Taylor
General build cleanup - removed cruft, removed depreated checks. |
381 |
extern void my_qsort(void *base_ptr, size_t total_elems, size_t size, |
382 |
qsort_cmp cmp); |
|
383 |
extern void my_qsort2(void *base_ptr, size_t total_elems, size_t size, |
|
384 |
qsort2_cmp cmp, void *cmp_argument); |
|
1
by brian
clean slate |
385 |
extern qsort2_cmp get_ptr_compare(size_t); |
481
by Brian Aker
Remove all of uchar. |
386 |
void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos); |
387 |
my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length); |
|
1034.1.8
by Brian Aker
Remove locks around my_open(). Open file counts are now "best effort" (not |
388 |
File create_temp_file(char *to, const char *dir, const char *pfx, myf MyFlags); |
1089.1.12
by Brian Aker
Refactor dynamic out to its own files. |
389 |
|
390 |
#include <mysys/dynamic_array.h> |
|
1
by brian
clean slate |
391 |
|
392 |
#define alloc_root_inited(A) ((A)->min_malloc != 0)
|
|
393 |
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
|
|
394 |
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
|
|
395 |
extern int get_defaults_options(int argc, char **argv, |
|
396 |
char **defaults, char **extra_defaults, |
|
397 |
char **group_suffix); |
|
398 |
extern int load_defaults(const char *conf_file, const char **groups, |
|
399 |
int *argc, char ***argv); |
|
400 |
extern int my_search_option_files(const char *conf_file, int *argc, |
|
482
by Brian Aker
Remove uint. |
401 |
char ***argv, uint32_t *args_used, |
1
by brian
clean slate |
402 |
Process_option_func func, void *func_ctx); |
403 |
extern void free_defaults(char **argv); |
|
404 |
extern void my_print_default_files(const char *conf_file); |
|
405 |
extern void print_defaults(const char *conf_file, const char **groups); |
|
481
by Brian Aker
Remove all of uchar. |
406 |
extern ha_checksum my_checksum(ha_checksum crc, const unsigned char *mem, |
1
by brian
clean slate |
407 |
size_t count); |
298
by Brian Aker
ulong conversion. |
408 |
extern void my_sleep(uint32_t m_seconds); |
1
by brian
clean slate |
409 |
void my_free_open_file_info(void); |
410 |
||
151
by Brian Aker
Ulonglong to uint64_t |
411 |
extern uint64_t my_getsystime(void); |
412 |
extern uint64_t my_micro_time(void); |
|
413 |
extern uint64_t my_micro_time_and_time(time_t *time_arg); |
|
414 |
time_t my_time_possible_from_micro(uint64_t microtime); |
|
1
by brian
clean slate |
415 |
|
416 |
#ifdef HAVE_SYS_MMAN_H
|
|
417 |
#include <sys/mman.h> |
|
418 |
||
419 |
#ifndef MAP_NOSYNC
|
|
420 |
#define MAP_NOSYNC 0
|
|
421 |
#endif
|
|
422 |
#ifndef MAP_NORESERVE
|
|
423 |
#define MAP_NORESERVE 0 /* For irix and AIX */ |
|
424 |
#endif
|
|
425 |
||
426 |
#ifdef HAVE_MMAP64
|
|
427 |
#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f)
|
|
428 |
#else
|
|
429 |
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
|
|
430 |
#endif
|
|
431 |
#define my_munmap(a,b) munmap((a),(b))
|
|
432 |
||
433 |
#else
|
|
434 |
/* not a complete set of mmap() flags, but only those that nesessary */
|
|
435 |
#define PROT_READ 1
|
|
436 |
#define PROT_WRITE 2
|
|
437 |
#define MAP_NORESERVE 0
|
|
438 |
#define MAP_SHARED 0x0001
|
|
439 |
#define MAP_PRIVATE 0x0002
|
|
440 |
#define MAP_NOSYNC 0x0800
|
|
441 |
#define MAP_FAILED ((void *)-1)
|
|
442 |
#define MS_SYNC 0x0000
|
|
443 |
#define HAVE_MMAP
|
|
444 |
||
445 |
void *my_mmap(void *, size_t, int, int, int, my_off_t); |
|
446 |
int my_munmap(void *, size_t); |
|
447 |
#endif
|
|
448 |
||
449 |
/* character sets */
|
|
632.1.11
by Monty Taylor
Fixed Sun Studio warnings in mysys. |
450 |
void *cs_alloc(size_t size); |
451 |
||
482
by Brian Aker
Remove uint. |
452 |
extern uint32_t get_charset_number(const char *cs_name, uint32_t cs_flags); |
453 |
extern uint32_t get_collation_number(const char *name); |
|
454 |
extern const char *get_charset_name(uint32_t cs_number); |
|
1
by brian
clean slate |
455 |
|
862
by Brian Aker
Remove charset directory code. |
456 |
extern const CHARSET_INFO *get_charset(uint32_t cs_number); |
457 |
extern const CHARSET_INFO *get_charset_by_name(const char *cs_name); |
|
458 |
extern const CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint32_t cs_flags); |
|
1
by brian
clean slate |
459 |
|
146
by Brian Aker
my_bool cleanup. |
460 |
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. |
461 |
const CHARSET_INFO *default_cs, |
462 |
const CHARSET_INFO **cs); |
|
146
by Brian Aker
my_bool cleanup. |
463 |
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. |
464 |
const CHARSET_INFO *default_cl, |
465 |
const CHARSET_INFO **cl); |
|
1
by brian
clean slate |
466 |
|
467 |
extern void free_charsets(void); |
|
468 |
extern char *get_charsets_dir(char *buf); |
|
236.3.9
by Andrey Hristov
- Fix build of exotic, mostly non-western, charsets (--with-extra-charsets) |
469 |
extern bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2); |
146
by Brian Aker
my_bool cleanup. |
470 |
extern bool init_compiled_charsets(myf flags); |
1
by brian
clean slate |
471 |
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) |
472 |
extern size_t escape_string_for_drizzle(const CHARSET_INFO *charset_info, |
473 |
char *to, size_t to_length, |
|
474 |
const char *from, size_t length); |
|
475 |
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 |
476 |
char *to, size_t to_length, |
477 |
const char *from, size_t length); |
|
1
by brian
clean slate |
478 |
|
298
by Brian Aker
ulong conversion. |
479 |
extern void thd_increment_bytes_sent(uint32_t length); |
480 |
extern void thd_increment_bytes_received(uint32_t length); |
|
481 |
extern void thd_increment_net_big_packet_count(uint32_t length); |
|
1
by brian
clean slate |
482 |
|
398.1.9
by Monty Taylor
Cleaned up stuff out of global.h. |
483 |
#ifdef __cplusplus
|
484 |
}
|
|
485 |
#endif
|
|
486 |
||
1
by brian
clean slate |
487 |
#endif /* _my_sys_h */ |