1 /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23 #ifndef _my_sys_h
24 #define _my_sys_h
25
26 #include "my_global.h" /* C_MODE_START, C_MODE_END */
27
28 C_MODE_START
29
30 #ifdef HAVE_AIOWAIT
31 #include <sys/asynch.h> /* Used by record-cache */
32 typedef struct my_aio_result {
33 aio_result_t result;
34 int pending;
35 } my_aio_result;
36 #endif
37
38 #ifdef HAVE_VALGRIND
39 # include <valgrind/memcheck.h>
40 # define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
41 # define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
42 # define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
43 # define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
44 #else /* HAVE_VALGRIND */
45 # define MEM_UNDEFINED(a,len) ((void) 0)
46 # define MEM_NOACCESS(a,len) ((void) 0)
47 # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
48 # define MEM_CHECK_DEFINED(a,len) ((void) 0)
49 #endif /* HAVE_VALGRIND */
50
51 #include <my_pthread.h>
52
53 #include <m_ctype.h> /* for CHARSET_INFO */
54 #include <stdarg.h>
55 #include <typelib.h>
56 #ifdef _WIN32
57 #include <malloc.h> /*for alloca*/
58 #endif
59 #include <sys/stat.h>
60
61 #define MY_INIT(name) { my_progname= name; my_init(); }
62
63 /**
64 Max length of an error message generated by mysys utilities.
65 Some mysys functions produce error messages. These mostly go
66 to stderr.
67 This constant defines the size of the buffer used to format
68 the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
69 since sometimes mysys errors are stored in the server diagnostics
70 area, and we would like to avoid unexpected truncation.
71 */
72 #define MYSYS_ERRMSG_SIZE (512)
73 #define MYSYS_STRERROR_SIZE (128)
74
75 #define MY_FILE_ERROR ((size_t) -1)
76
77 /* General bitmaps for my_func's */
78 #define MY_FFNF 1 /* Fatal if file not found */
79 #define MY_FNABP 2 /* Fatal if not all bytes read/writen */
80 #define MY_NABP 4 /* Error if not all bytes read/writen */
81 #define MY_FAE 8 /* Fatal if any error */
82 #define MY_WME 16 /* Write message on error */
83 #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
84 #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
85 #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */
86 #define MY_UNUSED 64 /* Unused (was support for RAID) */
87 #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
88 #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
89 #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
90 #define MY_COPYTIME 64 /* my_redel() copys time */
91 #define MY_DELETE_OLD 256 /* my_create_with_symlink() */
92 #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
93 #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
94 #define MY_REDEL_MAKE_BACKUP 256
95 #define MY_REDEL_NO_COPY_STAT 512 /* my_redel() doesn't call my_copystat() */
96 #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
97 #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
98 #define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
99 #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
100 #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
101 #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
102 #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
103 #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
104 #define MY_SYNC 4096 /* my_copy(): sync dst file */
105
106 #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
107 #define MY_GIVE_INFO 2 /* Give time info about process*/
108 #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
109
110 #define ME_HIGHBYTE 8 /* Shift for colours */
111 #define ME_NOCUR 1 /* Don't use curses message */
112 #define ME_OLDWIN 2 /* Use old window */
113 #define ME_BELL 4 /* Ring bell then printing message */
114 #define ME_HOLDTANG 8 /* Don't delete last keys */
115 #define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
116 #define ME_WAITTANG 32 /* Wait for a user action */
117 #define ME_NOREFRESH 64 /* Write the error message to error log */
118 #define ME_NOINPUT 128 /* Dont use the input libary */
119 #define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
120 #define ME_COLOUR2 ((2 << ME_HIGHBYTE))
121 #define ME_COLOUR3 ((3 << ME_HIGHBYTE))
122 #define ME_FATALERROR 1024 /* Fatal statement error */
123
124 /* Bits in last argument to fn_format */
125 #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
126 #define MY_REPLACE_EXT 2 /* replace extension with 'ext' */
127 #define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */
128 #define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */
129 #define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */
130 #define MY_RETURN_REAL_PATH 32 /* return full path for file */
131 #define MY_SAFE_PATH 64 /* Return NULL if too long path */
132 #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
133 #define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/
134
135
136 /* My seek flags */
137 #define MY_SEEK_SET 0
138 #define MY_SEEK_CUR 1
139 #define MY_SEEK_END 2
140
141 /* Some constants */
142 #define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
143 #define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
144 #define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
145 #define DFLT_INIT_HITS 3
146
147 /* root_alloc flags */
148 #define MY_KEEP_PREALLOC 1
149 #define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */
150
151 /* Internal error numbers (for assembler functions) */
152 #define MY_ERRNO_EDOM 33
153 #define MY_ERRNO_ERANGE 34
154
155 /* Bits for get_date timeflag */
156 #define GETDATE_DATE_TIME 1
157 #define GETDATE_SHORT_DATE 2
158 #define GETDATE_HHMMSSTIME 4
159 #define GETDATE_GMT 8
160 #define GETDATE_FIXEDLENGTH 16
161
162 /* defines when allocating data */
163 extern void *my_malloc(size_t Size,myf MyFlags);
164 extern void *my_multi_malloc(myf MyFlags, ...);
165 extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
166 extern void my_free(void *ptr);
167 extern void *my_memdup(const void *from,size_t length,myf MyFlags);
168 extern char *my_strdup(const char *from,myf MyFlags);
169 extern char *my_strndup(const char *from, size_t length,
170 myf MyFlags);
171
172 /*
173 Switch to my_malloc() if the memory block to be allocated is bigger than
174 max_alloca_sz.
175 */
176 #ifndef HAVE_ALLOCA
177 #define my_safe_alloca(size, max_alloca_sz) my_alloca(size)
178 #define my_safe_afree(ptr, size, max_alloca_sz) my_afree(ptr)
179 #else
180 #define my_safe_alloca(size, max_alloca_sz) ((size <= max_alloca_sz) ? \
181 my_alloca(size) : \
182 my_malloc(size, MYF(0)))
183 #define my_safe_afree(ptr, size, max_alloca_sz) if (size > max_alloca_sz) \
184 my_free(ptr)
185 #endif /* #ifndef HAVE_ALLOCA */
186
187 #if !defined(DBUG_OFF) || defined(HAVE_VALGRIND)
188 /**
189 Put bad content in memory to be sure it will segfault if dereferenced.
190 With Valgrind, verify that memory is addressable, and mark it undefined.
191 We cache value of B because if B is expression which depends on A, memset()
192 trashes value of B.
193 */
194 #define TRASH(A,B) do { \
195 const size_t l= (B); \
196 MEM_CHECK_ADDRESSABLE(A, l); \
197 memset(A, 0x8F, l); \
198 MEM_UNDEFINED(A, l); \
199 } while (0)
200 #else
201 #define TRASH(A,B) do {} while(0)
202 #endif
203 #if defined(ENABLED_DEBUG_SYNC)
204 extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
205 #define DEBUG_SYNC_C(_sync_point_name_) do { \
206 if (debug_sync_C_callback_ptr != NULL) \
207 (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \
208 while(0)
209 #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { \
210 if (debug_sync_C_callback_ptr != NULL && thd) \
211 (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \
212 while(0)
213 #else
214 #define DEBUG_SYNC_C(_sync_point_name_)
215 #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_)
216 #endif /* defined(ENABLED_DEBUG_SYNC) */
217
218 #ifdef HAVE_LARGE_PAGES
219 extern uint my_get_large_page_size(void);
220 extern uchar * my_large_malloc(size_t size, myf my_flags);
221 extern void my_large_free(uchar *ptr);
222 #else
223 #define my_get_large_page_size() (0)
224 #define my_large_malloc(A,B) my_malloc_lock((A),(B))
225 #define my_large_free(A) my_free_lock((A))
226 #endif /* HAVE_LARGE_PAGES */
227
228 #ifdef HAVE_ALLOCA
229 #if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
230 #pragma alloca
231 #endif /* _AIX */
232 #if defined(__MWERKS__)
233 #undef alloca
234 #define alloca _alloca
235 #endif /* __MWERKS__ */
236 #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
237 #define alloca __builtin_alloca
238 #endif /* GNUC */
239 #define my_alloca(SZ) alloca((size_t) (SZ))
240 #define my_afree(PTR) {}
241 #else
242 #define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE))
243 #define my_afree(PTR) my_free(PTR)
244 #endif /* HAVE_ALLOCA */
245
246 #include <errno.h> /* errno is a define */
247
248 extern char *home_dir; /* Home directory for user */
249 extern const char *my_progname; /* program-name (printed in errors) */
250 extern char curr_dir[]; /* Current directory for user */
251 extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
252 extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
253 myf MyFlags);
254 extern void(*sql_print_warning_hook)(const char *format,...);
255 extern uint my_file_limit;
256 extern ulong my_thread_stack_size;
257
258 extern void (*proc_info_hook)(void *, const PSI_stage_info *, PSI_stage_info *,
259 const char *, const char *, const unsigned int);
260
261 #ifdef HAVE_LARGE_PAGES
262 extern my_bool my_use_large_pages;
263 extern uint my_large_page_size;
264 #endif
265
266 /* charsets */
267 #define MY_ALL_CHARSETS_SIZE 2048
268 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
269 extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE];
270 extern CHARSET_INFO compiled_charsets[];
271
272 /* statistics */
273 extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
274 extern ulong my_file_total_opened;
275 extern my_bool my_init_done;
276
277 /* Point to current my_message() */
278 extern void (*my_sigtstp_cleanup)(void),
279 /* Executed before jump to shell */
280 (*my_sigtstp_restart)(void),
281 (*my_abort_hook)(int);
282 /* Executed when comming from shell */
283 extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */
284 extern int my_umask_dir,
285 my_recived_signals, /* Signals we have got */
286 my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
287 my_dont_interrupt; /* call remember_intr when set */
288 extern my_bool my_use_symdir;
289
290 extern ulong my_default_record_cache_size;
291 extern my_bool my_disable_locking, my_disable_async_io,
292 my_disable_flush_key_blocks, my_disable_symlinks;
293 extern char wild_many,wild_one,wild_prefix;
294 extern const char *charsets_dir;
295
296 extern my_bool timed_mutexes;
297
298 enum cache_type
299 {
300 TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE,
301 SEQ_READ_APPEND /* sequential read or append */,
302 READ_FIFO, READ_NET,WRITE_NET};
303
304 enum flush_type
305 {
306 FLUSH_KEEP, /* flush block and keep it in the cache */
307 FLUSH_RELEASE, /* flush block and remove it from the cache */
308 FLUSH_IGNORE_CHANGED, /* remove block from the cache */
309 /*
310 As my_disable_flush_pagecache_blocks is always 0, the following option
311 is strictly equivalent to FLUSH_KEEP
312 */
313 FLUSH_FORCE_WRITE
314 };
315
316 typedef struct st_record_cache /* Used when cacheing records */
317 {
318 File file;
319 int rc_seek,error,inited;
320 uint rc_length,read_length,reclength;
321 my_off_t rc_record_pos,end_of_file;
322 uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
323 #ifdef HAVE_AIOWAIT
324 int use_async_io;
325 my_aio_result aio_result;
326 #endif
327 enum cache_type type;
328 } RECORD_CACHE;
329
330 enum file_type
331 {
332 UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN,
333 FILE_BY_MKSTEMP, FILE_BY_DUP
334 };
335
336 struct st_my_file_info
337 {
338 char *name;
339 #ifdef _WIN32
340 HANDLE fhandle; /* win32 file handle */
341 int oflag; /* open flags, e.g O_APPEND */
342 #endif
343 enum file_type type;
344 #if !defined(HAVE_PREAD) && !defined(_WIN32)
345 mysql_mutex_t mutex;
346 #endif
347 };
348
349 extern struct st_my_file_info *my_file_info;
350
351 typedef struct st_dynamic_array
352 {
353 uchar *buffer;
354 uint elements,max_element;
355 uint alloc_increment;
356 uint size_of_element;
357 } DYNAMIC_ARRAY;
358
359 typedef struct st_my_tmpdir
360 {
361 DYNAMIC_ARRAY full_list;
362 char **list;
363 uint cur, max;
364 mysql_mutex_t mutex;
365 } MY_TMPDIR;
366
367 typedef struct st_dynamic_string
368 {
369 char *str;
370 size_t length,max_length,alloc_increment;
371 } DYNAMIC_STRING;
372
373 struct st_io_cache;
374 typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
375
376 typedef struct st_io_cache_share
377 {
378 mysql_mutex_t mutex; /* To sync on reads into buffer. */
379 mysql_cond_t cond; /* To wait for signals. */
380 mysql_cond_t cond_writer; /* For a synchronized writer. */
381 /* Offset in file corresponding to the first byte of buffer. */
382 my_off_t pos_in_file;
383 /* If a synchronized write cache is the source of the data. */
384 struct st_io_cache *source_cache;
385 uchar *buffer; /* The read buffer. */
386 uchar *read_end; /* Behind last valid byte of buffer. */
387 int running_threads; /* threads not in lock. */
388 int total_threads; /* threads sharing the cache. */
389 int error; /* Last error. */
390 #ifdef NOT_YET_IMPLEMENTED
391 /* whether the structure should be free'd */
392 my_bool alloced;
393 #endif
394 } IO_CACHE_SHARE;
395
396 typedef struct st_io_cache /* Used when cacheing files */
397 {
398 /* Offset in file corresponding to the first byte of uchar* buffer. */
399 my_off_t pos_in_file;
400 /*
401 The offset of end of file for READ_CACHE and WRITE_CACHE.
402 For SEQ_READ_APPEND it the maximum of the actual end of file and
403 the position represented by read_end.
404 */
405 my_off_t end_of_file;
406 /* Points to current read position in the buffer */
407 uchar *read_pos;
408 /* the non-inclusive boundary in the buffer for the currently valid read */
409 uchar *read_end;
410 uchar *buffer; /* The read buffer */
411 /* Used in ASYNC_IO */
412 uchar *request_pos;
413
414 /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
415 uchar *write_buffer;
416 /*
417 Only used in SEQ_READ_APPEND, and points to the current read position
418 in the write buffer. Note that reads in SEQ_READ_APPEND caches can
419 happen from both read buffer (uchar* buffer) and write buffer
420 (uchar* write_buffer).
421 */
422 uchar *append_read_pos;
423 /* Points to current write position in the write buffer */
424 uchar *write_pos;
425 /* The non-inclusive boundary of the valid write area */
426 uchar *write_end;
427
428 /*
429 Current_pos and current_end are convenience variables used by
430 my_b_tell() and other routines that need to know the current offset
431 current_pos points to &write_pos, and current_end to &write_end in a
432 WRITE_CACHE, and &read_pos and &read_end respectively otherwise
433 */
434 uchar **current_pos, **current_end;
435
436 /*
437 The lock is for append buffer used in SEQ_READ_APPEND cache
438 need mutex copying from append buffer to read buffer.
439 */
440 mysql_mutex_t append_buffer_lock;
441 /*
442 The following is used when several threads are reading the
443 same file in parallel. They are synchronized on disk
444 accesses reading the cached part of the file asynchronously.
445 It should be set to NULL to disable the feature. Only
446 READ_CACHE mode is supported.
447 */
448 IO_CACHE_SHARE *share;
449
450 /*
451 A caller will use my_b_read() macro to read from the cache
452 if the data is already in cache, it will be simply copied with
453 memcpy() and internal variables will be accordinging updated with
454 no functions invoked. However, if the data is not fully in the cache,
455 my_b_read() will call read_function to fetch the data. read_function
456 must never be invoked directly.
457 */
458 int (*read_function)(struct st_io_cache *,uchar *,size_t);
459 /*
460 Same idea as in the case of read_function, except my_b_write() needs to
461 be replaced with my_b_append() for a SEQ_READ_APPEND cache
462 */
463 int (*write_function)(struct st_io_cache *,const uchar *,size_t);
464 /*
465 Specifies the type of the cache. Depending on the type of the cache
466 certain operations might not be available and yield unpredicatable
467 results. Details to be documented later
468 */
469 enum cache_type type;
470 /*
471 Callbacks when the actual read I/O happens. These were added and
472 are currently used for binary logging of LOAD DATA INFILE - when a
473 block is read from the file, we create a block create/append event, and
474 when IO_CACHE is closed, we create an end event. These functions could,
475 of course be used for other things
476 */
477 IO_CACHE_CALLBACK pre_read;
478 IO_CACHE_CALLBACK post_read;
479 IO_CACHE_CALLBACK pre_close;
480 /*
481 Counts the number of times, when we were forced to use disk. We use it to
482 increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
483 variables.
484 */
485 ulong disk_writes;
486 void* arg; /* for use by pre/post_read */
487 char *file_name; /* if used with 'open_cached_file' */
488 char *dir,*prefix;
489 File file; /* file descriptor */
490 /*
491 seek_not_done is set by my_b_seek() to inform the upcoming read/write
492 operation that a seek needs to be preformed prior to the actual I/O
493 error is 0 if the cache operation was successful, -1 if there was a
494 "hard" error, and the actual number of I/O-ed bytes if the read/write was
495 partial.
496 */
497 int seek_not_done,error;
498 /* buffer_length is memory size allocated for buffer or write_buffer */
499 size_t buffer_length;
500 /* read_length is the same as buffer_length except when we use async io */
501 size_t read_length;
502 myf myflags; /* Flags used to my_read/my_write */
503 /*
504 alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
505 0 if it was supplied by the user.
506 Currently READ_NET is the only one that will use a buffer allocated
507 somewhere else
508 */
509 my_bool alloced_buffer;
510 #ifdef HAVE_AIOWAIT
511 /*
512 As inidicated by ifdef, this is for async I/O, which is not currently
513 used (because it's not reliable on all systems)
514 */
515 uint inited;
516 my_off_t aio_read_pos;
517 my_aio_result aio_result;
518 #endif
519 } IO_CACHE;
520
521 typedef int (*qsort2_cmp)(const void *, const void *, const void *);
522
523 /*
524 Subset of struct stat fields filled by stat/lstat/fstat that uniquely
525 identify a file
526 */
527 typedef struct st_file_id
528 {
529 dev_t st_dev;
530 ino_t st_ino;
531 } ST_FILE_ID;
532
533 typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
534 ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
535
536 extern my_error_reporter my_charset_error_reporter;
537
538 /* defines for mf_iocache */
539
540 /* Test if buffer is inited */
541 #define my_b_clear(info) (info)->buffer=0
542 #define my_b_inited(info) (info)->buffer
543 #define my_b_EOF INT_MIN
544
545 #define my_b_read(info,Buffer,Count) \
546 ((info)->read_pos + (Count) <= (info)->read_end ?\
547 (memcpy(Buffer,(info)->read_pos,(size_t) (Count)), \
548 ((info)->read_pos+=(Count)),0) :\
549 (*(info)->read_function)((info),Buffer,Count))
550
551 #define my_b_write(info,Buffer,Count) \
552 ((info)->write_pos + (Count) <=(info)->write_end ?\
553 (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
554 ((info)->write_pos+=(Count)),0) : \
555 (*(info)->write_function)((info),(uchar *)(Buffer),(Count)))
556
557 #define my_b_get(info) \
558 ((info)->read_pos != (info)->read_end ?\
559 ((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
560 _my_b_get(info))
561
562 /* my_b_write_byte dosn't have any err-check */
563 #define my_b_write_byte(info,chr) \
564 (((info)->write_pos < (info)->write_end) ?\
565 ((*(info)->write_pos++)=(chr)) :\
566 (_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr))))
567
568 #define my_b_fill_cache(info) \
569 (((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0))
570
571 #define my_b_tell(info) ((info)->pos_in_file + \
572 (size_t) (*(info)->current_pos - (info)->request_pos))
573
574 #define my_b_get_buffer_start(info) (info)->request_pos
575 #define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \
576 (char*) my_b_get_buffer_start(info)
577 #define my_b_get_pos_in_file(info) (info)->pos_in_file
578
579 /* tell write offset in the SEQ_APPEND cache */
580 int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
581 my_off_t my_b_append_tell(IO_CACHE* info);
582 my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
583
584 #define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
585 *(info)->current_pos)
586
587 typedef uint32 ha_checksum;
588
589 #include <my_alloc.h>
590
591
592 /* Prototypes for mysys and my_func functions */
593
594 extern int my_copy(const char *from,const char *to,myf MyFlags);
595 extern int my_delete(const char *name,myf MyFlags);
596 extern int my_getwd(char * buf,size_t size,myf MyFlags);
597 extern int my_setwd(const char *dir,myf MyFlags);
598 extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
599 extern void *my_once_alloc(size_t Size,myf MyFlags);
600 extern void my_once_free(void);
601 extern char *my_once_strdup(const char *src,myf myflags);
602 extern void *my_once_memdup(const void *src, size_t len, myf myflags);
603 extern File my_open(const char *FileName,int Flags,myf MyFlags);
604 extern File my_register_filename(File fd, const char *FileName,
605 enum file_type type_of_file,
606 uint error_message_number, myf MyFlags);
607 extern File my_create(const char *FileName,int CreateFlags,
608 int AccessFlags, myf MyFlags);
609 extern int my_close(File Filedes,myf MyFlags);
610 extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
611 extern int my_readlink(char *to, const char *filename, myf MyFlags);
612 extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id);
613 extern int my_realpath(char *to, const char *filename, myf MyFlags);
614 extern int my_is_same_file(File file, const ST_FILE_ID *file_id);
615 extern File my_create_with_symlink(const char *linkname, const char *filename,
616 int createflags, int access_flags,
617 myf MyFlags);
618 extern int my_delete_with_symlink(const char *name, myf MyFlags);
619 extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
620 extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
621 extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
622 extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
623 myf MyFlags);
624 extern int my_rename(const char *from,const char *to,myf MyFlags);
625 extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
626 extern my_off_t my_tell(File fd,myf MyFlags);
627 extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count,
628 myf MyFlags);
629 extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count,
630 my_off_t offset,myf MyFlags);
631 extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags);
632 extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
633 myf MyFlags);
634 extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
635 extern my_off_t my_ftell(FILE *stream,myf MyFlags);
636
637 /* implemented in my_memmem.c */
638 extern void *my_memmem(const void *haystack, size_t haystacklen,
639 const void *needle, size_t needlelen);
640
641
642 #ifdef _WIN32
643 extern int my_access(const char *path, int amode);
644 #else
645 #define my_access access
646 #endif
647
648 extern int check_if_legal_filename(const char *path);
649 extern int check_if_legal_tablename(const char *path);
650
651 #ifdef __WIN__
652 extern my_bool is_filename_allowed(const char *name, size_t length,
653 my_bool allow_current_dir);
654 #else /* __WIN__ */
655 # define is_filename_allowed(name, length, allow_cwd) (TRUE)
656 #endif /* __WIN__ */
657
658 #ifdef _WIN32
659 extern int nt_share_delete(const char *name,myf MyFlags);
660 #define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags))
661 #else
662 #define my_delete_allow_opened(fname,flags) my_delete((fname),(flags))
663 #endif
664
665 #ifdef _WIN32
666 /* Windows-only functions (CRT equivalents)*/
667 extern HANDLE my_get_osfhandle(File fd);
668 extern void my_osmaperr(unsigned long last_error);
669 #endif
670
671 extern void init_glob_errs(void);
672 extern const char** get_global_errmsgs();
673 extern void wait_for_free_space(const char *filename, int errors);
674 extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
675 extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
676 extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
677 extern int my_fclose(FILE *fd,myf MyFlags);
678 extern File my_fileno(FILE *fd);
679 extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
680 extern void thr_set_sync_wait_callback(void (*before_sync)(void),
681 void (*after_sync)(void));
682 extern int my_sync(File fd, myf my_flags);
683 extern int my_sync_dir(const char *dir_name, myf my_flags);
684 extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
685 extern char *my_strerror(char *buf, size_t len, int errnum);
686 extern const char *my_get_err_msg(int nr);
687 extern void my_error(int nr,myf MyFlags, ...);
688 extern void my_printf_error(uint my_err, const char *format,
689 myf MyFlags, ...)
690 ATTRIBUTE_FORMAT(printf, 2, 4);
691 extern void my_printv_error(uint error, const char *format, myf MyFlags,
692 va_list ap);
693 extern int my_error_register(const char** (*get_errmsgs) (),
694 int first, int last);
695 extern void my_printf_warning (const char * format, ...);
696 extern const char **my_error_unregister(int first, int last);
697 extern void my_message(uint my_err, const char *str,myf MyFlags);
698 extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
699 extern my_bool my_init(void);
700 extern void my_end(int infoflag);
701 extern int my_redel(const char *from, const char *to, int MyFlags);
702 extern int my_copystat(const char *from, const char *to, int MyFlags);
703 extern char * my_filename(File fd);
704
705 #ifdef EXTRA_DEBUG
706 void my_print_open_files(void);
707 #else
708 #define my_print_open_files()
709 #endif
710
711 extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
712 extern char *my_tmpdir(MY_TMPDIR *tmpdir);
713 extern void free_tmpdir(MY_TMPDIR *tmpdir);
714
715 extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
716 extern size_t dirname_part(char * to,const char *name, size_t *to_res_length);
717 extern size_t dirname_length(const char *name);
718 #define base_name(A) (A+dirname_length(A))
719 extern int test_if_hard_path(const char *dir_name);
720 extern my_bool has_path(const char *name);
721 extern char *convert_dirname(char *to, const char *from, const char *from_end);
722 extern void to_unix_path(char * name);
723 extern char * fn_ext(const char *name);
724 extern char * fn_same(char * toname,const char *name,int flag);
725 extern char * fn_format(char * to,const char *name,const char *dir,
726 const char *form, uint flag);
727 extern size_t strlength(const char *str);
728 extern void pack_dirname(char * to,const char *from);
729 extern size_t normalize_dirname(char * to, const char *from);
730 extern size_t unpack_dirname(char * to,const char *from, my_bool *is_symdir);
731 extern size_t cleanup_dirname(char * to,const char *from);
732 extern size_t system_filename(char * to,const char *from);
733 extern size_t unpack_filename(char * to,const char *from);
734 extern char * intern_filename(char * to,const char *from);
735 extern int pack_filename(char * to, const char *name, size_t max_length);
736 extern char * my_path(char * to,const char *progname,
737 const char *own_pathname_part);
738 extern char * my_load_path(char * to, const char *path,
739 const char *own_path_prefix);
740 extern int wild_compare(const char *str,const char *wildstr,
741 pbool str_is_pattern);
742 extern my_bool array_append_string_unique(const char *str,
743 const char **array, size_t size);
744 extern void get_date(char * to,int timeflag,time_t use_time);
745 extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr,
746 pbool remove_garbage);
747 extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file,
748 size_t reclength,enum cache_type type,
749 pbool use_async_io);
750 extern int read_cache_record(RECORD_CACHE *info,uchar *to);
751 extern int end_record_cache(RECORD_CACHE *info);
752 extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
753 const uchar *record,size_t length);
754 extern int flush_write_cache(RECORD_CACHE *info);
755 extern void handle_recived_signals(void);
756
757 extern sig_handler my_set_alarm_variable(int signo);
758 extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element);
759 extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
760 extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
761 size_t size_of_element,uchar *buffer[]);
762 extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size,
763 qsort_cmp cmp);
764 extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size,
765 qsort2_cmp cmp, const void *cmp_argument);
766 extern qsort2_cmp get_ptr_compare(size_t);
767 void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
768 my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
769 extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
770 enum cache_type type,my_off_t seek_offset,
771 pbool use_async_io, myf cache_myflags);
772 extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
773 my_off_t seek_offset,pbool use_async_io,
774 pbool clear_cache);
775 extern void setup_io_cache(IO_CACHE* info);
776 extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
777 extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count);
778 extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
779 IO_CACHE *write_cache, uint num_threads);
780 extern void remove_io_thread(IO_CACHE *info);
781 extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count);
782 extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count);
783 extern int _my_b_get(IO_CACHE *info);
784 extern int _my_b_async_read(IO_CACHE *info,uchar *Buffer,size_t Count);
785 extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
786 extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count);
787 extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
788
789 extern int my_block_write(IO_CACHE *info, const uchar *Buffer,
790 size_t Count, my_off_t pos);
791 extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
792
793 #define flush_io_cache(info) my_b_flush_io_cache((info),1)
794
795 extern int end_io_cache(IO_CACHE *info);
796 extern size_t my_b_fill(IO_CACHE *info);
797 extern void my_b_seek(IO_CACHE *info,my_off_t pos);
798 extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
799 extern my_off_t my_b_filelength(IO_CACHE *info);
800 extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...)
801 ATTRIBUTE_FORMAT(printf, 2, 3);
802 extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
803 extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
804 const char *prefix, size_t cache_size,
805 myf cache_myflags);
806 extern my_bool real_open_cached_file(IO_CACHE *cache);
807 extern void close_cached_file(IO_CACHE *cache);
808 File create_temp_file(char *to, const char *dir, const char *pfx,
809 int mode, myf MyFlags);
810 #define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
811 #define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
812 #define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
813 #define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
814 extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
815 void *init_buffer, uint init_alloc,
816 uint alloc_increment);
817 /* init_dynamic_array() function is deprecated */
818 extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
819 uint init_alloc, uint alloc_increment);
820 extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element);
821 extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
822 extern void *pop_dynamic(DYNAMIC_ARRAY*);
823 extern my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element,
824 uint array_index);
825 extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
826 extern void get_dynamic(DYNAMIC_ARRAY *array, void *element,
827 uint array_index);
828 extern void delete_dynamic(DYNAMIC_ARRAY *array);
829 extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
830 extern void freeze_size(DYNAMIC_ARRAY *array);
831 #define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
832 #define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
833 #define push_dynamic(A,B) insert_dynamic((A),(B))
834 #define reset_dynamic(array) ((array)->elements= 0)
835 #define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
836
837 extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
838 size_t init_alloc,size_t alloc_increment);
839 extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
840 my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
841 size_t length);
842 extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
843 ...);
844 extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
845 extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
846 extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
847 extern void dynstr_free(DYNAMIC_STRING *str);
848 #ifdef HAVE_MLOCK
849 extern void *my_malloc_lock(size_t length,myf flags);
850 extern void my_free_lock(void *ptr);
851 #else
852 #define my_malloc_lock(A,B) my_malloc((A),(B))
853 #define my_free_lock(A) my_free((A))
854 #endif
855 #define alloc_root_inited(A) ((A)->min_malloc != 0)
856 #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
857 #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
858 extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
859 size_t pre_alloc_size);
860 extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
861 extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
862 extern void free_root(MEM_ROOT *root, myf MyFLAGS);
863 extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
864 extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
865 size_t prealloc_size);
866 extern char *strdup_root(MEM_ROOT *root,const char *str);
safe_strdup_root(MEM_ROOT * root,const char * str)867 static inline char *safe_strdup_root(MEM_ROOT *root, const char *str)
868 {
869 return str ? strdup_root(root, str) : 0;
870 }
871 extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len);
872 extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
873 extern my_bool my_compress(uchar *, size_t *, size_t *);
874 extern my_bool my_uncompress(uchar *, size_t , size_t *);
875 extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
876 size_t *complen);
877 extern int packfrm(uchar *, size_t, uchar **, size_t *);
878 extern int unpackfrm(uchar **, size_t *, const uchar *);
879
880 extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
881 size_t count);
882 extern void my_sleep(ulong m_seconds);
883 extern ulong crc32(ulong crc, const uchar *buf, uint len);
884 extern uint my_set_max_open_files(uint files);
885 void my_free_open_file_info(void);
886
887 extern time_t my_time(myf flags);
888 extern ulonglong my_getsystime(void);
889 extern ulonglong my_micro_time();
890 extern ulonglong my_micro_time_and_time(time_t *time_arg);
891 time_t my_time_possible_from_micro(ulonglong microtime);
892 extern my_bool my_gethwaddr(uchar *to);
893 extern int my_getncpus();
894
895 #ifdef HAVE_SYS_MMAN_H
896 #include <sys/mman.h>
897
898 #ifndef MAP_NOSYNC
899 #define MAP_NOSYNC 0
900 #endif
901 #ifndef MAP_NORESERVE
902 #define MAP_NORESERVE 0 /* For irix and AIX */
903 #endif
904
905 #ifdef HAVE_MMAP64
906 #define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f)
907 #else
908 #define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
909 #endif
910 #define my_munmap(a,b) munmap((a),(b))
911
912 #else
913 /* not a complete set of mmap() flags, but only those that nesessary */
914 #define PROT_READ 1
915 #define PROT_WRITE 2
916 #define MAP_NORESERVE 0
917 #define MAP_SHARED 0x0001
918 #define MAP_PRIVATE 0x0002
919 #define MAP_NOSYNC 0x0800
920 #define MAP_FAILED ((void *)-1)
921 #define MS_SYNC 0x0000
922
923 #define HAVE_MMAP
924 void *my_mmap(void *, size_t, int, int, int, my_off_t);
925 int my_munmap(void *, size_t);
926 #endif
927
928 /* my_getpagesize */
929 #ifdef HAVE_GETPAGESIZE
930 #define my_getpagesize() getpagesize()
931 #else
932 int my_getpagesize(void);
933 #endif
934
935 int my_msync(int, void *, size_t, int);
936
937 /* character sets */
938 extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader);
939 extern uint get_charset_number(const char *cs_name, uint cs_flags);
940 extern uint get_collation_number(const char *name);
941 extern const char *get_charset_name(uint cs_number);
942
943 extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
944 extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
945 extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader,
946 const char *name, myf flags);
947 extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
948 uint cs_flags, myf my_flags);
949 extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader,
950 const char *name,
951 uint cs_flags, myf my_flags);
952 extern my_bool resolve_charset(const char *cs_name,
953 const CHARSET_INFO *default_cs,
954 const CHARSET_INFO **cs);
955 extern my_bool resolve_collation(const char *cl_name,
956 const CHARSET_INFO *default_cl,
957 const CHARSET_INFO **cl);
958 extern void free_charsets(void);
959 extern char *get_charsets_dir(char *buf);
960 extern my_bool my_charset_same(const CHARSET_INFO *cs1,
961 const CHARSET_INFO *cs2);
962 extern my_bool init_compiled_charsets(myf flags);
963 extern void add_compiled_collation(CHARSET_INFO *cs);
964 extern size_t escape_string_for_mysql(const CHARSET_INFO *charset_info,
965 char *to, size_t to_length,
966 const char *from, size_t length);
967 #ifdef __WIN__
968 #define BACKSLASH_MBTAIL
969 /* File system character set */
970 extern CHARSET_INFO *fs_character_set(void);
971 #endif
972 extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
973 char *to, size_t to_length,
974 const char *from, size_t length);
975
976 extern void thd_increment_bytes_sent(ulong length);
977 extern void thd_increment_bytes_received(ulong length);
978
979 #ifdef __WIN__
980 extern my_bool have_tcpip; /* Is set if tcpip is used */
981
982 /* implemented in my_windac.c */
983
984 int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
985 DWORD owner_rights, DWORD everybody_rights);
986
987 void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
988
989 /* implemented in my_conio.c */
990 my_bool my_win_is_console(FILE *file);
991 char *my_win_console_readline(const CHARSET_INFO *cs, char *mbbuf, size_t mbbufsize);
992 void my_win_console_write(const CHARSET_INFO *cs, const char *data, size_t datalen);
993 void my_win_console_fputs(const CHARSET_INFO *cs, const char *data);
994 void my_win_console_putc(const CHARSET_INFO *cs, int c);
995 void my_win_console_vfprintf(const CHARSET_INFO *cs, const char *fmt, va_list args);
996 int my_win_translate_command_line_args(const CHARSET_INFO *cs, int *ac, char ***av);
997 #endif /* __WIN__ */
998
999 #include <mysql/psi/psi.h>
1000
1001 #ifdef HAVE_PSI_INTERFACE
1002 extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook;
1003 extern void set_psi_server(PSI *psi);
1004 void my_init_mysys_psi_keys(void);
1005 #endif
1006
1007 struct st_mysql_file;
1008 extern struct st_mysql_file *mysql_stdin;
1009
1010 enum durability_properties
1011 {
1012 /*
1013 Preserves the durability properties defined by the engine */
1014 HA_REGULAR_DURABILITY= 0,
1015 /*
1016 Ignore the durability properties defined by the engine and
1017 write only in-memory entries.
1018 */
1019 HA_IGNORE_DURABILITY= 1
1020 };
1021
1022 C_MODE_END
1023 #endif /* _my_sys_h */
1024