MySQL  8.0.17
Source Code Documentation
my_sys.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2019, 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 /**
27  @defgroup MYSYS Mysys - low level utilities for MySQL
28  @ingroup Runtime_Environment
29  @{
30  @file include/my_sys.h Common header for many mysys elements.
31  @note Many mysys implementation files now have their own header file.
32 */
33 
34 #include "my_config.h"
35 
36 #ifdef HAVE_ALLOCA_H
37 #include <alloca.h>
38 #endif
39 #include <limits.h>
40 #ifdef _WIN32
41 #include <malloc.h>
42 #endif
43 #ifdef HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46 #include <stdarg.h>
47 #include <stdio.h>
48 #ifdef HAVE_SYS_SELECT_H
49 #include <sys/select.h>
50 #endif
51 #include <sys/types.h>
52 #include <time.h>
53 
54 #include "m_string.h" /* IWYU pragma: keep */
55 #include "my_compiler.h"
56 #include "my_inttypes.h"
57 #include "my_loglevel.h"
58 #include "my_psi_config.h" /* IWYU pragma: keep */
59 #include "my_sharedlib.h"
66 #include "mysql/psi/psi_base.h"
67 #include "sql/stream_cipher.h"
68 
69 struct CHARSET_INFO;
70 struct MY_CHARSET_LOADER;
71 
72 struct PSI_cond_bootstrap;
74 struct PSI_error_bootstrap;
75 struct PSI_file_bootstrap;
76 struct PSI_idle_bootstrap;
77 struct PSI_mdl_bootstrap;
79 struct PSI_mutex_bootstrap;
82 struct PSI_stage_bootstrap;
85 struct PSI_table_bootstrap;
88 struct MEM_ROOT;
89 
90 #define MY_INIT(name) \
91  { \
92  my_progname = name; \
93  my_init(); \
94  }
95 
96 /**
97  Max length of an error message generated by mysys utilities.
98  Some mysys functions produce error messages. These mostly go
99  to stderr.
100  This constant defines the size of the buffer used to format
101  the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
102  since sometimes mysys errors are stored in the server diagnostics
103  area, and we would like to avoid unexpected truncation.
104 */
105 #define MYSYS_ERRMSG_SIZE (512)
106 #define MYSYS_STRERROR_SIZE (128)
107 
108 #define MY_FILE_ERROR ((size_t)-1)
109 
110 /* General bitmaps for my_func's */
111 #define MY_FFNF 1 /* Fatal if file not found */
112 #define MY_FNABP 2 /* Fatal if not all bytes read/writen */
113 #define MY_NABP 4 /* Error if not all bytes read/writen */
114 #define MY_FAE 8 /* Fatal if any error */
115 #define MY_WME 16 /* Write message on error */
116 #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
117 #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
118 #define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */
119 #define MY_REPORT_WAITING_IF_FULL 64 /* my_write: set status as waiting */
120 #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
121 #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
122 #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
123 #define MY_COPYTIME 64 /* my_redel() copys time */
124 #define MY_DELETE_OLD 256 /* my_create_with_symlink() */
125 #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
126 #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
127 #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
128 #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
129 #define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
130 #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
131 #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
132 #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
133 #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */
134 #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
135 #define MY_SYNC 4096 /* my_copy(): sync dst file */
136 
137 #define MYF_RW MYF(MY_WME + MY_NABP) /* For my_read & my_write */
138 
139 #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
140 #define MY_GIVE_INFO 2 /* Give time info about process*/
141 #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
142 
143 /* Flags for my_error() */
144 #define ME_BELL 4 /* DEPRECATED: Ring bell then printing message */
145 #define ME_ERRORLOG 64 /* Write the error message to error log */
146 #define ME_FATALERROR 1024 /* Fatal statement error */
147 
148 /* Bits in last argument to fn_format */
149 #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
150 #define MY_REPLACE_EXT 2 /* replace extension with 'ext' */
151 #define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */
152 /* 8 Unused. Previously used for MY_PACK_FILENAME. */
153 #define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */
154 #define MY_RETURN_REAL_PATH 32 /* return full path for file */
155 #define MY_SAFE_PATH 64 /* Return NULL if too long path */
156 #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
157 #define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/
158 
159 /* My seek flags */
160 #define MY_SEEK_SET 0
161 #define MY_SEEK_CUR 1
162 #define MY_SEEK_END 2
163 
164 /* Some constants */
165 #define MY_WAIT_FOR_USER_TO_FIX_PANIC 60 /* in seconds */
166 #define MY_WAIT_GIVE_USER_A_MESSAGE 10 /* Every 10 times of prev */
167 #define MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */
168 #define DFLT_INIT_HITS 3
169 
170 /* root_alloc flags */
171 #define MY_KEEP_PREALLOC 1
172 #define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */
173 
174 /* Internal error numbers (for assembler functions) */
175 #define MY_ERRNO_EDOM 33
176 #define MY_ERRNO_ERANGE 34
177 
178 /* defines when allocating data */
179 extern void *my_multi_malloc(PSI_memory_key key, myf flags, ...);
180 
181 /*
182  Switch to my_malloc() if the memory block to be allocated is bigger than
183  max_alloca_sz.
184 */
186 #define my_safe_alloca(size, max_alloca_sz) \
187  ((size <= max_alloca_sz) ? my_alloca(size) \
188  : my_malloc(key_memory_max_alloca, size, MYF(0)))
189 #define my_safe_afree(ptr, size, max_alloca_sz) \
190  if (size > max_alloca_sz) my_free(ptr)
191 
192 #if defined(ENABLED_DEBUG_SYNC)
193 extern "C" void (*debug_sync_C_callback_ptr)(const char *, size_t);
194 #define DEBUG_SYNC_C(_sync_point_name_) \
195  do { \
196  if (debug_sync_C_callback_ptr != NULL) \
197  (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); \
198  } while (0)
199 #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) \
200  do { \
201  if (debug_sync_C_callback_ptr != NULL && thd) \
202  (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); \
203  } while (0)
204 #else
205 #define DEBUG_SYNC_C(_sync_point_name_)
206 #define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_)
207 #endif /* defined(ENABLED_DEBUG_SYNC) */
208 
209 #ifdef HAVE_LINUX_LARGE_PAGES
210 extern uint my_get_large_page_size(void);
211 #else
212 #define my_get_large_page_size() (0)
213 #endif /* HAVE_LINUX_LARGE_PAGES */
214 
215 #define my_alloca(SZ) alloca((size_t)(SZ))
216 
217 extern char *home_dir; /* Home directory for user */
218 extern const char *my_progname; /* program-name (printed in errors) */
219 extern void (*error_handler_hook)(uint my_err, const char *str, myf MyFlags);
220 extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
221  myf MyFlags);
222 extern void (*local_message_hook)(enum loglevel ll, uint ecode, va_list args);
223 extern uint my_file_limit;
225 
226 /*
227  Hooks for reporting execution stage information. The server implementation
228  of these will also set THD::current_cond/current_mutex.
229  By having hooks, we avoid direct dependencies on server code.
230 */
231 extern void (*enter_cond_hook)(void *opaque_thd, mysql_cond_t *cond,
233  const PSI_stage_info *stage,
234  PSI_stage_info *old_stage,
235  const char *src_function, const char *src_file,
236  int src_line);
237 
238 extern void (*exit_cond_hook)(void *opaque_thd, const PSI_stage_info *stage,
239  const char *src_function, const char *src_file,
240  int src_line);
241 
242 extern void (*enter_stage_hook)(void *opaque_thd,
243  const PSI_stage_info *new_stage,
244  PSI_stage_info *old_stage,
245  const char *src_function, const char *src_file,
246  int src_line);
247 
248 /*
249  Hook for setting THD waiting_for_disk_space flag.
250 */
251 extern void (*set_waiting_for_disk_space_hook)(void *opaque_thd, bool waiting);
252 /*
253  Hook for checking if the thread has been killed.
254 */
255 extern int (*is_killed_hook)(const void *opaque_thd);
256 
257 /* charsets */
258 #define MY_ALL_CHARSETS_SIZE 2048
262 
263 /* statistics */
266 extern bool my_init_done;
267 
268 extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */
269 extern int my_umask_dir;
270 
273 
274 extern const char *charsets_dir;
275 
280  SEQ_READ_APPEND /* sequential read or append */,
284 };
285 
287  FLUSH_KEEP, /* flush block and keep it in the cache */
288  FLUSH_RELEASE, /* flush block and remove it from the cache */
289  FLUSH_IGNORE_CHANGED, /* remove block from the cache */
290  /*
291  As my_disable_flush_pagecache_blocks is always 0, the following option
292  is strictly equivalent to FLUSH_KEEP
293  */
295 };
296 
297 /*
298  How was this file opened (for debugging purposes).
299  The important part is whether it is UNOPEN or not.
300  */
301 enum file_type {
302  UNOPEN = 0,
309 };
310 
312  char *name;
313 #ifdef _WIN32
314  HANDLE fhandle; /* win32 file handle */
315  int oflag; /* open flags, e.g O_APPEND */
316 #endif
318 };
319 
320 extern struct st_my_file_info *my_file_info;
321 
323  uchar *buffer{nullptr};
328 };
329 
330 struct MY_TMPDIR {
331  char **list{nullptr};
332  uint cur{0}, max{0};
334 };
335 
337  char *str;
339 };
340 
341 struct IO_CACHE;
342 typedef int (*IO_CACHE_CALLBACK)(IO_CACHE *);
343 
345  mysql_mutex_t mutex; /* To sync on reads into buffer. */
346  mysql_cond_t cond; /* To wait for signals. */
347  mysql_cond_t cond_writer; /* For a synchronized writer. */
348  /* Offset in file corresponding to the first byte of buffer. */
350  /* If a synchronized write cache is the source of the data. */
352  uchar *buffer; /* The read buffer. */
353  uchar *read_end; /* Behind last valid byte of buffer. */
354  int running_threads; /* threads not in lock. */
355  int total_threads; /* threads sharing the cache. */
356  int error; /* Last error. */
357 };
358 
359 struct IO_CACHE /* Used when cacheing files */
360 {
361  /* Offset in file corresponding to the first byte of uchar* buffer. */
363  /*
364  The offset of end of file for READ_CACHE and WRITE_CACHE.
365  For SEQ_READ_APPEND it the maximum of the actual end of file and
366  the position represented by read_end.
367  */
369  /* Points to current read position in the buffer */
370  uchar *read_pos{nullptr};
371  /* the non-inclusive boundary in the buffer for the currently valid read */
372  uchar *read_end{nullptr};
373  uchar *buffer{nullptr}; /* The read buffer */
374  /* Used in ASYNC_IO */
375  uchar *request_pos{nullptr};
376 
377  /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
378  uchar *write_buffer{nullptr};
379  /*
380  Only used in SEQ_READ_APPEND, and points to the current read position
381  in the write buffer. Note that reads in SEQ_READ_APPEND caches can
382  happen from both read buffer (uchar* buffer) and write buffer
383  (uchar* write_buffer).
384  */
386  /* Points to current write position in the write buffer */
387  uchar *write_pos{nullptr};
388  /* The non-inclusive boundary of the valid write area */
389  uchar *write_end{nullptr};
390 
391  /*
392  Current_pos and current_end are convenience variables used by
393  my_b_tell() and other routines that need to know the current offset
394  current_pos points to &write_pos, and current_end to &write_end in a
395  WRITE_CACHE, and &read_pos and &read_end respectively otherwise
396  */
397  uchar **current_pos{nullptr}, **current_end{nullptr};
398 
399  /*
400  The lock is for append buffer used in SEQ_READ_APPEND cache
401  need mutex copying from append buffer to read buffer.
402  */
404  /*
405  The following is used when several threads are reading the
406  same file in parallel. They are synchronized on disk
407  accesses reading the cached part of the file asynchronously.
408  It should be set to NULL to disable the feature. Only
409  READ_CACHE mode is supported.
410  */
412 
413  /*
414  A caller will use my_b_read() macro to read from the cache
415  if the data is already in cache, it will be simply copied with
416  memcpy() and internal variables will be accordinging updated with
417  no functions invoked. However, if the data is not fully in the cache,
418  my_b_read() will call read_function to fetch the data. read_function
419  must never be invoked directly.
420  */
421  int (*read_function)(IO_CACHE *, uchar *, size_t){nullptr};
422  /*
423  Same idea as in the case of read_function, except my_b_write() needs to
424  be replaced with my_b_append() for a SEQ_READ_APPEND cache
425  */
426  int (*write_function)(IO_CACHE *, const uchar *, size_t){nullptr};
427  /*
428  Specifies the type of the cache. Depending on the type of the cache
429  certain operations might not be available and yield unpredicatable
430  results. Details to be documented later
431  */
433  /*
434  Callbacks when the actual read I/O happens. These were added and
435  are currently used for binary logging of LOAD DATA INFILE - when a
436  block is read from the file, we create a block create/append event, and
437  when IO_CACHE is closed, we create an end event. These functions could,
438  of course be used for other things
439  */
443  /*
444  Counts the number of times, when we were forced to use disk. We use it to
445  increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
446  variables.
447  */
449  void *arg{nullptr}; /* for use by pre/post_read */
450  char *file_name{nullptr}; /* if used with 'open_cached_file' */
451  char *dir{nullptr}, *prefix{nullptr};
452  File file{-1}; /* file descriptor */
453  PSI_file_key file_key{PSI_NOT_INSTRUMENTED}; /* instrumented file key */
454 
455  /*
456  seek_not_done is set by my_b_seek() to inform the upcoming read/write
457  operation that a seek needs to be preformed prior to the actual I/O
458  error is 0 if the cache operation was successful, -1 if there was a
459  "hard" error, and the actual number of I/O-ed bytes if the read/write was
460  partial.
461  */
462  bool seek_not_done{false};
463  int error{0};
464  /* buffer_length is memory size allocated for buffer or write_buffer */
465  size_t buffer_length{0};
466  /* read_length is the same as buffer_length except when we use async io */
467  size_t read_length{0};
468  myf myflags{0}; /* Flags used to my_read/my_write */
469  /*
470  alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
471  0 if it was supplied by the user.
472  Currently READ_NET is the only one that will use a buffer allocated
473  somewhere else
474  */
475  bool alloced_buffer{false};
476  // This is an encryptor for encrypting the temporary file of the IO cache.
478  // This is a decryptor for decrypting the temporary file of the IO cache.
480 };
481 
482 typedef int (*qsort2_cmp)(const void *, const void *, const void *);
483 
484 /*
485  Subset of struct stat fields filled by stat/lstat/fstat that uniquely
486  identify a file
487 */
488 struct ST_FILE_ID {
489  dev_t st_dev;
490  ino_t st_ino;
491 };
492 
493 typedef void (*my_error_reporter)(enum loglevel level, uint ecode, ...);
494 
496 
497 /* defines for mf_iocache */
499 
500 /* Test if buffer is inited */
501 inline void my_b_clear(IO_CACHE *info) { info->buffer = nullptr; }
502 
503 inline bool my_b_inited(const IO_CACHE *info) {
504  return info->buffer != nullptr;
505 }
506 
507 constexpr int my_b_EOF = INT_MIN;
508 
509 inline int my_b_read(IO_CACHE *info, uchar *buffer, size_t count) {
510  if (info->read_pos + count <= info->read_end) {
511  memcpy(buffer, info->read_pos, count);
512  info->read_pos += count;
513  return 0;
514  }
515  return (*info->read_function)(info, buffer, count);
516 }
517 
518 inline int my_b_write(IO_CACHE *info, const uchar *buffer, size_t count) {
519  if (info->write_pos + count <= info->write_end) {
520  memcpy(info->write_pos, buffer, count);
521  info->write_pos += count;
522  return 0;
523  }
524  return (*info->write_function)(info, buffer, count);
525 }
526 
527 extern int _my_b_get(IO_CACHE *info);
528 
529 inline int my_b_get(IO_CACHE *info) {
530  if (info->read_pos != info->read_end) {
531  info->read_pos++;
532  return info->read_pos[-1];
533  }
534  return _my_b_get(info);
535 }
536 
537 inline my_off_t my_b_tell(const IO_CACHE *info) {
538  return info->pos_in_file + *info->current_pos - info->request_pos;
539 }
540 
542  return info->request_pos;
543 }
544 
545 inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) {
546  return info->read_end - my_b_get_buffer_start(info);
547 }
548 
550  return info->pos_in_file;
551 }
552 
553 /* tell write offset in the SEQ_APPEND cache */
554 int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
555 
556 inline size_t my_b_bytes_in_cache(const IO_CACHE *info) {
557  return *info->current_end - *info->current_pos;
558 }
559 
561 
562 /*
563  How much overhead does malloc have. The code often allocates
564  something like 1024-MALLOC_OVERHEAD bytes
565 */
566 #define MALLOC_OVERHEAD 8
567 
568 /* Typical record cache */
569 #define RECORD_CACHE_SIZE (uint)(64 * 1024 - MALLOC_OVERHEAD)
570 
571 /** struct for once_alloc (block) */
572 struct USED_MEM {
573  USED_MEM *next; /**< Next block in use */
574  unsigned int left; /**< memory left in block */
575  unsigned int size; /**< size of block */
576 };
577 
578 /* Prototypes for mysys and my_func functions */
579 
580 extern int my_copy(const char *from, const char *to, myf MyFlags);
581 extern int my_delete(const char *name, myf MyFlags);
582 extern int my_getwd(char *buf, size_t size, myf MyFlags);
583 extern int my_setwd(const char *dir, myf MyFlags);
584 extern void *my_once_alloc(size_t Size, myf MyFlags);
585 extern void my_once_free(void);
586 extern char *my_once_strdup(const char *src, myf myflags);
587 extern void *my_once_memdup(const void *src, size_t len, myf myflags);
588 extern File my_open(const char *FileName, int Flags, myf MyFlags);
589 extern File my_register_filename(File fd, const char *FileName,
590  enum file_type type_of_file,
591  uint error_message_number, myf MyFlags);
592 extern File my_create(const char *FileName, int CreateFlags, int AccessFlags,
593  myf MyFlags);
594 extern int my_close(File Filedes, myf MyFlags);
595 extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
596 extern int my_readlink(char *to, const char *filename, myf MyFlags);
597 extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id);
598 extern int my_realpath(char *to, const char *filename, myf MyFlags);
599 extern int my_is_same_file(File file, const ST_FILE_ID *file_id);
600 extern File my_create_with_symlink(const char *linkname, const char *filename,
601  int createflags, int access_flags,
602  myf MyFlags);
603 extern int my_delete_with_symlink(const char *name, myf MyFlags);
604 extern int my_rename_with_symlink(const char *from, const char *to,
605  myf MyFlags);
606 #ifndef _WIN32
607 extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
608 #endif
609 extern size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags);
610 extern size_t my_pread(File Filedes, uchar *Buffer, size_t Count,
611  my_off_t offset, myf MyFlags);
612 extern int my_rename(const char *from, const char *to, myf MyFlags);
613 extern my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags);
614 extern my_off_t my_tell(File fd, myf MyFlags);
615 extern size_t my_write(File Filedes, const uchar *Buffer, size_t Count,
616  myf MyFlags);
617 extern size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count,
618  my_off_t offset, myf MyFlags);
619 extern size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags);
620 extern size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count,
621  myf MyFlags);
622 extern my_off_t my_fseek(FILE *stream, my_off_t pos, int whence);
623 extern my_off_t my_ftell(FILE *stream);
624 
625 /* implemented in my_syslog.c */
626 
627 // Maximum size of message that will be logged.
628 #define MAX_SYSLOG_MESSAGE_SIZE 1024
629 
630 /* Platform-independent SysLog support */
632 
633 extern int my_openlog(const char *eventSourceName, int option, int facility);
634 extern int my_closelog();
635 extern int my_syslog(const CHARSET_INFO *cs, enum loglevel level,
636  const char *msg);
637 
638 #ifdef _WIN32
639 extern int my_access(const char *path, int amode);
640 #else
641 #define my_access access
642 #endif
643 
644 extern int check_if_legal_filename(const char *path);
645 extern int check_if_legal_tablename(const char *path);
646 
647 #ifdef _WIN32
648 extern bool is_filename_allowed(const char *name, size_t length,
649  bool allow_current_dir);
650 #else /* _WIN32 */
651 #define is_filename_allowed(name, length, allow_cwd) (true)
652 #endif /* _WIN32 */
653 
654 #ifdef _WIN32
655 extern int nt_share_delete(const char *name, myf MyFlags);
656 #define my_delete_allow_opened(fname, flags) nt_share_delete((fname), (flags))
657 #else
658 #define my_delete_allow_opened(fname, flags) my_delete((fname), (flags))
659 #endif
660 
661 #ifdef _WIN32
662 /* Windows-only functions (CRT equivalents)*/
663 extern HANDLE my_get_osfhandle(File fd);
664 extern void my_osmaperr(unsigned long last_error);
665 #endif
666 
667 extern const char *get_global_errmsg(int nr);
668 extern void wait_for_free_space(const char *filename, int errors);
669 extern FILE *my_fopen(const char *FileName, int Flags, myf MyFlags);
670 extern FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags);
671 extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
672 extern int my_fclose(FILE *fd, myf MyFlags);
673 extern File my_fileno(FILE *fd);
674 extern int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
675 extern int my_fallocator(File fd, my_off_t newlength, int filler, myf MyFlags);
676 extern void thr_set_sync_wait_callback(void (*before_sync)(void),
677  void (*after_sync)(void));
678 extern int my_sync(File fd, myf my_flags);
679 extern int my_sync_dir(const char *dir_name, myf my_flags);
680 extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
681 extern char *my_strerror(char *buf, size_t len, int errnum);
682 extern const char *my_get_err_msg(int nr);
683 extern void my_error(int nr, myf MyFlags, ...);
684 extern void my_printf_error(uint my_err, const char *format, myf MyFlags, ...)
685  MY_ATTRIBUTE((format(printf, 2, 4)));
686 extern void my_printv_error(uint error, const char *format, myf MyFlags,
687  va_list ap) MY_ATTRIBUTE((format(printf, 2, 0)));
688 extern int my_error_register(const char *(*get_errmsg)(int), int first,
689  int last);
690 extern bool my_error_unregister(int first, int last);
691 extern void my_message(uint my_err, const char *str, myf MyFlags);
692 extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
693 void my_message_local_stderr(enum loglevel, uint ecode, va_list args);
694 extern void my_message_local(enum loglevel ll, uint ecode, ...);
695 extern bool my_init(void);
696 extern void my_end(int infoflag);
697 extern const char *my_filename(File fd);
698 extern MY_MODE get_file_perm(ulong perm_flags);
699 extern bool my_chmod(const char *filename, ulong perm_flags, myf my_flags);
700 
701 #ifdef EXTRA_DEBUG
702 void my_print_open_files(void);
703 #else
704 #define my_print_open_files()
705 #endif
706 
707 extern bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
708 extern char *my_tmpdir(MY_TMPDIR *tmpdir);
709 extern void free_tmpdir(MY_TMPDIR *tmpdir);
710 
711 extern size_t dirname_part(char *to, const char *name, size_t *to_res_length);
712 extern size_t dirname_length(const char *name);
713 #define base_name(A) (A + dirname_length(A))
714 extern int test_if_hard_path(const char *dir_name);
715 extern bool has_path(const char *name);
716 extern char *convert_dirname(char *to, const char *from, const char *from_end);
717 extern void to_unix_path(char *name);
718 extern char *fn_ext(char *name);
719 extern const char *fn_ext(const char *name);
720 extern char *fn_same(char *toname, const char *name, int flag);
721 extern char *fn_format(char *to, const char *name, const char *dir,
722  const char *form, uint flag);
723 extern size_t strlength(const char *str);
724 extern size_t normalize_dirname(char *to, const char *from);
725 extern size_t unpack_dirname(char *to, const char *from);
726 extern size_t cleanup_dirname(char *to, const char *from);
727 extern size_t system_filename(char *to, const char *from);
728 extern size_t unpack_filename(char *to, const char *from);
729 extern char *intern_filename(char *to, const char *from);
730 extern char *my_path(char *to, const char *progname,
731  const char *own_pathname_part);
732 extern char *my_load_path(char *to, const char *path,
733  const char *own_path_prefix);
734 extern bool array_append_string_unique(const char *str, const char **array,
735  size_t size);
736 
737 void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
738 my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
739 extern int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
740  enum cache_type type, my_off_t seek_offset,
741  bool use_async_io, myf cache_myflags,
742  PSI_file_key file_key);
743 extern int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
744  enum cache_type type, my_off_t seek_offset,
745  bool use_async_io, myf cache_myflags);
746 extern bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
747  my_off_t seek_offset, bool use_async_io,
748  bool clear_cache);
749 extern void setup_io_cache(IO_CACHE *info);
750 extern int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count);
751 extern int _my_b_read_r(IO_CACHE *info, uchar *Buffer, size_t Count);
752 extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
753  IO_CACHE *write_cache, uint num_threads);
754 extern void remove_io_thread(IO_CACHE *info);
755 extern int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, size_t Count);
756 extern int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count);
757 extern int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count);
758 extern int my_b_append(IO_CACHE *info, const uchar *Buffer, size_t Count);
759 extern int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count);
760 
761 extern int my_block_write(IO_CACHE *info, const uchar *Buffer, size_t Count,
762  my_off_t pos);
763 extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
764 
765 #define flush_io_cache(info) my_b_flush_io_cache((info), 1)
766 
767 extern int end_io_cache(IO_CACHE *info);
768 extern size_t my_b_fill(IO_CACHE *info);
769 extern void my_b_seek(IO_CACHE *info, my_off_t pos);
770 extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
772 extern size_t my_b_printf(IO_CACHE *info, const char *fmt, ...)
773  MY_ATTRIBUTE((format(printf, 2, 3)));
774 extern size_t my_b_vprintf(IO_CACHE *info, const char *fmt, va_list ap);
775 extern bool open_cached_file(IO_CACHE *cache, const char *dir,
776  const char *prefix, size_t cache_size,
777  myf cache_myflags);
778 extern bool real_open_cached_file(IO_CACHE *cache);
779 extern void close_cached_file(IO_CACHE *cache);
780 
782 File create_temp_file(char *to, const char *dir, const char *pfx, int mode,
783  UnlinkOrKeepFile unlink_or_keep, myf MyFlags);
784 
785 // Use Prealloced_array or std::vector or something similar in C++
787  uint element_size, void *init_buffer,
788  uint init_alloc, uint alloc_increment);
789 /* init_dynamic_array() function is deprecated */
790 
791 #define dynamic_element(array, array_index, type) \
792  ((type)((array)->buffer) + (array_index))
793 
794 /* Some functions are still in use in C++, because HASH uses DYNAMIC_ARRAY */
795 extern bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element);
796 extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
797 extern void *pop_dynamic(DYNAMIC_ARRAY *);
798 extern void claim_dynamic(DYNAMIC_ARRAY *array);
799 extern void delete_dynamic(DYNAMIC_ARRAY *array);
800 extern void freeze_size(DYNAMIC_ARRAY *array);
801 static inline void reset_dynamic(DYNAMIC_ARRAY *array) { array->elements = 0; }
802 
803 extern bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
804  size_t init_alloc, size_t alloc_increment);
805 extern bool dynstr_append(DYNAMIC_STRING *str, const char *append);
806 bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, size_t length);
807 extern bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
808  ...);
809 extern bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
810 extern bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
811 extern bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
812 extern void dynstr_free(DYNAMIC_STRING *str);
813 #define alloc_root_inited(A) ((A)->inited())
814 extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
815 extern char *strdup_root(MEM_ROOT *root, const char *str);
816 extern char *safe_strdup_root(MEM_ROOT *root, const char *str);
817 extern char *strmake_root(MEM_ROOT *root, const char *str, size_t len);
818 extern void *memdup_root(MEM_ROOT *root, const void *str, size_t len);
819 extern bool my_compress(uchar *, size_t *, size_t *);
820 extern bool my_uncompress(uchar *, size_t, size_t *);
821 extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
822  size_t *complen);
823 extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, size_t count);
824 
826 void my_free_open_file_info(void);
827 
828 extern bool my_gethwaddr(uchar *to);
829 
830 #ifdef HAVE_SYS_MMAN_H
831 #include <sys/mman.h>
832 
833 #ifndef MAP_NOSYNC
834 #define MAP_NOSYNC 0
835 #endif
836 
837 /*
838  Not defined in FreeBSD 11.
839  Was never implemented in FreeBSD, so we just set it to 0.
840 */
841 #ifndef MAP_NORESERVE
842 #define MAP_NORESERVE 0
843 #endif
844 
845 #ifdef HAVE_MMAP64
846 #define my_mmap(a, b, c, d, e, f) mmap64(a, b, c, d, e, f)
847 #else
848 #define my_mmap(a, b, c, d, e, f) mmap(a, b, c, d, e, f)
849 #endif
850 #define my_munmap(a, b) munmap((a), (b))
851 
852 #else
853 /* not a complete set of mmap() flags, but only those that nesessary */
854 #define PROT_READ 1
855 #define PROT_WRITE 2
856 #define MAP_NORESERVE 0
857 #define MAP_SHARED 0x0001
858 #define MAP_PRIVATE 0x0002
859 #define MAP_NOSYNC 0x0800
860 #define MAP_FAILED ((void *)-1)
861 #define MS_SYNC 0x0000
862 
863 void *my_mmap(void *, size_t, int, int, int, my_off_t);
864 int my_munmap(void *, size_t);
865 #endif
866 
867 /* my_getpagesize */
868 static inline int my_getpagesize() {
869 #ifndef _WIN32
870  return getpagesize();
871 #else
872  SYSTEM_INFO si;
873  GetSystemInfo(&si);
874  return (int)si.dwPageSize;
875 #endif
876 }
877 
878 int my_msync(int, void *, size_t, int);
879 
880 /* character sets */
882 extern uint get_charset_number(const char *cs_name, uint cs_flags);
883 extern uint get_collation_number(const char *name);
884 extern const char *get_charset_name(uint cs_number);
885 
886 extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
887 extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
889  const char *name, myf flags);
890 extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags,
891  myf my_flags);
893  const char *name, uint cs_flags,
894  myf my_flags);
895 extern bool resolve_charset(const char *cs_name, const CHARSET_INFO *default_cs,
896  const CHARSET_INFO **cs);
897 extern bool resolve_collation(const char *cl_name,
898  const CHARSET_INFO *default_cl,
899  const CHARSET_INFO **cl);
900 extern char *get_charsets_dir(char *buf);
901 extern bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2);
902 extern bool init_compiled_charsets(myf flags);
903 extern void add_compiled_collation(CHARSET_INFO *cs);
905  char *to, size_t to_length,
906  const char *from, size_t length);
907 extern void charset_uninit();
908 #ifdef _WIN32
909 /* File system character set */
910 extern CHARSET_INFO *fs_character_set(void);
911 #endif
912 extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to,
913  size_t to_length, const char *from,
914  size_t length, char quote);
915 #ifdef _WIN32
916 extern bool have_tcpip; /* Is set if tcpip is used */
917 
918 /* implemented in my_windac.c */
919 
920 int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
921  DWORD owner_rights, DWORD everybody_rights);
922 
923 void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
924 
925 /* implemented in my_conio.c */
926 bool my_win_is_console(FILE *file);
927 char *my_win_console_readline(const CHARSET_INFO *cs, char *mbbuf,
928  size_t mbbufsize, size_t *nread);
929 void my_win_console_write(const CHARSET_INFO *cs, const char *data,
930  size_t datalen);
931 void my_win_console_fputs(const CHARSET_INFO *cs, const char *data);
932 void my_win_console_putc(const CHARSET_INFO *cs, int c);
933 void my_win_console_vfprintf(const CHARSET_INFO *cs, const char *fmt,
934  va_list args);
935 int my_win_translate_command_line_args(const CHARSET_INFO *cs, int *ac,
936  char ***av);
937 #endif /* _WIN32 */
938 
939 #ifdef HAVE_PSI_INTERFACE
940 void my_init_mysys_psi_keys(void);
941 
943 extern void set_psi_cond_service(void *psi);
945 extern void set_psi_data_lock_service(void *psi);
947 extern void set_psi_error_service(void *psi);
949 extern void set_psi_file_service(void *psi);
951 extern void set_psi_idle_service(void *psi);
953 extern void set_psi_mdl_service(void *psi);
955 extern void set_psi_memory_service(void *psi);
957 extern void set_psi_mutex_service(void *psi);
959 extern void set_psi_rwlock_service(void *psi);
961 extern void set_psi_socket_service(void *psi);
963 extern void set_psi_stage_service(void *psi);
965 extern void set_psi_statement_service(void *psi);
967 extern void set_psi_system_service(void *psi);
969 extern void set_psi_table_service(void *psi);
971 extern void set_psi_thread_service(void *psi);
973 extern void set_psi_transaction_service(void *psi);
974 #endif /* HAVE_PSI_INTERFACE */
975 
976 struct MYSQL_FILE;
977 extern MYSQL_FILE *mysql_stdin;
978 
979 /**
980  @} (end of group MYSYS)
981 */
982 
983 // True if the temporary file of binlog cache is encrypted.
984 #ifndef DBUG_OFF
986 #endif
987 
988 /**
989  This is a wrapper around mysql_file_seek. Seek to a position in the
990  temporary file of a binlog cache, and set the encryption/decryption
991  stream offset if binlog_encryption is on.
992 
993  @param cache The handler of a binlog cache to seek.
994  @param pos The expected position (absolute or relative)
995  @param whence A direction parameter and one of
996  {SEEK_SET, SEEK_CUR, SEEK_END}
997  @param flags The bitmap of different flags
998  MY_WME | MY_FAE | MY_NABP | MY_FNABP |
999  MY_DONT_CHECK_FILESIZE and so on.
1000 
1001  @retval The new position in the file, or MY_FILEPOS_ERROR on error.
1002 */
1004  myf flags);
1005 /**
1006  This is a wrapper around mysql_file_read. Read data from the temporary
1007  file of a binlog cache, and take care of decrypting the data if
1008  binlog_encryption is on.
1009 
1010 
1011  @param cache The handler of a binlog cache to read.
1012  @param[out] buffer The memory buffer to write to.
1013  @param count The length of data in the temporary file to be read in bytes.
1014  @param flags The bitmap of different flags
1015  MY_WME | MY_FAE | MY_NABP | MY_FNABP |
1016  MY_DONT_CHECK_FILESIZE and so on.
1017 
1018  @retval The length of bytes to be read, or MY_FILE_ERROR on error.
1019 */
1020 size_t mysql_encryption_file_read(IO_CACHE *cache, uchar *buffer, size_t count,
1021  myf flags);
1022 /**
1023  This is a wrapper around mysql_file_write. Write data in buffer to the
1024  temporary file of a binlog cache, and take care of encrypting the data
1025  if binlog_encryption is on.
1026 
1027  @param cache The handler of a binlog cache to write.
1028  @param buffer The memory buffer to write from.
1029  @param count The length of data in buffer to be written in bytes.
1030  @param flags The bitmap of different flags
1031  MY_WME | MY_FAE | MY_NABP | MY_FNABP |
1032  MY_DONT_CHECK_FILESIZE and so on
1033 
1034  if (flags & (MY_NABP | MY_FNABP)) {
1035  @retval 0 if count == 0
1036  @retval 0 success
1037  @retval MY_FILE_ERROR error
1038  } else {
1039  @retval 0 if count == 0
1040  @retval The number of bytes written on success.
1041  @retval MY_FILE_ERROR error
1042  @retval The actual number of bytes written on partial success (if
1043  less than count bytes were written).
1044  }
1045 */
1046 size_t mysql_encryption_file_write(IO_CACHE *cache, const uchar *buffer,
1047  size_t count, myf flags);
1048 #endif /* _my_sys_h */
char * safe_strdup_root(MEM_ROOT *root, const char *str)
Definition: my_alloc.cc:251
void my_message_local_stderr(enum loglevel, uint ecode, va_list args)
Issue a message locally (i.e.
Definition: my_error.cc:446
Definition: my_sys.h:781
my_off_t my_seek(File fd, my_off_t pos, int whence, myf MyFlags)
Definition: my_seek.cc:82
PSI_memory_key key_memory_max_alloca
Definition: my_static.cc:66
my_syslog_options
Definition: my_sys.h:631
size_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count, my_off_t offset, myf MyFlags)
Write a chunk of bytes to a file at a given position.
Definition: my_pread.cc:161
void(* my_error_reporter)(enum loglevel level, uint ecode,...)
Definition: my_sys.h:493
void set_psi_mdl_service(void *psi)
Definition: psi_noop.cc:550
Definition: my_sys.h:279
void my_message_local(enum loglevel ll, uint ecode,...)
Issue a message locally (i.e.
Definition: my_error.cc:477
void * memdup_root(MEM_ROOT *root, const void *str, size_t len)
Definition: my_alloc.cc:273
int test_if_hard_path(const char *dir_name)
Definition: my_getwd.cc:138
const char * my_progname
Definition: my_static.cc:82
static pfs_os_file_t files[1000]
Files comprising the system tablespace.
Definition: srv0start.cc:171
my_off_t my_b_tell(const IO_CACHE *info)
Definition: my_sys.h:537
unsigned char uchar
Definition: my_inttypes.h:51
my_off_t my_ftell(FILE *stream)
Definition: my_fstream.cc:168
unsigned int PSI_file_key
Instrumented file key.
Definition: psi_file_bits.h:46
uchar ** current_end
Definition: my_sys.h:397
uchar * my_compress_alloc(const uchar *packet, size_t *len, size_t *complen)
Definition: my_compress.cc:72
uint max_element
Definition: my_sys.h:324
char * dir
Definition: my_sys.h:451
MYSQL_PLUGIN_IMPORT PSI_idle_bootstrap * psi_idle_hook
Definition: psi_noop.cc:566
void set_psi_socket_service(void *psi)
Definition: psi_noop.cc:458
t pos
Definition: dbug_analyze.cc:148
Definition: my_sys.h:488
bool my_init(void)
Initialize my_sys functions, resources and variables.
Definition: my_init.cc:132
void set_psi_thread_service(void *psi)
Definition: psi_noop.cc:226
struct for once_alloc (block)
Definition: my_sys.h:572
void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos)
Definition: ptr_cmp.cc:42
constexpr int my_b_EOF
Definition: my_sys.h:507
void free_tmpdir(MY_TMPDIR *tmpdir)
Definition: mf_tempdir.cc:100
size_t length
Definition: my_sys.h:338
const char * get_charset_name(uint cs_number)
Definition: charset.cc:522
Entry point for the performance schema interface.
Definition: psi_thread.h:70
void delete_dynamic(DYNAMIC_ARRAY *array)
Definition: array.cc:200
PSI_file_key file_key
Definition: my_sys.h:453
CHARSET_INFO * my_charset_get_by_name(MY_CHARSET_LOADER *loader, const char *name, uint cs_flags, myf my_flags)
Find character set by name: extended version of get_charset_by_csname() to return error messages to t...
Definition: charset.cc:641
ssize_t count
Definition: memcached.c:386
size_t dirname_part(char *to, const char *name, size_t *to_res_length)
Gives directory part of filename.
Definition: mf_dirname.cc:96
int my_getwd(char *buf, size_t size, myf MyFlags)
Definition: my_getwd.cc:75
void thr_set_sync_wait_callback(void(*before_sync)(void), void(*after_sync)(void))
Definition: my_sync.cc:55
MYSQL_PLUGIN_IMPORT PSI_system_bootstrap * psi_system_hook
Definition: psi_noop.cc:935
const string name("\ame\)
Entry point for the performance schema interface.
Definition: psi_mutex.h:42
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
uint elements
Definition: my_sys.h:324
MYSQL_PLUGIN_IMPORT PSI_thread_bootstrap * psi_thread_hook
Definition: psi_noop.cc:223
size_t escape_string_for_mysql(const CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length)
Definition: charset.cc:751
uint my_file_limit
Definition: my_static.cc:89
size_t my_b_bytes_in_cache(const IO_CACHE *info)
Definition: my_sys.h:556
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
Definition: my_sys.h:304
File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags)
Definition: my_symlink2.cc:53
ulong my_file_opened
Definition: my_static.cc:84
int my_mkdir(const char *dir, int Flags, myf MyFlags)
Definition: my_mkdir.cc:44
uint get_charset_number(const char *cs_name, uint cs_flags)
Definition: charset.cc:513
MYSQL_PLUGIN_IMPORT PSI_stage_bootstrap * psi_stage_hook
Definition: psi_noop.cc:591
Definition: my_sys.h:330
int my_delete_with_symlink(const char *name, myf MyFlags)
Definition: my_symlink2.cc:132
size_t buffer_length
Definition: my_sys.h:465
Some integer typedefs for easier portability.
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
int my_error_register(const char *(*get_errmsg)(int), int first, int last)
Register error messages for use with my_error().
Definition: my_error.cc:335
int my_delete(const char *name, myf MyFlags)
Definition: my_delete.cc:45
bool dynstr_trunc(DYNAMIC_STRING *str, size_t n)
Definition: my_string.cc:125
int(* qsort2_cmp)(const void *, const void *, const void *)
Definition: my_sys.h:482
pthread_mutex_t mutex
Definition: memcached.c:384
PSI_memory_key m_psi_key
Definition: my_sys.h:327
UnlinkOrKeepFile
Definition: my_sys.h:781
MYSQL_PLUGIN_IMPORT PSI_memory_bootstrap * psi_memory_hook
Definition: psi_noop.cc:902
int check_if_legal_tablename(const char *path)
Definition: my_access.cc:157
void(* local_message_hook)(enum loglevel ll, uint ecode, va_list args)
Definition: my_static.cc:104
MYSQL_PLUGIN_IMPORT PSI_data_lock_bootstrap * psi_data_lock_hook
Definition: psi_noop.cc:922
bool my_b_inited(const IO_CACHE *info)
Definition: my_sys.h:503
ino_t st_ino
Definition: my_sys.h:490
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:70
void set_psi_data_lock_service(void *psi)
Definition: psi_noop.cc:925
const char * charsets_dir
Definition: charset.cc:361
FILE * my_freopen(const char *path, const char *mode, FILE *stream)
Change the file associated with a file stream.
Definition: my_fopen.cc:173
void my_osmaperr(unsigned long oserrno)
Definition: my_winerr.cc:125
char ** list
Definition: my_sys.h:331
bool my_chmod(const char *filename, ulong perm_flags, myf my_flags)
Definition: my_chmod.cc:88
int my_block_write(IO_CACHE *info, const uchar *Buffer, size_t Count, my_off_t pos)
Definition: mf_iocache.cc:1374
int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
Definition: my_chsize.cc:71
Stream_cipher * m_encryptor
Definition: my_sys.h:477
uchar * read_end
Definition: my_sys.h:372
char * my_tmpdir(MY_TMPDIR *tmpdir)
Definition: mf_tempdir.cc:90
IO_CACHE * source_cache
Definition: my_sys.h:351
char * strdup_root(MEM_ROOT *root, const char *str)
Definition: my_alloc.cc:247
size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length)
Definition: mf_iocache2.cc:192
Definition: my_sys.h:311
Entry point for the performance schema interface.
Definition: psi_rwlock.h:50
bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2)
Definition: charset.cc:78
int end_io_cache(IO_CACHE *info)
Definition: mf_iocache.cc:1511
enum file_type type
Definition: my_sys.h:317
ulong my_stream_opened
Definition: my_static.cc:84
int my_openlog(const char *eventSourceName, int option, int facility)
Opens/Registers a new handle for system logging.
Definition: my_syslog.cc:244
void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader)
Initialize character set loader to use mysys memory management functions.
Definition: charset.cc:347
char * fn_same(char *toname, const char *name, int flag)
Definition: mf_same.cc:45
Stream_cipher * m_decryptor
Definition: my_sys.h:479
bool resolve_charset(const char *cs_name, const CHARSET_INFO *default_cs, const CHARSET_INFO **cs)
Resolve character set by the character set name (utf8, latin1, ...).
Definition: charset.cc:686
struct st_my_file_info * my_file_info
Definition: my_static.cc:90
int my_sync_dir_by_file(const char *file_name, myf my_flags)
Definition: my_sync.cc:181
Performance schema instrumentation interface.
Definition: my_sys.h:336
MYSQL_PLUGIN_IMPORT PSI_mdl_bootstrap * psi_mdl_hook
Definition: psi_noop.cc:547
void add_compiled_collation(CHARSET_INFO *cs)
Definition: charset.cc:418
bool seek_not_done
Definition: my_sys.h:462
int _my_b_read_r(IO_CACHE *info, uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:922
printf("== done ==\)
MYSQL_PLUGIN_IMPORT PSI_statement_bootstrap * psi_statement_hook
Definition: psi_noop.cc:783
bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
Definition: my_string.cc:66
size_t my_b_vprintf(IO_CACHE *info, const char *fmt, va_list ap)
Implementation of my_b_printf.
Definition: mf_iocache2.cc:257
PSI_file_key key_file_io_cache
Definition: mf_iocache.cc:91
my_off_t my_b_filelength(IO_CACHE *info)
Definition: mf_iocache2.cc:221
uint size_of_element
Definition: my_sys.h:326
int my_syslog(const CHARSET_INFO *cs, enum loglevel level, const char *msg)
Sends message to the system logger.
Definition: my_syslog.cc:72
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:38
ulong my_default_record_cache_size
Definition: my_static.cc:93
void set_psi_system_service(void *psi)
Definition: psi_noop.cc:938
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:46
unsigned int root
Definition: dbug_analyze.cc:514
const char * my_filename(File fd)
Definition: my_div.cc:46
char * my_once_strdup(const char *src, myf myflags)
Definition: my_once.cc:99
const std::string FILE("FILE")
void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads)
Definition: mf_iocache.cc:614
void * my_mmap(void *, size_t, int, int, int, my_off_t)
int my_closelog()
Closes/de-registers the system logging handle.
Definition: my_syslog.cc:284
Entry point for the performance schema interface.
Definition: psi_error.h:55
MYSQL_PLUGIN_IMPORT PSI_table_bootstrap * psi_table_hook
Definition: psi_noop.cc:513
ha_checksum my_checksum(ha_checksum crc, const uchar *mem, size_t count)
Definition: checksum.cc:49
int running_threads
Definition: my_sys.h:354
int(* write_function)(IO_CACHE *, const uchar *, size_t)
Definition: my_sys.h:426
MYSQL_PLUGIN_IMPORT PSI_mutex_bootstrap * psi_mutex_hook
Definition: psi_noop.cc:252
uint32 ha_checksum
Definition: my_sys.h:560
Instrumentation helpers for conditions.
void my_free_open_file_info(void)
Definition: my_file.cc:147
uchar * read_pos
Definition: my_sys.h:370
uchar * buffer
Definition: my_sys.h:323
char * intern_filename(char *to, const char *from)
Fix a filename to intern (UNIX format).
Definition: mf_pack.cc:375
static MEM_ROOT mem
Definition: sql_servers.cc:97
FILE * my_fopen(const char *FileName, int Flags, myf MyFlags)
Definition: my_fopen.cc:63
int my_readlink(char *to, const char *filename, myf MyFlags)
Definition: my_symlink.cc:64
Definition: my_sys.h:308
bool open_cached_file(IO_CACHE *cache, const char *dir, const char *prefix, size_t cache_size, myf cache_myflags)
Definition: mf_cache.cc:52
void wait_for_free_space(const char *filename, int errors)
Definition: errors.cc:151
Definition: my_sys.h:282
void my_b_clear(IO_CACHE *info)
Definition: my_sys.h:501
Functions related to handling of plugins and other dynamically loaded libraries.
bool dynstr_append(DYNAMIC_STRING *str, const char *append)
Definition: my_string.cc:103
Performance schema instrumentation interface.
#define my_print_open_files()
Definition: my_sys.h:704
Entry point for the performance schema interface.
Definition: psi_idle.h:56
File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags)
Definition: my_open.cc:143
CHARSET_INFO * get_charset_by_name(const char *cs_name, myf flags)
Definition: charset.cc:626
bool my_enable_symlinks
Definition: my_static.cc:164
#define my_access
Definition: my_sys.h:641
myf myflags
Definition: my_sys.h:468
int my_b_copy_to_file(IO_CACHE *cache, FILE *file)
Definition: mf_iocache2.cc:73
void(* exit_cond_hook)(void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line)
Definition: my_static.cc:143
size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
Write a chunk of bytes to a file.
Definition: my_write.cc:78
Definition: my_sys.h:283
cache_type type
Definition: my_sys.h:432
int my_setwd(const char *dir, myf MyFlags)
Definition: my_getwd.cc:105
char * home_dir
Definition: my_static.cc:81
int check_if_legal_filename(const char *path)
void(* error_handler_hook)(uint my_err, const char *str, myf MyFlags)
Definition: my_static.cc:100
Entry point for the performance schema interface.
Definition: psi_statement.h:43
const char * get_global_errmsg(int nr)
Definition: errors.cc:174
File my_fileno(FILE *fd)
Definition: my_fstream.cc:178
int init_io_cache(IO_CACHE *info, File file, size_t cachesize, enum cache_type type, my_off_t seek_offset, bool use_async_io, myf cache_myflags)
Definition: mf_iocache.cc:309
int my_realpath(char *to, const char *filename, myf MyFlags)
Definition: my_symlink.cc:139
void(* set_waiting_for_disk_space_hook)(void *opaque_thd, bool waiting)
Definition: my_static.cc:149
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
Definition: mf_iocache.cc:1429
Performance schema instrumentation interface.
char * my_path(char *to, const char *progname, const char *own_pathname_part)
Definition: mf_path.cc:61
IO_CACHE_CALLBACK pre_read
Definition: my_sys.h:440
size_t mysql_encryption_file_write(IO_CACHE *cache, const uchar *buffer, size_t count, myf flags)
This is a wrapper around mysql_file_write.
Definition: mf_iocache.cc:1646
void charset_uninit()
Definition: charset.cc:920
my_off_t mysql_encryption_file_seek(IO_CACHE *cache, my_off_t pos, int whence, myf flags)
This is a wrapper around mysql_file_seek.
Definition: mf_iocache.cc:1631
void close_cached_file(IO_CACHE *cache)
Definition: mf_cache.cc:86
size_t normalize_dirname(char *to, const char *from)
Convert a directory name to a format which can be compared as strings.
Definition: mf_pack.cc:201
int my_fclose(FILE *fd, myf MyFlags)
Definition: my_fopen.cc:186
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size
Definition: my_init.cc:92
int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count)
Read buffered from the net.
Definition: mf_iocache.cc:60
This abstract class represents the interface of a replication logs encryption cipher that can be used...
Definition: stream_cipher.h:77
bool my_init_dynamic_array(DYNAMIC_ARRAY *array, PSI_memory_key key, uint element_size, void *init_buffer, uint init_alloc, uint alloc_increment)
Definition: array.cc:66
bool init_compiled_charsets(myf flags)
Definition: charset-def.cc:256
cache_type
Definition: my_sys.h:276
void set_psi_stage_service(void *psi)
Definition: psi_noop.cc:594
char * fn_ext(char *name)
Definition: mf_fn_ext.cc:71
Definition: my_sys.h:278
CHARSET_INFO * get_charset(uint cs_number, myf flags)
Definition: charset.cc:576
Stage instrument information.
Definition: psi_stage_bits.h:71
char * name
Definition: my_sys.h:312
mysql_cond_t cond
Definition: my_sys.h:346
void(* enter_stage_hook)(void *opaque_thd, const PSI_stage_info *new_stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line)
Definition: my_static.cc:146
#define MY_ALL_CHARSETS_SIZE
Definition: my_sys.h:258
int my_copy(const char *from, const char *to, myf MyFlags)
Definition: my_copy.cc:78
MYSQL_PLUGIN_IMPORT PSI_file_bootstrap * psi_file_hook
Definition: psi_noop.cc:409
void * my_once_alloc(size_t Size, myf MyFlags)
Definition: my_once.cc:61
int _my_b_get(IO_CACHE *info)
Definition: mf_iocache.cc:1218
Definition: my_sys.h:307
uint get_collation_number(const char *name)
Definition: charset.cc:462
const char * my_get_err_msg(int nr)
Get an error format string from one of the my_error_register()ed sets.
Definition: my_error.cc:183
void my_printv_error(uint error, const char *format, myf MyFlags, va_list ap)
Print an error message.
Definition: my_error.cc:291
#define is_filename_allowed(name, length, allow_cwd)
Definition: my_sys.h:651
uchar * write_pos
Definition: my_sys.h:387
Definition: my_sys.h:359
#define HANDLE
Definition: violite.h:156
bool alloced_buffer
Definition: my_sys.h:475
mysql_mutex_t mutex
Definition: my_sys.h:333
Definition: my_sys.h:303
Definition: my_sys.h:305
void * alloc_dynamic(DYNAMIC_ARRAY *array)
Definition: array.cc:138
Header for compiler-dependent features.
static char * path
Definition: mysqldump.cc:123
int my_b_get(IO_CACHE *info)
Definition: my_sys.h:529
void set_psi_statement_service(void *psi)
Definition: psi_noop.cc:786
bool array_append_string_unique(const char *str, const char **array, size_t size)
Append str to array, or move to the end if it already exists.
Definition: mf_arr_appstr.cc:50
size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
Read a chunk of bytes from a file with retry&#39;s if needed If flag MY_FULL_IO is set then keep reading ...
Definition: my_read.cc:72
int my_umask_dir
Definition: my_static.cc:86
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
int total_threads
Definition: my_sys.h:355
uchar * write_buffer
Definition: my_sys.h:378
unsigned int len
Definition: dbug_analyze.cc:216
dev_t st_dev
Definition: my_sys.h:489
uint cur
Definition: my_sys.h:332
unsigned int uint
Definition: uca-dump.cc:29
Definition: my_sys.h:281
char * convert_dirname(char *to, const char *from, const char *from_end)
Convert directory name to use under this system.
Definition: mf_dirname.cc:139
bool my_gethwaddr(uchar *to)
Definition: my_gethwaddr.cc:237
my_off_t my_get_ptr(uchar *ptr, size_t pack_length)
Definition: ptr_cmp.cc:76
MYSQL_PLUGIN_IMPORT PSI_cond_bootstrap * psi_cond_hook
Definition: psi_noop.cc:328
static const CHARSET_INFO * charset_info
Definition: mysql.cc:219
int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:418
void(* enter_cond_hook)(void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line)
Definition: my_static.cc:139
void my_message(uint my_err, const char *str, myf MyFlags)
Print an error message.
Definition: my_error.cc:313
int my_symlink(const char *content, const char *linkname, myf MyFlags)
Definition: my_symlink.cc:97
Definition: my_sys.h:344
uint32_t uint32
Definition: my_inttypes.h:62
void set_psi_idle_service(void *psi)
Definition: psi_noop.cc:569
char msg[1024]
Definition: test_sql_9_sessions.cc:282
USED_MEM * next
Next block in use.
Definition: my_sys.h:573
void * arg
Definition: my_sys.h:449
size_t cleanup_dirname(char *to, const char *from)
Remove unwanted chars from dirname.
Definition: mf_pack.cc:77
uchar * read_end
Definition: my_sys.h:353
void append(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1)
Definition: suite_stubs.c:73
bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, size_t length)
Definition: my_string.cc:107
An instrumented FILE structure.
Definition: mysql_file.h:475
uchar * write_end
Definition: my_sys.h:389
size_t my_b_printf(IO_CACHE *info, const char *fmt,...)
Simple printf version.
Definition: mf_iocache2.cc:239
Definition: m_ctype.h:359
mysql_cond_t cond_writer
Definition: my_sys.h:347
File my_open(const char *FileName, int Flags, myf MyFlags)
Definition: my_open.cc:65
int my_sync(File fd, myf my_flags)
Definition: my_sync.cc:84
static const char * whence(const Field *cached_field)
Get the name of the cached field of an Item_cache_json instance.
Definition: item.cc:8792
void * my_once_memdup(const void *src, size_t len, myf myflags)
Definition: my_once.cc:106
void my_init_mysys_psi_keys(void)
Definition: my_init.cc:555
ulong my_tmp_file_created
Definition: my_static.cc:84
int my_b_append(IO_CACHE *info, const uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:1318
mysql_mutex_t append_buffer_lock
Definition: my_sys.h:403
void set_psi_mutex_service(void *psi)
Definition: psi_noop.cc:255
void set_psi_memory_service(void *psi)
Definition: psi_noop.cc:905
flush_type
Definition: my_sys.h:286
size_t unpack_dirname(char *to, const char *from)
Fixes a directory name so that can be used by open().
Definition: mf_pack.cc:251
size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
Definition: my_fstream.cc:111
static const char * key
Definition: suite_stubs.c:14
void setup_io_cache(IO_CACHE *info)
Definition: mf_iocache.cc:116
Definition: my_sys.h:302
bool my_compress(uchar *, size_t *, size_t *)
Definition: my_compress.cc:58
int File
Definition: my_io_bits.h:50
static MEM_ROOT mem_root
Definition: client_plugin.cc:107
Definition of the global "loglevel" enumeration.
file_type
Definition: my_sys.h:301
int my_b_read(IO_CACHE *info, uchar *buffer, size_t count)
Definition: my_sys.h:509
bool reinit_io_cache(IO_CACHE *info, enum cache_type type, my_off_t seek_offset, bool use_async_io, bool clear_cache)
Definition: mf_iocache.cc:323
unsigned long my_off_t
Definition: my_inttypes.h:87
void set_psi_table_service(void *psi)
Definition: psi_noop.cc:516
size_t unpack_filename(char *to, const char *from)
Fix filename so it can be used by open, create.
Definition: mf_pack.cc:323
uint alloc_increment
Definition: my_sys.h:325
int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:1237
bool binlog_cache_temporary_file_is_encrypted
(end of group MYSYS)
Definition: mf_iocache.cc:93
int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:1083
CHARSET_INFO compiled_charsets[]
Definition: ctype-extra.cc:7235
Entry point for the performance schema interface.
Definition: psi_table.h:56
char * file_name
Definition: my_sys.h:450
bool resolve_collation(const char *cl_name, const CHARSET_INFO *default_cl, const CHARSET_INFO **cl)
Resolve collation by the collation name (utf8_general_ci, ...).
Definition: charset.cc:714
int my_rename_with_symlink(const char *from, const char *to, myf MyFlags)
Definition: my_symlink2.cc:159
MYSQL_PLUGIN_IMPORT PSI_socket_bootstrap * psi_socket_hook
Definition: psi_noop.cc:455
uchar ** current_pos
Definition: my_sys.h:397
Entry point for the performance schema interface.
Definition: psi_data_lock.h:79
void claim_dynamic(DYNAMIC_ARRAY *array)
Definition: array.cc:183
uint max
Definition: my_sys.h:332
File create_temp_file(char *to, const char *dir, const char *pfx, int mode, UnlinkOrKeepFile unlink_or_keep, myf MyFlags)
Definition: mf_tempfile.cc:87
Definition: my_sys.h:289
my_off_t pos_in_file
Definition: my_sys.h:362
int error
Definition: my_sys.h:463
Performance schema instrumentation interface.
bool my_disable_locking
Definition: my_static.cc:163
void remove_io_thread(IO_CACHE *info)
Definition: mf_iocache.cc:667
CHARSET_INFO * get_charset_by_csname(const char *cs_name, uint cs_flags, myf my_flags)
Definition: charset.cc:663
Definition: my_sys.h:294
const char * filename
Definition: pfs_example_component_population.cc:64
static int flag
Definition: hp_test1.cc:39
void set_psi_file_service(void *psi)
Definition: psi_noop.cc:412
MYSQL_PLUGIN_IMPORT int my_umask
Definition: my_static.cc:86
Definition: my_sys.h:288
int type
Definition: http_common.h:411
bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
Definition: mf_tempdir.cc:47
int my_close(File Filedes, myf MyFlags)
Definition: my_open.cc:95
MYSQL_PLUGIN_IMPORT PSI_rwlock_bootstrap * psi_rwlock_hook
Definition: psi_noop.cc:296
Entry point for the performance schema interface.
Definition: psi_system.h:56
MY_MODE get_file_perm(ulong perm_flags)
Definition: my_chmod.cc:52
void to_unix_path(char *name)
Convert filename to unix style filename.
Definition: mf_unixpath.cc:43
File my_create(const char *FileName, int CreateFlags, int AccessFlags, myf MyFlags)
Definition: my_create.cc:58
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
int my_is_same_file(File file, const ST_FILE_ID *file_id)
Return non-zero if the file descriptor and a previously lstat-ed file identified by file_id point to ...
Definition: my_symlink.cc:190
int myf
Definition: my_inttypes.h:121
bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element)
Definition: array.cc:109
Definition: m_ctype.h:159
void freeze_size(DYNAMIC_ARRAY *array)
Definition: array.cc:222
size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags)
Definition: my_fstream.cc:70
IO_CACHE_CALLBACK post_read
Definition: my_sys.h:441
static void reset_dynamic(DYNAMIC_ARRAY *array)
Definition: my_sys.h:801
Definition: my_sys.h:631
char * progname
Definition: do_ctype.cc:76
int my_sync_dir(const char *dir_name, myf my_flags)
Definition: my_sync.cc:139
my_off_t end_of_file
Definition: my_sys.h:368
ABI for instrumented mutexes.
MYSQL_PLUGIN_IMPORT CHARSET_INFO * default_charset_info
Definition: charset.cc:416
my_off_t my_b_get_pos_in_file(const IO_CACHE *info)
Definition: my_sys.h:549
my_off_t my_tell(File fd, myf MyFlags)
Definition: my_seek.cc:116
char * prefix
Definition: my_sys.h:451
static int my_getpagesize()
Definition: my_sys.h:868
size_t alloc_increment
Definition: my_sys.h:338
bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size)
Definition: my_string.cc:87
mode_t MY_MODE
Definition: my_io_bits.h:57
void my_once_free(void)
Definition: my_once.cc:119
Entry point for the performance schema interface.
Definition: psi_transaction.h:56
mysql_mutex_t mutex
Definition: my_sys.h:345
Definition: my_sys.h:280
unsigned int left
memory left in block
Definition: my_sys.h:574
Entry point for the performance schema interface.
Definition: psi_stage.h:43
IO_CACHE_CALLBACK pre_close
Definition: my_sys.h:442
loglevel
Definition: my_loglevel.h:32
bool real_open_cached_file(IO_CACHE *cache)
Definition: mf_cache.cc:74
Entry point for the performance schema interface.
Definition: psi_cond.h:43
size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, myf MyFlags)
Definition: my_pread.cc:82
size_t system_filename(char *to, const char *from)
Convert filename (unix standard) to system standard Used before system command&#39;s like open()...
Definition: mf_pack.cc:355
FILE * my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
Definition: my_fopen.cc:218
ulong my_file_total_opened
Definition: my_static.cc:85
int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize, enum cache_type type, my_off_t seek_offset, bool use_async_io, myf cache_myflags, PSI_file_key file_key)
Definition: mf_iocache.cc:175
Types to make file and socket I/O compatible.
void set_psi_rwlock_service(void *psi)
Definition: psi_noop.cc:299
my_off_t my_fseek(FILE *stream, my_off_t pos, int whence)
Definition: my_fstream.cc:158
uchar * append_read_pos
Definition: my_sys.h:385
int error
Definition: my_sys.h:356
Entry point for the performance schema interface.
Definition: psi_memory.h:75
int my_is_symlink(const char *filename, ST_FILE_ID *file_id)
Definition: my_symlink.cc:117
char * fn_format(char *to, const char *name, const char *dir, const char *form, uint flag)
Formats a filename with possible replace of directory of extension Function can handle the case where...
Definition: mf_format.cc:68
void * multi_alloc_root(MEM_ROOT *mem_root,...)
Definition: my_alloc.cc:219
size_t mysql_encryption_file_read(IO_CACHE *cache, uchar *buffer, size_t count, myf flags)
This is a wrapper around mysql_file_read.
Definition: mf_iocache.cc:1638
uint my_set_max_open_files(uint files)
Definition: my_file.cc:122
char * str
Definition: my_sys.h:337
int my_msync(int, void *, size_t, int)
char * my_load_path(char *to, const char *path, const char *own_path_prefix)
Returns full load-path for a file.
Definition: mf_loadpath.cc:61
File file
Definition: my_sys.h:452
CHARSET_INFO * my_collation_get_by_name(MY_CHARSET_LOADER *loader, const char *name, myf flags)
Find collation by name: extended version of get_charset_by_name() to return error messages to the cal...
Definition: charset.cc:608
int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
Definition: mf_iocache.cc:1357
int my_b_write(IO_CACHE *info, const uchar *buffer, size_t count)
Definition: my_sys.h:518
bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, size_t init_alloc, size_t alloc_increment)
Definition: my_string.cc:44
char * my_strerror(char *buf, size_t len, int errnum)
Get a string describing a system or handler error.
Definition: my_error.cc:109
bool my_init_done
Definition: my_init.cc:91
Log info(cout, "NOTE")
char * get_charsets_dir(char *buf)
Definition: charset.cc:395
char * strmake_root(MEM_ROOT *root, const char *str, size_t len)
Definition: my_alloc.cc:264
ulong disk_writes
Definition: my_sys.h:448
size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length, char quote)
Definition: charset.cc:877
uchar * buffer
Definition: my_sys.h:352
size_t my_b_fill(IO_CACHE *info)
Definition: mf_iocache2.cc:150
int my_rename(const char *from, const char *to, myf MyFlags)
Definition: my_rename.cc:46
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
MYSQL_PLUGIN_IMPORT PSI_transaction_bootstrap * psi_transaction_hook
Definition: psi_noop.cc:850
size_t strlength(const char *str)
Calculate the length of str not including any trailing &#39; &#39;-bytes.
Definition: mf_format.cc:151
unsigned int size
size of block
Definition: my_sys.h:575
static int flags[50]
Definition: hp_test1.cc:39
Definition: my_sys.h:322
size_t dirname_length(const char *name)
Get the string length of the directory part of name, including the last FN_LIBCHAR.
Definition: mf_dirname.cc:51
Entry point for the performance schema interface.
Definition: psi_socket.h:48
Definition: my_sys.h:306
Entry point for the performance schema interface.
Definition: psi_file.h:55
Definition: my_sys.h:287
bool has_path(const char *name)
Definition: my_getwd.cc:161
my_off_t pos_in_file
Definition: my_sys.h:349
Entry point for the performance schema interface.
Definition: psi_mdl.h:56
int my_munmap(void *, size_t)
int my_fallocator(File fd, my_off_t newlength, int filler, myf MyFlags)
Change size of the specified file.
Definition: my_fallocator.cc:69
IO_CACHE_SHARE * share
Definition: my_sys.h:411
bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,...)
Definition: my_string.cc:147
MYSQL_PLUGIN_IMPORT CHARSET_INFO * all_charsets[MY_ALL_CHARSETS_SIZE]
Definition: charset.cc:415
void(* fatal_error_handler_hook)(uint my_err, const char *str, myf MyFlags)
Definition: my_static.cc:102
void my_end(int infoflag)
Definition: my_init.cc:176
void dynstr_free(DYNAMIC_STRING *str)
Definition: my_string.cc:180
void set_psi_transaction_service(void *psi)
Definition: psi_noop.cc:853
my_error_reporter my_charset_error_reporter
Definition: charset.cc:323
size_t max_length
Definition: my_sys.h:338
unsigned long ulong
Definition: my_inttypes.h:48
size_t my_b_get_bytes_in_buffer(const IO_CACHE *info)
Definition: my_sys.h:545
#define my_get_large_page_size()
Definition: my_sys.h:212
size_t read_length
Definition: my_sys.h:467
bool my_uncompress(uchar *, size_t, size_t *)
Definition: my_compress.cc:118
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
MYSQL_PLUGIN_IMPORT PSI_error_bootstrap * psi_error_hook
Definition: psi_noop.cc:863
void my_printf_error(uint my_err, const char *format, myf MyFlags,...)
Print an error message.
Definition: my_error.cc:265
void my_b_seek(IO_CACHE *info, my_off_t pos)
Definition: mf_iocache2.cc:95
int(* is_killed_hook)(const void *opaque_thd)
Definition: my_static.cc:152
Definition: my_sys.h:781
void my_message_stderr(uint my_err, const char *str, myf MyFlags)
Print an error message on stderr.
Definition: my_mess.cc:59
This file includes core components for encrypting/decrypting binary log files.
bool my_error_unregister(int first, int last)
Unregister formerly registered error messages.
Definition: my_error.cc:381
void * pop_dynamic(DYNAMIC_ARRAY *)
Definition: array.cc:177
int(* read_function)(IO_CACHE *, uchar *, size_t)
Definition: my_sys.h:421
void set_psi_cond_service(void *psi)
Definition: psi_noop.cc:331
uchar * my_b_get_buffer_start(const IO_CACHE *info)
Definition: my_sys.h:541
Definition: my_sys.h:277
uchar * request_pos
Definition: my_sys.h:375
int(* IO_CACHE_CALLBACK)(IO_CACHE *)
Definition: my_sys.h:342
void * my_multi_malloc(PSI_memory_key key, myf flags,...)
Definition: mulalloc.cc:58
void set_psi_error_service(void *psi)
Definition: psi_noop.cc:866
MYSQL_FILE * mysql_stdin
Definition: my_init.cc:93
uchar * buffer
Definition: my_sys.h:373
Log error(cerr, "ERROR")