MySQL 8.3.0
Source Code Documentation
Mysys - low level utilities for MySQL
Collaboration diagram for Mysys - low level utilities for MySQL:

Modules

 Mysys time utilities
 

Files

file  my_sys.h
 Common header for many mysys elements.
 

Classes

struct  DYNAMIC_ARRAY
 
struct  MY_TMPDIR
 
struct  DYNAMIC_STRING
 
struct  IO_CACHE_SHARE
 
struct  IO_CACHE
 
struct  ST_FILE_ID
 
struct  USED_MEM
 struct for once_alloc (block) More...
 

Macros

#define MY_INIT(name)
 
#define MYSYS_ERRMSG_SIZE   (512)
 Max length of an error message generated by mysys utilities. More...
 
#define MYSYS_STRERROR_SIZE   (128)
 
#define MY_FILE_ERROR   ((size_t)-1)
 
#define MY_FNABP   2 /* Fatal if not all bytes read/written */
 
#define MY_NABP   4 /* Error if not all bytes read/written */
 
#define MY_FAE   8 /* Fatal if any error */
 
#define MY_WME   16 /* Write message on error */
 
#define MY_WAIT_IF_FULL   32 /* Wait and try again if disk full error */
 
#define MY_IGNORE_BADFD   32 /* my_sync: ignore 'bad descriptor' errors */
 
#define MY_REPORT_WAITING_IF_FULL   64 /* my_write: set status as waiting */
 
#define MY_FULL_IO   512 /* For my_read - loop intil I/O is complete */
 
#define MY_DONT_CHECK_FILESIZE   128 /* Option to init_io_cache() */
 
#define MY_LINK_WARNING   32 /* my_redel() gives warning if links */
 
#define MY_COPYTIME   64 /* my_redel() copies time */
 
#define MY_DELETE_OLD   256 /* my_create_with_symlink() */
 
#define MY_RESOLVE_LINK   128 /* my_realpath(); Only resolve links */
 
#define MY_HOLD_ORIGINAL_MODES   128 /* my_copy() holds to file modes */
 
#define MY_SEEK_NOT_DONE   32 /* my_lock may have to do a seek */
 
#define MY_DONT_WAIT   64 /* my_lock() don't wait if can't lock */
 
#define MY_ZEROFILL   32 /* my_malloc(), fill array with zero */
 
#define MY_ALLOW_ZERO_PTR   64 /* my_realloc() ; zero ptr -> malloc */
 
#define MY_FREE_ON_ERROR   128 /* my_realloc() ; Free old ptr on error */
 
#define MY_HOLD_ON_ERROR   256 /* my_realloc() ; Return old ptr on error */
 
#define MY_DONT_OVERWRITE_FILE   1024 /* my_copy: Don't overwrite file */
 
#define MY_SYNC   4096 /* my_copy(): sync dst file */
 
#define MYF_RW   MYF(MY_WME + MY_NABP) /* For my_read & my_write */
 
#define MY_CHECK_ERROR   1 /* Params to my_end; Check open-close */
 
#define MY_GIVE_INFO   2 /* Give time info about process*/
 
#define MY_DONT_FREE_DBUG   4 /* Do not call DBUG_END() in my_end() */
 
#define ME_BELL   4 /* DEPRECATED: Ring bell then printing message */
 
#define ME_ERRORLOG   64 /* Write the error message to error log */
 
#define ME_FATALERROR   1024 /* Fatal statement error */
 
#define MY_REPLACE_DIR   1 /* replace dir in name with 'dir' */
 
#define MY_REPLACE_EXT   2 /* replace extension with 'ext' */
 
#define MY_UNPACK_FILENAME   4 /* Unpack name (~ -> home) */
 
#define MY_RESOLVE_SYMLINKS   16 /* Resolve all symbolic links */
 
#define MY_RETURN_REAL_PATH   32 /* return full path for file */
 
#define MY_SAFE_PATH   64 /* Return NULL if too long path */
 
#define MY_RELATIVE_PATH   128 /* name is relative to 'dir' */
 
#define MY_APPEND_EXT   256 /* add 'ext' as additional extension*/
 
#define MY_SEEK_SET   0
 
#define MY_SEEK_CUR   1
 
#define MY_SEEK_END   2
 
#define MY_WAIT_FOR_USER_TO_FIX_PANIC   60 /* in seconds */
 
#define MY_WAIT_GIVE_USER_A_MESSAGE   10 /* Every 10 times of prev */
 
#define MIN_COMPRESS_LENGTH   50 /* Don't compress small bl. */
 
#define DFLT_INIT_HITS   3
 
#define MY_ERRNO_EDOM   33
 
#define MY_ERRNO_ERANGE   34
 
#define my_safe_alloca(size, max_alloca_sz)
 
#define my_safe_afree(ptr, size, max_alloca_sz)    if (size > max_alloca_sz) my_free(ptr)
 
#define DEBUG_SYNC_C(_sync_point_name_)
 
#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_)
 
#define my_alloca(SZ)   alloca((size_t)(SZ))
 
#define MY_ALL_CHARSETS_SIZE   2048
 
#define MALLOC_OVERHEAD   8
 
#define RECORD_CACHE_SIZE   (uint)(64 * 1024 - MALLOC_OVERHEAD)
 
#define MAX_SYSLOG_MESSAGE_SIZE   1024
 
#define my_access   access
 
#define is_filename_allowed(name, length, allow_cwd)   (true)
 
#define my_delete_allow_opened(fname, flags)   my_delete((fname), (flags))
 
#define base_name(A)   (A + dirname_length(A))
 
#define flush_io_cache(info)   my_b_flush_io_cache((info), 1)
 
#define dynamic_element(array, array_index, type)    ((type)((array)->buffer) + (array_index))
 
#define alloc_root_inited(A)   ((A)->inited())
 
#define MAP_NOSYNC   0
 
#define MAP_NORESERVE   0
 
#define my_mmap(a, b, c, d, e, f)   mmap64(a, b, c, d, e, f)
 
#define my_munmap(a, b)   munmap((a), (b))
 

Typedefs

using ErrorHandlerFunctionPointer = void(*)(uint, const char *, myf)
 
typedef int(* IO_CACHE_CALLBACK) (IO_CACHE *)
 
typedef int(* qsort2_cmp) (const void *, const void *, const void *)
 
typedef void(* my_error_reporter) (enum loglevel level, uint ecode,...)
 
typedef void(* my_error_vreporter) (enum loglevel level, uint ecode, va_list)
 

Enumerations

enum  cache_type {
  TYPE_NOT_SET = 0 , READ_CACHE , WRITE_CACHE , SEQ_READ_APPEND ,
  READ_FIFO , READ_NET , WRITE_NET
}
 
enum  flush_type { FLUSH_KEEP , FLUSH_RELEASE , FLUSH_IGNORE_CHANGED , FLUSH_FORCE_WRITE }
 
enum  my_syslog_options { MY_SYSLOG_PIDS = 1 }
 
enum  UnlinkOrKeepFile { UNLINK_FILE , KEEP_FILE }
 

Functions

void * my_multi_malloc (PSI_memory_key key, myf flags,...)
 
uint my_get_large_page_size (void)
 
void my_b_clear (IO_CACHE *info)
 
bool my_b_inited (const IO_CACHE *info)
 
int my_b_read (IO_CACHE *info, uchar *buffer, size_t count)
 
int my_b_write (IO_CACHE *info, const uchar *buffer, size_t count)
 
int _my_b_get (IO_CACHE *info)
 
int my_b_get (IO_CACHE *info)
 
my_off_t my_b_tell (const IO_CACHE *info)
 
ucharmy_b_get_buffer_start (const IO_CACHE *info)
 
size_t my_b_get_bytes_in_buffer (const IO_CACHE *info)
 
my_off_t my_b_get_pos_in_file (const IO_CACHE *info)
 
int my_b_copy_to_file (IO_CACHE *cache, FILE *file)
 
size_t my_b_bytes_in_cache (const IO_CACHE *info)
 
int my_copy (const char *from, const char *to, myf MyFlags)
 
int my_delete (const char *name, myf MyFlags)
 
int my_getwd (char *buf, size_t size, myf MyFlags)
 
int my_setwd (const char *dir, myf MyFlags)
 
void * my_once_alloc (size_t Size, myf MyFlags)
 
void my_once_free (void)
 
char * my_once_strdup (const char *src, myf myflags)
 
void * my_once_memdup (const void *src, size_t len, myf myflags)
 
File my_open (const char *filename, int Flags, myf MyFlags)
 Open a file. More...
 
File my_create (const char *FileName, int CreateFlags, int AccessFlags, myf MyFlags)
 Create a new file. More...
 
int my_close (File fd, myf MyFlags)
 Close a file. More...
 
int my_mkdir (const char *dir, int Flags, myf MyFlags)
 
int my_readlink (char *to, const char *filename, myf MyFlags)
 
int my_is_symlink (const char *filename, ST_FILE_ID *file_id)
 
int my_realpath (char *to, const char *filename, myf MyFlags)
 
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 the same file. More...
 
File my_create_with_symlink (const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags)
 
int my_delete_with_symlink (const char *name, myf MyFlags)
 
int my_rename_with_symlink (const char *from, const char *to, myf MyFlags)
 
int my_symlink (const char *content, const char *linkname, myf MyFlags)
 
size_t my_read (File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
 Read a chunk of bytes from a file with retry's if needed If flag MY_FULL_IO is set then keep reading until EOF is found. More...
 
size_t my_pread (File Filedes, uchar *Buffer, size_t Count, my_off_t offset, myf MyFlags)
 Read a chunk of bytes from a file from a given position. More...
 
int my_rename (const char *from, const char *to, myf MyFlags)
 
my_off_t my_seek (File fd, my_off_t pos, int whence, myf MyFlags)
 Seek to a position in a file. More...
 
my_off_t my_tell (File fd, myf MyFlags)
 
size_t my_write (File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
 Write a chunk of bytes to a file. More...
 
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. More...
 
size_t my_fread (FILE *stream, uchar *Buffer, size_t Count, myf MyFlags)
 Read a chunk of bytes from a FILE stream. More...
 
size_t my_fwrite (FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags)
 Write a chunk of bytes to a FILE stream. More...
 
my_off_t my_fseek (FILE *stream, my_off_t pos, int whence)
 Seek to position in FILE stream. More...
 
my_off_t my_ftell (FILE *stream)
 Portable ftell() wrapper. More...
 
int my_openlog (const char *eventSourceName, int option, int facility)
 Opens/Registers a new handle for system logging. More...
 
int my_closelog ()
 Closes/de-registers the system logging handle. More...
 
int my_syslog (const CHARSET_INFO *cs, enum loglevel level, const char *msg)
 Sends message to the system logger. More...
 
int check_if_legal_filename (const char *path)
 
int check_if_legal_tablename (const char *path)
 
const char * get_global_errmsg (int nr)
 
void wait_for_free_space (const char *filename, int errors)
 
FILE * my_fopen (const char *filename, int Flags, myf MyFlags)
 Open a file as stream. More...
 
FILE * my_fdopen (File fd, const char *filename, int Flags, myf MyFlags)
 Make a stream out of a file handle. More...
 
FILE * my_freopen (const char *filename, const char *mode, FILE *stream)
 Change the file associated with a file stream. More...
 
int my_fclose (FILE *stream, myf MyFlags)
 Close a stream. More...
 
File my_fileno (FILE *stream)
 Portable fileno() wrapper. More...
 
int my_chsize (File fd, my_off_t newlength, int filler, myf MyFlags)
 Change size of file. More...
 
int my_fallocator (File fd, my_off_t newlength, int filler, myf MyFlags)
 Change size of the specified file. More...
 
void thr_set_sync_wait_callback (void(*before_sync)(void), void(*after_sync)(void))
 
int my_sync (File fd, myf my_flags)
 
char * my_strerror (char *buf, size_t len, int errnum)
 Get a string describing a system or handler error. More...
 
const char * my_get_err_msg (int nr)
 Get an error format string from one of the my_error_register()ed sets. More...
 
void my_error (int nr, myf MyFlags,...)
 Fill in and print a previously registered error message. More...
 
void my_printf_error (uint my_err, const char *format, myf MyFlags,...)
 Print an error message. More...
 
void my_printv_error (uint error, const char *format, myf MyFlags, va_list ap)
 Print an error message. More...
 
int my_error_register (const char *(*get_errmsg)(int), int first, int last)
 Register error messages for use with my_error(). More...
 
bool my_error_unregister (int first, int last)
 Unregister formerly registered error messages. More...
 
void my_message (uint my_err, const char *str, myf MyFlags)
 Print an error message. More...
 
void my_message_stderr (uint my_err, const char *str, myf MyFlags)
 Print an error message on stderr. More...
 
void my_message_local_stderr (enum loglevel, uint ecode, va_list args)
 Issue a message locally (i.e. More...
 
void my_message_local (enum loglevel ll, uint ecode,...)
 Issue a message locally (i.e. More...
 
template<class... Ts>
void MyOsError (int errno_val, Ts... ppck)
 Convenience wrapper for OS error messages which report errno/my_errno with d followed by strerror as s, as the last conversions in the error message. More...
 
bool my_init (void)
 Initialize my_sys functions, resources and variables. More...
 
void my_end (int infoflag)
 
const char * my_filename (File fd)
 Get filename of file. More...
 
MY_MODE get_file_perm (ulong perm_flags)
 
bool my_chmod (const char *filename, ulong perm_flags, myf my_flags)
 
bool init_tmpdir (MY_TMPDIR *tmpdir, const char *pathlist)
 
char * my_tmpdir (MY_TMPDIR *tmpdir)
 
void free_tmpdir (MY_TMPDIR *tmpdir)
 
size_t dirname_part (char *to, const char *name, size_t *to_res_length)
 Gives directory part of filename. More...
 
size_t dirname_length (const char *name)
 Get the string length of the directory part of name, including the last FN_LIBCHAR. More...
 
int test_if_hard_path (const char *dir_name)
 
bool has_path (const char *name)
 
char * convert_dirname (char *to, const char *from, const char *from_end)
 Convert directory name to use under this system. More...
 
void to_unix_path (char *name)
 Convert filename to unix style filename. More...
 
char * fn_ext (char *name)
 
const char * fn_ext (const char *name)
 
char * fn_same (char *toname, const char *name, int flag)
 
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 'to' == 'name' For a description of the flag values, consult my_sys.h The arguments should be in unix format. More...
 
size_t strlength (const char *str)
 Calculate the length of str not including any trailing ' '-bytes. More...
 
size_t normalize_dirname (char *to, const char *from)
 Convert a directory name to a format which can be compared as strings. More...
 
size_t unpack_dirname (char *to, const char *from)
 Fixes a directory name so that can be used by open(). More...
 
size_t cleanup_dirname (char *to, const char *from)
 Remove unwanted chars from dirname. More...
 
size_t system_filename (char *to, const char *from)
 Convert filename (unix standard) to system standard Used before system command's like open(), create() More...
 
size_t unpack_filename (char *to, const char *from)
 Fix filename so it can be used by open, create. More...
 
char * intern_filename (char *to, const char *from)
 Fix a filename to intern (UNIX format). More...
 
char * my_path (char *to, const char *progname, const char *own_pathname_part)
 
char * my_load_path (char *to, const char *path, const char *own_path_prefix)
 Returns full load-path for a file. More...
 
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. More...
 
void my_store_ptr (uchar *buff, size_t pack_length, my_off_t pos)
 
my_off_t my_get_ptr (uchar *ptr, size_t pack_length)
 
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)
 
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)
 
bool reinit_io_cache (IO_CACHE *info, enum cache_type type, my_off_t seek_offset, bool use_async_io, bool clear_cache)
 
void setup_io_cache (IO_CACHE *info)
 
int _my_b_read (IO_CACHE *info, uchar *Buffer, size_t Count)
 
int _my_b_read_r (IO_CACHE *info, uchar *Buffer, size_t Count)
 
void init_io_cache_share (IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads)
 
void remove_io_thread (IO_CACHE *info)
 
int _my_b_seq_read (IO_CACHE *info, uchar *Buffer, size_t Count)
 
int _my_b_net_read (IO_CACHE *info, uchar *Buffer, size_t Count)
 Read buffered from the net. More...
 
int _my_b_write (IO_CACHE *info, const uchar *Buffer, size_t Count)
 
int my_b_append (IO_CACHE *info, const uchar *Buffer, size_t Count)
 
int my_b_safe_write (IO_CACHE *info, const uchar *Buffer, size_t Count)
 
int my_block_write (IO_CACHE *info, const uchar *Buffer, size_t Count, my_off_t pos)
 
int my_b_flush_io_cache (IO_CACHE *info, int need_append_buffer_lock)
 
int end_io_cache (IO_CACHE *info)
 
size_t my_b_fill (IO_CACHE *info)
 
void my_b_seek (IO_CACHE *info, my_off_t pos)
 
size_t my_b_gets (IO_CACHE *info, char *to, size_t max_length)
 
my_off_t my_b_filelength (IO_CACHE *info)
 
size_t my_b_printf (IO_CACHE *info, const char *fmt,...)
 Simple printf version. More...
 
size_t my_b_vprintf (IO_CACHE *info, const char *fmt, va_list ap)
 Implementation of my_b_printf. More...
 
bool open_cached_file (IO_CACHE *cache, const char *dir, const char *prefix, size_t cache_size, myf cache_myflags)
 
bool real_open_cached_file (IO_CACHE *cache)
 
void close_cached_file (IO_CACHE *cache)
 
File create_temp_file (char *to, const char *dir, const char *pfx, int mode, UnlinkOrKeepFile unlink_or_keep, myf MyFlags)
 
bool my_init_dynamic_array (DYNAMIC_ARRAY *array, PSI_memory_key key, uint element_size, void *init_buffer, uint init_alloc, uint alloc_increment)
 
bool insert_dynamic (DYNAMIC_ARRAY *array, const void *element)
 
void * alloc_dynamic (DYNAMIC_ARRAY *array)
 
void delete_dynamic (DYNAMIC_ARRAY *array)
 
bool init_dynamic_string (DYNAMIC_STRING *str, const char *init_str, size_t init_alloc)
 
bool dynstr_append (DYNAMIC_STRING *str, const char *append)
 
bool dynstr_append_mem (DYNAMIC_STRING *str, const char *append, size_t length)
 
bool dynstr_append_os_quoted (DYNAMIC_STRING *str, const char *append,...)
 
bool dynstr_append_quoted (DYNAMIC_STRING *str, const char *quote_str, const uint quote_len, const char *append,...)
 
bool dynstr_set (DYNAMIC_STRING *str, const char *init_str)
 
bool dynstr_realloc (DYNAMIC_STRING *str, size_t additional_size)
 
bool dynstr_trunc (DYNAMIC_STRING *str, size_t n)
 
void dynstr_free (DYNAMIC_STRING *str)
 
void * multi_alloc_root (MEM_ROOT *mem_root,...)
 
char * strdup_root (MEM_ROOT *root, const char *str)
 
char * safe_strdup_root (MEM_ROOT *root, const char *str)
 
char * strmake_root (MEM_ROOT *root, const char *str, size_t len)
 
void * memdup_root (MEM_ROOT *root, const void *str, size_t len)
 
bool my_compress (mysql_compress_context *, uchar *, size_t *, size_t *)
 This replaces the packet with a compressed packet. More...
 
bool my_uncompress (mysql_compress_context *, uchar *, size_t, size_t *)
 Uncompress packet. More...
 
ucharmy_compress_alloc (mysql_compress_context *comp_ctx, const uchar *packet, size_t *len, size_t *complen)
 
uint my_set_max_open_files (uint files)
 Sets the OS limit on the number of open files (if supported). More...
 
bool my_gethwaddr (uchar *to)
 
static int my_getpagesize ()
 
int my_msync (int, void *, size_t, int)
 
uint get_charset_number (const char *cs_name, uint cs_flags)
 
uint get_collation_number (const char *name)
 
const char * get_collation_name (uint charset_number)
 
CHARSET_INFOget_charset (uint cs_number, myf flags)
 
CHARSET_INFOget_charset_by_name (const char *cs_name, myf flags)
 
CHARSET_INFOmy_collation_get_by_name (const char *collation_name, myf flags, MY_CHARSET_ERRMSG *)
 Find collation by name: extended version of get_charset_by_name() to return error messages to the caller. More...
 
CHARSET_INFOget_charset_by_csname (const char *cs_name, uint cs_flags, myf my_flags)
 
CHARSET_INFOmy_charset_get_by_name (const char *name, uint cs_flags, myf my_flags, MY_CHARSET_ERRMSG *)
 Find character set by name: extended version of get_charset_by_csname() to return error messages to the caller. More...
 
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, ...). More...
 
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, ...). More...
 
char * get_charsets_dir (char *buf)
 
size_t escape_string_for_mysql (const CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length)
 
void charset_uninit ()
 
size_t escape_quotes_for_mysql (CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length, char quote)
 
void my_init_mysys_psi_keys (void)
 
void set_psi_cond_service (void *psi)
 
void set_psi_data_lock_service (void *psi)
 
void set_psi_error_service (void *psi)
 
void set_psi_file_service (void *psi)
 
void set_psi_idle_service (void *psi)
 
void set_psi_mdl_service (void *psi)
 
void set_psi_memory_service (void *psi)
 
void set_psi_metric_service (void *psi)
 
void set_psi_mutex_service (void *psi)
 
void set_psi_rwlock_service (void *psi)
 
void set_psi_socket_service (void *psi)
 
void set_psi_stage_service (void *psi)
 
void set_psi_statement_service (void *psi)
 
void set_psi_system_service (void *psi)
 
void set_psi_table_service (void *psi)
 
void set_psi_thread_service (void *psi)
 
void set_psi_transaction_service (void *psi)
 
void set_psi_tls_channel_service (void *psi)
 

Variables

PSI_memory_key key_memory_max_alloca
 
char * home_dir
 
const char * my_progname
 
std::atomic< ErrorHandlerFunctionPointererror_handler_hook
 
void(* local_message_hook )(enum loglevel ll, uint ecode, va_list args)
 
MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size
 
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)
 
void(* exit_cond_hook )(void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line)
 
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)
 
void(* set_waiting_for_disk_space_hook )(void *opaque_thd, bool waiting)
 
int(* is_killed_hook )(const void *opaque_thd)
 
MYSQL_PLUGIN_IMPORT CHARSET_INFOdefault_charset_info
 
MYSQL_PLUGIN_IMPORT const CHARSET_INFOall_charsets [MY_ALL_CHARSETS_SIZE]
 
ulong my_tmp_file_created
 
ulong my_file_opened
 
ulong my_stream_opened
 
ulong my_file_total_opened
 
bool my_init_done
 
MYSQL_PLUGIN_IMPORT int my_umask
 
int my_umask_dir
 
ulong my_default_record_cache_size
 
bool my_disable_locking
 
bool my_enable_symlinks
 
const char * charsets_dir
 
my_error_vreporter my_charset_error_reporter
 
PSI_file_key key_file_io_cache
 
constexpr int my_b_EOF = INT_MIN
 
MYSQL_PLUGIN_IMPORT PSI_cond_bootstrappsi_cond_hook
 
MYSQL_PLUGIN_IMPORT PSI_data_lock_bootstrappsi_data_lock_hook
 
MYSQL_PLUGIN_IMPORT PSI_error_bootstrappsi_error_hook
 
MYSQL_PLUGIN_IMPORT PSI_file_bootstrappsi_file_hook
 
MYSQL_PLUGIN_IMPORT PSI_idle_bootstrappsi_idle_hook
 
MYSQL_PLUGIN_IMPORT PSI_mdl_bootstrappsi_mdl_hook
 
MYSQL_PLUGIN_IMPORT PSI_memory_bootstrappsi_memory_hook
 
MYSQL_PLUGIN_IMPORT PSI_mutex_bootstrappsi_mutex_hook
 
MYSQL_PLUGIN_IMPORT PSI_metric_bootstrappsi_metric_hook
 
MYSQL_PLUGIN_IMPORT PSI_rwlock_bootstrappsi_rwlock_hook
 
MYSQL_PLUGIN_IMPORT PSI_socket_bootstrappsi_socket_hook
 
MYSQL_PLUGIN_IMPORT PSI_stage_bootstrappsi_stage_hook
 
MYSQL_PLUGIN_IMPORT PSI_statement_bootstrappsi_statement_hook
 
MYSQL_PLUGIN_IMPORT PSI_system_bootstrappsi_system_hook
 
MYSQL_PLUGIN_IMPORT PSI_table_bootstrappsi_table_hook
 
MYSQL_PLUGIN_IMPORT PSI_thread_bootstrappsi_thread_hook
 
MYSQL_PLUGIN_IMPORT PSI_transaction_bootstrappsi_transaction_hook
 
MYSQL_PLUGIN_IMPORT PSI_tls_channel_bootstrappsi_tls_channel_hook
 

Detailed Description

Macro Definition Documentation

◆ alloc_root_inited

#define alloc_root_inited (   A)    ((A)->inited())

◆ base_name

#define base_name (   A)    (A + dirname_length(A))

◆ DEBUG_SYNC_C

#define DEBUG_SYNC_C (   _sync_point_name_)

◆ DEBUG_SYNC_C_IF_THD

#define DEBUG_SYNC_C_IF_THD (   thd,
  _sync_point_name_ 
)

◆ DFLT_INIT_HITS

#define DFLT_INIT_HITS   3

◆ dynamic_element

#define dynamic_element (   array,
  array_index,
  type 
)     ((type)((array)->buffer) + (array_index))

◆ flush_io_cache

#define flush_io_cache (   info)    my_b_flush_io_cache((info), 1)

◆ is_filename_allowed

#define is_filename_allowed (   name,
  length,
  allow_cwd 
)    (true)

◆ MALLOC_OVERHEAD

#define MALLOC_OVERHEAD   8

◆ MAP_NORESERVE

#define MAP_NORESERVE   0

◆ MAP_NOSYNC

#define MAP_NOSYNC   0

◆ MAX_SYSLOG_MESSAGE_SIZE

#define MAX_SYSLOG_MESSAGE_SIZE   1024

◆ ME_BELL

#define ME_BELL   4 /* DEPRECATED: Ring bell then printing message */

◆ ME_ERRORLOG

#define ME_ERRORLOG   64 /* Write the error message to error log */

◆ ME_FATALERROR

#define ME_FATALERROR   1024 /* Fatal statement error */

◆ MIN_COMPRESS_LENGTH

#define MIN_COMPRESS_LENGTH   50 /* Don't compress small bl. */

◆ my_access

#define my_access   access

◆ MY_ALL_CHARSETS_SIZE

#define MY_ALL_CHARSETS_SIZE   2048

◆ my_alloca

#define my_alloca (   SZ)    alloca((size_t)(SZ))

◆ MY_ALLOW_ZERO_PTR

#define MY_ALLOW_ZERO_PTR   64 /* my_realloc() ; zero ptr -> malloc */

◆ MY_APPEND_EXT

#define MY_APPEND_EXT   256 /* add 'ext' as additional extension*/

◆ MY_CHECK_ERROR

#define MY_CHECK_ERROR   1 /* Params to my_end; Check open-close */

◆ MY_COPYTIME

#define MY_COPYTIME   64 /* my_redel() copies time */

◆ my_delete_allow_opened

#define my_delete_allow_opened (   fname,
  flags 
)    my_delete((fname), (flags))

◆ MY_DELETE_OLD

#define MY_DELETE_OLD   256 /* my_create_with_symlink() */

◆ MY_DONT_CHECK_FILESIZE

#define MY_DONT_CHECK_FILESIZE   128 /* Option to init_io_cache() */

◆ MY_DONT_FREE_DBUG

#define MY_DONT_FREE_DBUG   4 /* Do not call DBUG_END() in my_end() */

◆ MY_DONT_OVERWRITE_FILE

#define MY_DONT_OVERWRITE_FILE   1024 /* my_copy: Don't overwrite file */

◆ MY_DONT_WAIT

#define MY_DONT_WAIT   64 /* my_lock() don't wait if can't lock */

◆ MY_ERRNO_EDOM

#define MY_ERRNO_EDOM   33

◆ MY_ERRNO_ERANGE

#define MY_ERRNO_ERANGE   34

◆ MY_FAE

#define MY_FAE   8 /* Fatal if any error */

◆ MY_FILE_ERROR

#define MY_FILE_ERROR   ((size_t)-1)

◆ MY_FNABP

#define MY_FNABP   2 /* Fatal if not all bytes read/written */

◆ MY_FREE_ON_ERROR

#define MY_FREE_ON_ERROR   128 /* my_realloc() ; Free old ptr on error */

◆ MY_FULL_IO

#define MY_FULL_IO   512 /* For my_read - loop intil I/O is complete */

◆ MY_GIVE_INFO

#define MY_GIVE_INFO   2 /* Give time info about process*/

◆ MY_HOLD_ON_ERROR

#define MY_HOLD_ON_ERROR   256 /* my_realloc() ; Return old ptr on error */

◆ MY_HOLD_ORIGINAL_MODES

#define MY_HOLD_ORIGINAL_MODES   128 /* my_copy() holds to file modes */

◆ MY_IGNORE_BADFD

#define MY_IGNORE_BADFD   32 /* my_sync: ignore 'bad descriptor' errors */

◆ MY_INIT

#define MY_INIT (   name)
Value:
{ \
my_progname = name; \
my_init(); \
}
case opt name
Definition: sslopt-case.h:32

◆ MY_LINK_WARNING

#define MY_LINK_WARNING   32 /* my_redel() gives warning if links */

◆ my_mmap

#define my_mmap (   a,
  b,
  c,
  d,
  e,
 
)    mmap64(a, b, c, d, e, f)

◆ my_munmap

#define my_munmap (   a,
 
)    munmap((a), (b))

◆ MY_NABP

#define MY_NABP   4 /* Error if not all bytes read/written */

◆ MY_RELATIVE_PATH

#define MY_RELATIVE_PATH   128 /* name is relative to 'dir' */

◆ MY_REPLACE_DIR

#define MY_REPLACE_DIR   1 /* replace dir in name with 'dir' */

◆ MY_REPLACE_EXT

#define MY_REPLACE_EXT   2 /* replace extension with 'ext' */

◆ MY_REPORT_WAITING_IF_FULL

#define MY_REPORT_WAITING_IF_FULL   64 /* my_write: set status as waiting */

◆ MY_RESOLVE_LINK

#define MY_RESOLVE_LINK   128 /* my_realpath(); Only resolve links */

◆ MY_RESOLVE_SYMLINKS

#define MY_RESOLVE_SYMLINKS   16 /* Resolve all symbolic links */

◆ MY_RETURN_REAL_PATH

#define MY_RETURN_REAL_PATH   32 /* return full path for file */

◆ my_safe_afree

#define my_safe_afree (   ptr,
  size,
  max_alloca_sz 
)     if (size > max_alloca_sz) my_free(ptr)

◆ my_safe_alloca

#define my_safe_alloca (   size,
  max_alloca_sz 
)
Value:
((size <= max_alloca_sz) ? my_alloca(size) \
PSI_memory_key key_memory_max_alloca
Definition: my_static.cc:65
#define my_alloca(SZ)
Definition: my_sys.h:223
#define MYF(v)
Definition: my_inttypes.h:96
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:56

◆ MY_SAFE_PATH

#define MY_SAFE_PATH   64 /* Return NULL if too long path */

◆ MY_SEEK_CUR

#define MY_SEEK_CUR   1

◆ MY_SEEK_END

#define MY_SEEK_END   2

◆ MY_SEEK_NOT_DONE

#define MY_SEEK_NOT_DONE   32 /* my_lock may have to do a seek */

◆ MY_SEEK_SET

#define MY_SEEK_SET   0

◆ MY_SYNC

#define MY_SYNC   4096 /* my_copy(): sync dst file */

◆ MY_UNPACK_FILENAME

#define MY_UNPACK_FILENAME   4 /* Unpack name (~ -> home) */

◆ MY_WAIT_FOR_USER_TO_FIX_PANIC

#define MY_WAIT_FOR_USER_TO_FIX_PANIC   60 /* in seconds */

◆ MY_WAIT_GIVE_USER_A_MESSAGE

#define MY_WAIT_GIVE_USER_A_MESSAGE   10 /* Every 10 times of prev */

◆ MY_WAIT_IF_FULL

#define MY_WAIT_IF_FULL   32 /* Wait and try again if disk full error */

◆ MY_WME

#define MY_WME   16 /* Write message on error */

◆ MY_ZEROFILL

#define MY_ZEROFILL   32 /* my_malloc(), fill array with zero */

◆ MYF_RW

#define MYF_RW   MYF(MY_WME + MY_NABP) /* For my_read & my_write */

◆ MYSYS_ERRMSG_SIZE

#define MYSYS_ERRMSG_SIZE   (512)

Max length of an error message generated by mysys utilities.

Some mysys functions produce error messages. These mostly go to stderr. This constant defines the size of the buffer used to format the message. It should be kept in sync with MYSQL_ERRMSG_SIZE, since sometimes mysys errors are stored in the server diagnostics area, and we would like to avoid unexpected truncation.

◆ MYSYS_STRERROR_SIZE

#define MYSYS_STRERROR_SIZE   (128)

◆ RECORD_CACHE_SIZE

#define RECORD_CACHE_SIZE   (uint)(64 * 1024 - MALLOC_OVERHEAD)

Typedef Documentation

◆ ErrorHandlerFunctionPointer

using ErrorHandlerFunctionPointer = void (*)(uint, const char *, myf)

◆ IO_CACHE_CALLBACK

typedef int(* IO_CACHE_CALLBACK) (IO_CACHE *)

◆ my_error_reporter

typedef void(* my_error_reporter) (enum loglevel level, uint ecode,...)

◆ my_error_vreporter

typedef void(* my_error_vreporter) (enum loglevel level, uint ecode, va_list)

◆ qsort2_cmp

typedef int(* qsort2_cmp) (const void *, const void *, const void *)

Enumeration Type Documentation

◆ cache_type

enum cache_type
Enumerator
TYPE_NOT_SET 
READ_CACHE 
WRITE_CACHE 
SEQ_READ_APPEND 
READ_FIFO 
READ_NET 
WRITE_NET 

◆ flush_type

enum flush_type
Enumerator
FLUSH_KEEP 
FLUSH_RELEASE 
FLUSH_IGNORE_CHANGED 
FLUSH_FORCE_WRITE 

◆ my_syslog_options

Enumerator
MY_SYSLOG_PIDS 

◆ UnlinkOrKeepFile

Enumerator
UNLINK_FILE 
KEEP_FILE 

Function Documentation

◆ _my_b_get()

int _my_b_get ( IO_CACHE info)

◆ _my_b_net_read()

int _my_b_net_read ( IO_CACHE info,
uchar Buffer,
size_t  Count 
)

Read buffered from the net.

Return values
1if can't read requested characters
0if record read

◆ _my_b_read()

int _my_b_read ( IO_CACHE info,
uchar Buffer,
size_t  Count 
)

◆ _my_b_read_r()

int _my_b_read_r ( IO_CACHE info,
uchar Buffer,
size_t  Count 
)

◆ _my_b_seq_read()

int _my_b_seq_read ( IO_CACHE info,
uchar Buffer,
size_t  Count 
)

◆ _my_b_write()

int _my_b_write ( IO_CACHE info,
const uchar Buffer,
size_t  Count 
)

◆ alloc_dynamic()

void * alloc_dynamic ( DYNAMIC_ARRAY array)

◆ array_append_string_unique()

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.

Parameters
strString to be appended
arrayThe array, terminated by a NULL element, all unused elements pre-initialized to NULL
sizeSize of the array; array must be terminated by a NULL pointer, so can hold size - 1 elements
Return values
falseSuccess
trueFailure, array is full

◆ charset_uninit()

void charset_uninit ( )

◆ check_if_legal_filename()

int check_if_legal_filename ( const char *  path)

◆ check_if_legal_tablename()

int check_if_legal_tablename ( const char *  path)

◆ cleanup_dirname()

size_t cleanup_dirname ( char *  to,
const char *  from 
)

Remove unwanted chars from dirname.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

IMPLEMENTATION: "/../" removes prev dir "/~/" removes all before ~ " is same as "/", except on Win32 at start of a file "/./" is removed Unpacks home_dir if "~/.." used Unpacks current dir if if "./.." used

Parameters
toStore result here
fromDirname to fix. May be same as to
Returns
length of new name

◆ close_cached_file()

void close_cached_file ( IO_CACHE cache)

◆ convert_dirname()

char * convert_dirname ( char *  to,
const char *  from,
const char *  from_end 
)

Convert directory name to use under this system.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

IMPLEMENTATION: If Windows converts '/' to '\' Adds a FN_LIBCHAR to end if the result string if there isn't one and the last isn't dev_char. Copies data from 'from' until ASCII(0) for until from == from_end If you want to use the whole 'from' string, just send nullptr as the last argument.

If the result string is larger than FN_REFLEN -1, then it's cut.

Parameters
todestination buffer. Store result here. Must be at least of size min(FN_REFLEN, strlen(from) + 1) to make room for adding FN_LIBCHAR at the end.
fromOriginal filename. May be == to
from_endPointer at end of filename (normally end \0)
Returns
Returns pointer to end \0 in to

◆ create_temp_file()

File create_temp_file ( char *  to,
const char *  dir,
const char *  pfx,
int  mode,
UnlinkOrKeepFile  unlink_or_keep,
myf  MyFlags 
)

◆ delete_dynamic()

void delete_dynamic ( DYNAMIC_ARRAY array)

◆ dirname_length()

size_t dirname_length ( const char *  name)

Get the string length of the directory part of name, including the last FN_LIBCHAR.

If name is not a path, return 0.

On Windows, we special-case Shift-JIS (or more specifically, Windows code-page 932).

Everything else (i.e. anything that's not CP932 and on Windows) is considered binary. Specifically, we assume that drive and directory separators are single-byte (and as defined by FN_LIBCHAR / FN_LIBCHAR2), and that the string is '\0' terminated. Therefore, latin-*, UTF-8, and other arguments that behave sufficiently like ASCII will work, whereas e.g. UTF-16 would break as the separators would have '\0' as part of the UTF-16 character. Fortunately, CP932 does not use '\0' as part of a multi-byte character.

Parameters
namepath to calculate directory length for.
Returns
length of directory part (including the last separator), or 0

◆ dirname_part()

size_t dirname_part ( char *  to,
const char *  name,
size_t *  to_res_length 
)

Gives directory part of filename.

Directory ends with '/'.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects. If the result is truncated, the return value will be larger than the length stored in 'to_length'.

Parameters
todestination buffer.
namepath to get the directory part of.
to_res_lengthstore the the number of bytes written into 'to'.
Returns
Actual length of directory part in 'name' (the number of bytes which would have been written if 'to' had been large enough).

◆ dynstr_append()

bool dynstr_append ( DYNAMIC_STRING str,
const char *  append 
)

◆ dynstr_append_mem()

bool dynstr_append_mem ( DYNAMIC_STRING str,
const char *  append,
size_t  length 
)

◆ dynstr_append_os_quoted()

bool dynstr_append_os_quoted ( DYNAMIC_STRING str,
const char *  append,
  ... 
)

◆ dynstr_append_quoted()

bool dynstr_append_quoted ( DYNAMIC_STRING str,
const char *  quote_str,
const uint  quote_len,
const char *  append,
  ... 
)

◆ dynstr_free()

void dynstr_free ( DYNAMIC_STRING str)

◆ dynstr_realloc()

bool dynstr_realloc ( DYNAMIC_STRING str,
size_t  additional_size 
)

◆ dynstr_set()

bool dynstr_set ( DYNAMIC_STRING str,
const char *  init_str 
)

◆ dynstr_trunc()

bool dynstr_trunc ( DYNAMIC_STRING str,
size_t  n 
)

◆ end_io_cache()

int end_io_cache ( IO_CACHE info)

◆ escape_quotes_for_mysql()

size_t escape_quotes_for_mysql ( CHARSET_INFO charset_info,
char *  to,
size_t  to_length,
const char *  from,
size_t  length,
char  quote 
)

◆ escape_string_for_mysql()

size_t escape_string_for_mysql ( const CHARSET_INFO charset_info,
char *  to,
size_t  to_length,
const char *  from,
size_t  length 
)

◆ fn_ext() [1/2]

char * fn_ext ( char *  name)

◆ fn_ext() [2/2]

const char * fn_ext ( const char *  name)

◆ fn_format()

char * fn_format ( char *  to,
const char *  name,
const char *  dir,
const char *  extension,
uint  flag 
)

Formats a filename with possible replace of directory of extension Function can handle the case where 'to' == 'name' For a description of the flag values, consult my_sys.h The arguments should be in unix format.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'name', 'dir' and 'extension' are '\0'-terminated byte buffers (or nullptr where permitted).

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
todestination buffer.
namefile name component.
dirdirectory component.
extensionfilename extension
flagbitset of 'Bits in last argument of fn_format' from <my_sys.h> like MY_REPLACE_DIR
Returns
to (destination buffer), or nullptr if overflow and MY_SAFE_PATH is used.

◆ fn_same()

char * fn_same ( char *  toname,
const char *  name,
int  flag 
)

◆ free_tmpdir()

void free_tmpdir ( MY_TMPDIR tmpdir)

◆ get_charset()

CHARSET_INFO * get_charset ( uint  cs_number,
myf  flags 
)

◆ get_charset_by_csname()

CHARSET_INFO * get_charset_by_csname ( const char *  cs_name,
uint  cs_flags,
myf  my_flags 
)

◆ get_charset_by_name()

CHARSET_INFO * get_charset_by_name ( const char *  cs_name,
myf  flags 
)

◆ get_charset_number()

uint get_charset_number ( const char *  cs_name,
uint  cs_flags 
)

◆ get_charsets_dir()

char * get_charsets_dir ( char *  buf)

◆ get_collation_name()

const char * get_collation_name ( uint  charset_number)

◆ get_collation_number()

uint get_collation_number ( const char *  name)

◆ get_file_perm()

MY_MODE get_file_perm ( ulong  perm_flags)

◆ get_global_errmsg()

const char * get_global_errmsg ( int  nr)

◆ has_path()

bool has_path ( const char *  name)

◆ init_dynamic_string()

bool init_dynamic_string ( DYNAMIC_STRING str,
const char *  init_str,
size_t  init_alloc 
)

◆ init_io_cache()

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 
)

◆ init_io_cache_ext()

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 
)

◆ init_io_cache_share()

void init_io_cache_share ( IO_CACHE read_cache,
IO_CACHE_SHARE cshare,
IO_CACHE write_cache,
uint  num_threads 
)

◆ init_tmpdir()

bool init_tmpdir ( MY_TMPDIR tmpdir,
const char *  pathlist 
)

◆ insert_dynamic()

bool insert_dynamic ( DYNAMIC_ARRAY array,
const void *  element 
)

◆ intern_filename()

char * intern_filename ( char *  to,
const char *  from 
)

Fix a filename to intern (UNIX format).

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
todestination buffer.
fromsource string.
Returns
to (destination buffer).

◆ memdup_root()

void * memdup_root ( MEM_ROOT root,
const void *  str,
size_t  len 
)

◆ multi_alloc_root()

void * multi_alloc_root ( MEM_ROOT mem_root,
  ... 
)

◆ my_b_append()

int my_b_append ( IO_CACHE info,
const uchar Buffer,
size_t  Count 
)

◆ my_b_bytes_in_cache()

size_t my_b_bytes_in_cache ( const IO_CACHE info)
inline

◆ my_b_clear()

void my_b_clear ( IO_CACHE info)
inline

◆ my_b_copy_to_file()

int my_b_copy_to_file ( IO_CACHE cache,
FILE *  file 
)

◆ my_b_filelength()

my_off_t my_b_filelength ( IO_CACHE info)

◆ my_b_fill()

size_t my_b_fill ( IO_CACHE info)

◆ my_b_flush_io_cache()

int my_b_flush_io_cache ( IO_CACHE info,
int  need_append_buffer_lock 
)

◆ my_b_get()

int my_b_get ( IO_CACHE info)
inline

◆ my_b_get_buffer_start()

uchar * my_b_get_buffer_start ( const IO_CACHE info)
inline

◆ my_b_get_bytes_in_buffer()

size_t my_b_get_bytes_in_buffer ( const IO_CACHE info)
inline

◆ my_b_get_pos_in_file()

my_off_t my_b_get_pos_in_file ( const IO_CACHE info)
inline

◆ my_b_gets()

size_t my_b_gets ( IO_CACHE info,
char *  to,
size_t  max_length 
)

◆ my_b_inited()

bool my_b_inited ( const IO_CACHE info)
inline

◆ my_b_printf()

size_t my_b_printf ( IO_CACHE info,
const char *  fmt,
  ... 
)

Simple printf version.

Used for logging in MySQL. Supports 'c', 's', 'b', 'd', 'u', 'ld', 'lu' and 'llu'. Returns number of written characters, or (size_t) -1 on error.

Parameters
infoThe IO_CACHE to write to
fmtformat string
...variable list of arguments
Returns
number of bytes written, -1 if an error occurred

◆ my_b_read()

int my_b_read ( IO_CACHE info,
uchar buffer,
size_t  count 
)
inline

◆ my_b_safe_write()

int my_b_safe_write ( IO_CACHE info,
const uchar Buffer,
size_t  Count 
)

◆ my_b_seek()

void my_b_seek ( IO_CACHE info,
my_off_t  pos 
)

◆ my_b_tell()

my_off_t my_b_tell ( const IO_CACHE info)
inline

◆ my_b_vprintf()

size_t my_b_vprintf ( IO_CACHE info,
const char *  fmt,
va_list  args 
)

Implementation of my_b_printf.

Parameters
infoThe IO_CACHE to write to
fmtformat string
argsvariable list of arguments
Returns
number of bytes written, -1 if an error occurred

◆ my_b_write()

int my_b_write ( IO_CACHE info,
const uchar buffer,
size_t  count 
)
inline

◆ my_block_write()

int my_block_write ( IO_CACHE info,
const uchar Buffer,
size_t  Count,
my_off_t  pos 
)

◆ my_charset_get_by_name()

CHARSET_INFO * my_charset_get_by_name ( const char *  cs_name,
uint  cs_flags,
myf  flags,
MY_CHARSET_ERRMSG errmsg 
)

Find character set by name: extended version of get_charset_by_csname() to return error messages to the caller.

Parameters
[in]cs_nameCollation name
[in]cs_flagsCharacter set flags (e.g. default or binary collation)
[in]flagsFlags
[out]errmsgError message buffer (if any)
Returns
NULL on error, pointer to collation on success

◆ my_chmod()

bool my_chmod ( const char *  filename,
ulong  perm_flags,
myf  my_flags 
)

◆ my_chsize()

int my_chsize ( File  fd,
my_off_t  newlength,
int  filler,
myf  MyFlags 
)

Change size of file.

Truncates file if shorter else fill with the filler character. The function also changes the file pointer. Usually it points to the end of the file after execution.

Parameters
fdFile descriptor
newlengthNew file size
fillerif we don't have truncate, fill up all bytes after new_length with this character
MyFlagsFlags
Return values
0Ok
1Error

◆ my_close()

int my_close ( File  fd,
myf  MyFlags 
)

Close a file.

Parameters
fdFile sescriptor
MyFlagsSpecial Flags
Return values
0if successful
-1in case of errors

◆ my_closelog()

int my_closelog ( void  )

Closes/de-registers the system logging handle.

Note: Its a thread-unsafe function. It should either be invoked from the main thread or some extra thread safety measures need to be taken.

Returns
0 Success -1 Error

◆ my_collation_get_by_name()

CHARSET_INFO * my_collation_get_by_name ( const char *  collation_name,
myf  flags,
MY_CHARSET_ERRMSG errmsg 
)

Find collation by name: extended version of get_charset_by_name() to return error messages to the caller.

Parameters
[in]collation_nameCollation name
[in]flagsFlags
[out]errmsgError message buffer (if any)
Returns
NULL on error, pointer to collation on success

◆ my_compress()

bool my_compress ( mysql_compress_context comp_ctx,
uchar packet,
size_t *  len,
size_t *  complen 
)

This replaces the packet with a compressed packet.

Parameters
[in]comp_ctxCompress context
[in,out]packetData to compress. This is replaced with the compressed data.
[in]lenLength of data to compress at 'packet'
[out]complenCompressed packet length. 0, if packet was not compressed
Return values
1error. 'len' is not changed
0ok. 'len' contains the size of the compressed packet

◆ my_compress_alloc()

uchar * my_compress_alloc ( mysql_compress_context comp_ctx,
const uchar packet,
size_t *  len,
size_t *  complen 
)

◆ my_copy()

int my_copy ( const char *  from,
const char *  to,
myf  MyFlags 
)

◆ my_create()

File my_create ( const char *  FileName,
int  CreateFlags,
int  AccessFlags,
myf  MyFlags 
)

Create a new file.

Parameters
FileNamePath-name of file
CreateFlagsRead | write on file (umask value)
AccessFlagsRead & Write on open file
MyFlagsSpecial flags
Return values
Filedescriptor on Posix
FileInfoindex on Windows.
-1in case of errors.

◆ my_create_with_symlink()

File my_create_with_symlink ( const char *  linkname,
const char *  filename,
int  createflags,
int  access_flags,
myf  MyFlags 
)

◆ my_delete()

int my_delete ( const char *  name,
myf  MyFlags 
)

◆ my_delete_with_symlink()

int my_delete_with_symlink ( const char *  name,
myf  MyFlags 
)

◆ my_end()

void my_end ( int  infoflag)

◆ my_error()

void my_error ( int  nr,
myf  MyFlags,
  ... 
)

Fill in and print a previously registered error message.

Note
Goes through the (sole) function registered in error_handler_hook
Parameters
nrerror number
MyFlagsFlags
...variable list matching that error format string

◆ my_error_register()

int my_error_register ( const char *(*)(int)  get_errmsg,
int  first,
int  last 
)

Register error messages for use with my_error().

The function is expected to return addresses to NUL-terminated C character strings. NULL pointers and empty strings ("") are allowed. These will be mapped to "Unknown error" when my_error() is called with a matching error number. This function registers the error numbers 'first' to 'last'. No overlapping with previously registered error numbers is allowed.

Parameters
get_errmsgfunction that returns error messages
firsterror number of first message in the array
lasterror number of last message in the array
Return values
0OK
!=0 Error

◆ my_error_unregister()

bool my_error_unregister ( int  first,
int  last 
)

Unregister formerly registered error messages.

This function unregisters the error numbers 'first' to 'last'. These must have been previously registered by my_error_register(). 'first' and 'last' must exactly match the registration. If a matching registration is present, the header is removed from the list.

Parameters
firsterror number of first message
lasterror number of last message
Return values
trueError, no such number range registered.
falseOK

◆ my_fallocator()

int my_fallocator ( File  fd,
my_off_t  newlength,
int  filler,
myf  MyFlags 
)

Change size of the specified file.

Forces the OS to reserve disk space for the file, even when called to fill with zeros. The function also changes the file position. Usually it points to the end of the file after execution.

Note
Implementation based on, and mostly copied from, my_chsize. But instead of ftruncate uses posix_fallocate. This implementation was needed because of allocation in temptable. Probably this implementation should replace my_chsize implementation.
Parameters
[in]fdFile descriptor
[in]newlengthNew file size
[in]fillerFill up all bytes after new_length with this character
[in]MyFlagsFlags
Returns
0 if OK, 1 otherwise

◆ my_fclose()

int my_fclose ( FILE *  stream,
myf  MyFlags 
)

Close a stream.

Parameters
streamFILE stream to close.
MyFlagsFlags controlling error reporting.
Return values
0on success
-1on error

◆ my_fdopen()

FILE * my_fdopen ( File  fd,
const char *  filename,
int  flags,
myf  MyFlags 
)

Make a stream out of a file handle.

Parameters
fdFile descriptor to open a stream to.
filenameName of file to which the fd refers. May be nullptr.
flagsNumeric open mode flags (will be converted to string and passed to fdopen)
MyFlagsFlags for error handling
Return values
nullptrin case of errors
FILEstream if successful

◆ my_filename()

const char * my_filename ( File  fd)

Get filename of file.

Parameters
fdfile descriptor
Returns
file name in file_info object

◆ my_fileno()

File my_fileno ( FILE *  stream)

Portable fileno() wrapper.

◆ my_fopen()

FILE * my_fopen ( const char *  filename,
int  flags,
myf  MyFlags 
)

Open a file as stream.

Parameters
filenamePath-name of file
flagsRead | write | append | trunc (like for open())
MyFlagsFlags for handling errors
Return values
nullptrin case of errors
FILEpointer otherwise

◆ my_fread()

size_t my_fread ( FILE *  stream,
uchar Buffer,
size_t  Count,
myf  MyFlags 
)

Read a chunk of bytes from a FILE stream.

Parameters
streamSource
BufferDestination
CountNumber of bytes to read
MyFlagsFlags for error handling
Return values
Numberof bytes read
MY_FILE_ERRORin case of errors

◆ my_freopen()

FILE * my_freopen ( const char *  filename,
const char *  mode,
FILE *  stream 
)

Change the file associated with a file stream.

Parameters
filenamePath to file.
modeMode of the stream.
streamFile stream.
Note
This function is used to redirect stdout and stderr to a file and subsequently to close and reopen that file for log rotation.
Return values
AFILE pointer on success. Otherwise, NULL.

◆ my_fseek()

my_off_t my_fseek ( FILE *  stream,
my_off_t  pos,
int  whence 
)

Seek to position in FILE stream.

Note that the semantics differ from normal fseek() in that it returns the new position, and not just 0/-1 to indicate success/failure.

Parameters
streamto seek in
posoffset into stream
whencewhere to seek from
Return values
newoffset in stream
MY_FILEPOS_ERRORin case of errors

◆ my_ftell()

my_off_t my_ftell ( FILE *  stream)

Portable ftell() wrapper.

◆ my_fwrite()

size_t my_fwrite ( FILE *  stream,
const uchar Buffer,
size_t  Count,
myf  MyFlags 
)

Write a chunk of bytes to a FILE stream.

Parameters
streamDestination
BufferSource
CountNumber of bytes to write
MyFlagsFlags for error handling
Return values
Numberof bytes written
MY_FILE_ERRORin case of errors

◆ my_get_err_msg()

const char * my_get_err_msg ( int  nr)

Get an error format string from one of the my_error_register()ed sets.

Note
NULL values are possible even within a registered range.
Parameters
nrErrno
Return values
NULLif no message is registered for this error number
strC-string

◆ my_get_large_page_size()

uint my_get_large_page_size ( void  )

◆ my_get_ptr()

my_off_t my_get_ptr ( uchar ptr,
size_t  pack_length 
)

◆ my_gethwaddr()

bool my_gethwaddr ( uchar to)

◆ my_getpagesize()

static int my_getpagesize ( )
inlinestatic

◆ my_getwd()

int my_getwd ( char *  buf,
size_t  size,
myf  MyFlags 
)

◆ my_init()

bool my_init ( void  )

Initialize my_sys functions, resources and variables.

Returns
Initialization result
Return values
falseSuccess
trueError. Couldn't initialize environment

◆ my_init_dynamic_array()

bool my_init_dynamic_array ( DYNAMIC_ARRAY array,
PSI_memory_key  key,
uint  element_size,
void *  init_buffer,
uint  init_alloc,
uint  alloc_increment 
)

◆ my_init_mysys_psi_keys()

void my_init_mysys_psi_keys ( void  )

◆ my_is_same_file()

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 the same file.

◆ my_is_symlink()

int my_is_symlink ( const char *  filename,
ST_FILE_ID file_id 
)

◆ my_load_path()

char * my_load_path ( char *  to,
const char *  path,
const char *  own_path_prefix 
)

Returns full load-path for a file.

to may be = path.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'path' and 'own_path_prefix' are '\0'-terminated byte buffers.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
toPointer to destination which will hold the expanded path.
pathPointer to buffer containing the supplied path.
own_path_prefixPrefix to be appended to path.
Returns
to Pointer to the supplied destination buffer that will hold the full load-path.

◆ my_message()

void my_message ( uint  error,
const char *  str,
myf  MyFlags 
)

Print an error message.

Note
Goes through the (sole) function registered in error_handler_hook
Parameters
errorerror number
strerror message
MyFlagsFlags

◆ my_message_local()

void my_message_local ( enum loglevel  ll,
uint  ecode,
  ... 
)

Issue a message locally (i.e.

on the same host the program is running on, don't transmit to a client).

This goes through local_message_hook, i.e. by default, it calls my_message_local_stderr() which prepends an Error/Warning/Note label to the string, then prints it to stderr using my_message_stderr(). More advanced programs can use their own printers; mysqld for instance uses its own error log facilities which prepend an ISO 8601 / RFC 3339 compliant timestamp etc.

Parameters
lllog level: (ERROR|WARNING|INFORMATION)_LEVEL the printer may use these to filter for verbosity
ecodeError code of a error message.
...parameters to go with the error message.

◆ my_message_local_stderr()

void my_message_local_stderr ( enum loglevel  ll,
uint  ecode,
va_list  args 
)

Issue a message locally (i.e.

on the same host the program is running on, don't transmit to a client).

This is the default value for local_message_hook, and therefore the default printer for my_message_local(). mysys users should not call this directly, but go through my_message_local() instead.

This printer prepends an Error/Warning/Note label to the string, then prints it to stderr using my_message_stderr(). Since my_message_stderr() appends a '
', the format string should not end in a newline.

Parameters
lllog level: (ERROR|WARNING|INFORMATION)_LEVEL the printer may use these to filter for verbosity
ecodeError code of a error message.
argsparameters to go with the error message.

◆ my_message_stderr()

void my_message_stderr ( uint  error,
const char *  str,
myf  MyFlags 
)

Print an error message on stderr.

Prefixed with the binary's name (sans .exe, where applicable, and without path, both to keep our test cases sane). The name is intended to aid debugging by clarifying which binary reported an error, especially in cases like mysql_upgrade which calls several other tools whose messages should be distinguishable from each other's, and from mysql_upgrade's.

This is low-level; in most cases, you should use my_message_local() instead (which by default goes through my_message_local_stderr(), which is a wrapper around this function that adds a severity level).

Parameters
errorThe error number. Currently unused.
strThe message to print. Not trailing
needed.
MyFlagsME_BELL to beep, or 0.

◆ my_mkdir()

int my_mkdir ( const char *  dir,
int  Flags,
myf  MyFlags 
)

◆ my_msync()

int my_msync ( int  fd,
void *  addr,
size_t  len,
int  flags 
)

◆ my_multi_malloc()

void * my_multi_malloc ( PSI_memory_key  key,
myf  flags,
  ... 
)

◆ my_once_alloc()

void * my_once_alloc ( size_t  Size,
myf  MyFlags 
)

◆ my_once_free()

void my_once_free ( void  )

◆ my_once_memdup()

void * my_once_memdup ( const void *  src,
size_t  len,
myf  myflags 
)

◆ my_once_strdup()

char * my_once_strdup ( const char *  src,
myf  myflags 
)

◆ my_open()

File my_open ( const char *  filename,
int  Flags,
myf  MyFlags 
)

Open a file.

Parameters
filenameFully qualified file name
FlagsRead | write
MyFlagsSpecial flags
Return values
Filedescriptor if successful
-1in case of errors

◆ my_openlog()

int my_openlog ( const char *  name,
int  option,
int  facility 
)

Opens/Registers a new handle for system logging.

Note: It's a thread-unsafe function. It should either be invoked from the main thread or some extra thread safety measures need to be taken.

Parameters
nameName of the event source / syslog ident.
optionMY_SYSLOG_PIDS to log PID with each message.
facilityType of program. Passed to openlog().
Returns
0 Success -1 Error, log not opened -2 Error, not updated, using previous values

◆ my_path()

char * my_path ( char *  to,
const char *  progname,
const char *  own_pathname_part 
)

◆ my_pread()

size_t my_pread ( File  Filedes,
uchar Buffer,
size_t  Count,
my_off_t  offset,
myf  MyFlags 
)

Read a chunk of bytes from a file from a given position.

Note
This differs from the normal pread() call in that we don't care to set the position in the file back to the original position if the system doesn't support pread().
Parameters
FiledesFile descriptor
BufferBuffer to read data into
CountNumber of bytes to read
offsetPosition to read from
MyFlagsFlags
Return values
MY_FILE_ERRORin case of error
Numberof bytes read, otherwise

◆ my_printf_error()

void my_printf_error ( uint  error,
const char *  format,
myf  MyFlags,
  ... 
)

Print an error message.

Note
Goes through the (sole) function registered in error_handler_hook
Parameters
errorerror number
formatformat string
MyFlagsFlags
...variable list matching that error format string

◆ my_printv_error()

void my_printv_error ( uint  error,
const char *  format,
myf  MyFlags,
va_list  ap 
)

Print an error message.

Note
Goes through the (sole) function registered in error_handler_hook
Parameters
errorerror number
formatformat string
MyFlagsFlags
apvariable list matching that error format string

◆ my_pwrite()

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.

Note
This differs from the normal pwrite() call in that we don't care to set the position in the file back to the original position if the system doesn't support pwrite()
Parameters
FiledesFile descriptor
BufferBuffer to write data from
CountNumber of bytes to write
offsetPosition to write to
MyFlagsFlags
Returns
If Count == 0, returns 0. If failure, (size_t)-1 == MY_FILE_ERROR. Behavior otherwise depends on MyFlags:

if (MyFlags & (MY_NABP | MY_FNABP)) On success, 0 otherwise On success or partial success, the number of bytes actually written (which can be less than Count).

◆ my_read()

size_t my_read ( File  fd,
uchar Buffer,
size_t  Count,
myf  MyFlags 
)

Read a chunk of bytes from a file with retry's if needed If flag MY_FULL_IO is set then keep reading until EOF is found.

Parameters
fdFile descriptor to read from
[out]BufferBuffer to hold at least Count bytes
CountBytes to read
MyFlagsFlags on what to do on error
Returns
Operation status
Return values
-1on error
0if flag has bits MY_NABP or MY_FNABP set
Nnumber of bytes read

◆ my_readlink()

int my_readlink ( char *  to,
const char *  filename,
myf  MyFlags 
)

◆ my_realpath()

int my_realpath ( char *  to,
const char *  filename,
myf  MyFlags 
)

◆ my_rename()

int my_rename ( const char *  from,
const char *  to,
myf  MyFlags 
)

◆ my_rename_with_symlink()

int my_rename_with_symlink ( const char *  from,
const char *  to,
myf  MyFlags 
)

◆ my_seek()

my_off_t my_seek ( File  fd,
my_off_t  pos,
int  whence,
myf  MyFlags 
)

Seek to a position in a file.

The my_seek function is a wrapper around the system call lseek and repositions the offset of the file descriptor fd to the argument offset according to the directive whence as follows: SEEK_SET The offset is set to offset bytes. SEEK_CUR The offset is set to its current location plus offset bytes SEEK_END The offset is set to the size of the file plus offset bytes

Parameters
fdThe file descriptor
posThe expected position (absolute or relative)
whenceA direction parameter and one of {SEEK_SET, SEEK_CUR, SEEK_END}
MyFlagsflags to control error handling.
Return values
newposThe new position in the file.
MY_FILEPOS_ERRORAn error was encountered while performing the seek. my_errno is set to indicate the actual error.

◆ my_set_max_open_files()

uint my_set_max_open_files ( uint  files)

Sets the OS limit on the number of open files (if supported).

Parameters
filesNumber of requested files
Returns
The actual new OS limit which may be both more or less than what was requested.

◆ my_setwd()

int my_setwd ( const char *  dir,
myf  MyFlags 
)

◆ my_store_ptr()

void my_store_ptr ( uchar buff,
size_t  pack_length,
my_off_t  pos 
)

◆ my_strerror()

char * my_strerror ( char *  buf,
size_t  len,
int  nr 
)

Get a string describing a system or handler error.

thread-safe.

Parameters
bufa buffer in which to return the error message
lenthe size of the aforementioned buffer
nrthe error number
Returns
buf always buf. for signature compatibility with strerror(3).

◆ my_symlink()

int my_symlink ( const char *  content,
const char *  linkname,
myf  MyFlags 
)

◆ my_sync()

int my_sync ( File  fd,
myf  my_flags 
)

◆ my_syslog()

int my_syslog ( const CHARSET_INFO cs,
enum loglevel  level,
const char *  msg 
)

Sends message to the system logger.

On Windows, the specified message is internally converted to UCS-2 encoding, while on other platforms, no conversion takes place and the string is passed to the syslog API as it is.

Parameters
csCharacter set info of the message string
levelLog level
msgMessage to be logged (C-string)
Returns
0 Success -1 Error

◆ my_tell()

my_off_t my_tell ( File  fd,
myf  MyFlags 
)

◆ my_tmpdir()

char * my_tmpdir ( MY_TMPDIR tmpdir)

◆ my_uncompress()

bool my_uncompress ( mysql_compress_context comp_ctx,
uchar packet,
size_t  len,
size_t *  complen 
)

Uncompress packet.

Parameters
comp_ctxPointer to compression context.
packetCompressed data. This is is replaced with the original data.
lenLength of compressed data
[out]complenLength of the packet buffer after uncompression (must be enough for the original data)
Returns
true on error else false on success

◆ my_write()

size_t my_write ( File  Filedes,
const uchar Buffer,
size_t  Count,
myf  MyFlags 
)

Write a chunk of bytes to a file.

if (MyFlags & (MY_NABP | MY_FNABP)) returns 0 if Count == 0 On success, 0 On failure, (size_t)-1 == MY_FILE_ERROR

otherwise returns 0 if Count == 0 On success, the number of bytes written. On partial success (if less than Count bytes could be written), the actual number of bytes written. On failure, (size_t)-1 == MY_FILE_ERROR

◆ MyOsError()

template<class... Ts>
void MyOsError ( int  errno_val,
Ts...  ppck 
)
inline

Convenience wrapper for OS error messages which report errno/my_errno with d followed by strerror as s, as the last conversions in the error message.

The OS error message (my_errno) is formatted in a stack buffer and the errno value and a pointer to the buffer is added to the end of the parameter pack passed to my_error().

Parameters
errno_valerrno/my_errno number.
ppckparameter pack of additional arguments to pass to my_error().

◆ normalize_dirname()

size_t normalize_dirname ( char *  to,
const char *  from 
)

Convert a directory name to a format which can be compared as strings.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
toresult buffer, FN_REFLEN chars in length; may be == from
from'packed' directory name, in whatever format
Returns
size of the normalized name
  • Ensures that last char is FN_LIBCHAR, unless it is FN_DEVCHAR
  • Uses cleanup_dirname
Note
It does not expand ~/ (although, see cleanup_dirname). Nor does it do any case folding. All case-insensitive normalization should be done by the caller.

◆ open_cached_file()

bool open_cached_file ( IO_CACHE cache,
const char *  dir,
const char *  prefix,
size_t  cache_size,
myf  cache_myflags 
)

◆ real_open_cached_file()

bool real_open_cached_file ( IO_CACHE cache)

◆ reinit_io_cache()

bool reinit_io_cache ( IO_CACHE info,
enum cache_type  type,
my_off_t  seek_offset,
bool  use_async_io,
bool  clear_cache 
)

◆ remove_io_thread()

void remove_io_thread ( IO_CACHE info)

◆ resolve_charset()

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, ...).

The function tries to resolve character set by the specified name. If there is character set with the given name, it is assigned to the "cs" parameter and false is returned. If there is no such character set, "default_cs" is assigned to the "cs" and true is returned.

Parameters
[in]cs_nameCharacter set name.
[in]default_csDefault character set.
[out]csVariable to store character set.
Returns
false if character set was resolved successfully; true if there is no character set with given name.

◆ resolve_collation()

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, ...).

The function tries to resolve collation by the specified name. If there is collation with the given name, it is assigned to the "cl" parameter and false is returned. If there is no such collation, "default_cl" is assigned to the "cl" and true is returned.

Parameters
[out]clVariable to store collation.
[in]cl_nameCollation name.
[in]default_clDefault collation.
Returns
false if collation was resolved successfully; true if there is no collation with given name.

◆ safe_strdup_root()

char * safe_strdup_root ( MEM_ROOT root,
const char *  str 
)

◆ set_psi_cond_service()

void set_psi_cond_service ( void *  psi)

◆ set_psi_data_lock_service()

void set_psi_data_lock_service ( void *  psi)

◆ set_psi_error_service()

void set_psi_error_service ( void *  psi)

◆ set_psi_file_service()

void set_psi_file_service ( void *  psi)

◆ set_psi_idle_service()

void set_psi_idle_service ( void *  psi)

◆ set_psi_mdl_service()

void set_psi_mdl_service ( void *  psi)

◆ set_psi_memory_service()

void set_psi_memory_service ( void *  psi)

◆ set_psi_metric_service()

void set_psi_metric_service ( void *  psi)

◆ set_psi_mutex_service()

void set_psi_mutex_service ( void *  psi)

◆ set_psi_rwlock_service()

void set_psi_rwlock_service ( void *  psi)

◆ set_psi_socket_service()

void set_psi_socket_service ( void *  psi)

◆ set_psi_stage_service()

void set_psi_stage_service ( void *  psi)

◆ set_psi_statement_service()

void set_psi_statement_service ( void *  psi)

◆ set_psi_system_service()

void set_psi_system_service ( void *  psi)

◆ set_psi_table_service()

void set_psi_table_service ( void *  psi)

◆ set_psi_thread_service()

void set_psi_thread_service ( void *  psi)

◆ set_psi_tls_channel_service()

void set_psi_tls_channel_service ( void *  psi)

◆ set_psi_transaction_service()

void set_psi_transaction_service ( void *  psi)

◆ setup_io_cache()

void setup_io_cache ( IO_CACHE info)

◆ strdup_root()

char * strdup_root ( MEM_ROOT root,
const char *  str 
)

◆ strlength()

size_t strlength ( const char *  str)

Calculate the length of str not including any trailing ' '-bytes.

Pre-condition: 'str' is a '\0'-terminated byte buffer.

Parameters
strinput to calculate the length of.
Returns
length of string with end-space:s not counted.

◆ strmake_root()

char * strmake_root ( MEM_ROOT root,
const char *  str,
size_t  len 
)

◆ system_filename()

size_t system_filename ( char *  to,
const char *  from 
)

Convert filename (unix standard) to system standard Used before system command's like open(), create()

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
todestination buffer.
fromsource string.
Returns
used length of to

◆ test_if_hard_path()

int test_if_hard_path ( const char *  dir_name)

◆ thr_set_sync_wait_callback()

void thr_set_sync_wait_callback ( void(*)(void)  before_sync,
void(*)(void)  after_sync 
)

◆ to_unix_path()

void to_unix_path ( char *  to)

Convert filename to unix style filename.

Remarks
On Windows, converts '\' to '/'.
Parameters
toA pathname.

◆ unpack_dirname()

size_t unpack_dirname ( char *  to,
const char *  from 
)

Fixes a directory name so that can be used by open().

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Parameters
toResult buffer, FN_REFLEN characters. May be == from
from'Packed' directory name (may contain ~)
  • Uses normalize_dirname()
  • Expands ~/... to home_dir/...
  • Changes a UNIX filename to system filename (replaces / with \ on windows)
Returns
Length of new directory name (= length of to)

◆ unpack_filename()

size_t unpack_filename ( char *  to,
const char *  from 
)

Fix filename so it can be used by open, create.

Pre-condition: At least FN_REFLEN bytes can be stored in buffer pointed to by 'to'. 'from' is a '\0'-terminated byte buffer.

Post-condition: At most FN_REFLEN bytes will have been written to 'to'. If the combined length of 'from' and any expanded elements exceeds FN_REFLEN-1, the result is truncated and likely not what the caller expects.

Note
to may be == from
~ will only be expanded if total length < FN_REFLEN
Parameters
toStore result here. Must be at least of size FN_REFLEN.
fromFilename in unix format (with ~)
Returns
# length of to

◆ wait_for_free_space()

void wait_for_free_space ( const char *  filename,
int  errors 
)

Variable Documentation

◆ all_charsets

◆ charsets_dir

const char* charsets_dir
extern

◆ default_charset_info

MYSQL_PLUGIN_IMPORT CHARSET_INFO* default_charset_info
extern

◆ enter_cond_hook

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) ( 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 
)
extern

◆ enter_stage_hook

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) ( 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 
)
extern

◆ error_handler_hook

std::atomic<ErrorHandlerFunctionPointer> error_handler_hook
extern

◆ exit_cond_hook

void(* exit_cond_hook) (void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line) ( void *  opaque_thd,
const PSI_stage_info stage,
const char *  src_function,
const char *  src_file,
int  src_line 
)
extern

◆ home_dir

char* home_dir
extern

◆ is_killed_hook

int(* is_killed_hook) (const void *opaque_thd) ( const void *  opaque_thd)
extern

◆ key_file_io_cache

PSI_file_key key_file_io_cache
extern

◆ key_memory_max_alloca

PSI_memory_key key_memory_max_alloca
extern

◆ local_message_hook

void(* local_message_hook) (enum loglevel ll, uint ecode, va_list args) ( enum loglevel  ll,
uint  ecode,
va_list  args 
)
extern

◆ my_b_EOF

constexpr int my_b_EOF = INT_MIN
constexpr

◆ my_charset_error_reporter

my_error_vreporter my_charset_error_reporter
extern

◆ my_default_record_cache_size

ulong my_default_record_cache_size
extern

◆ my_disable_locking

bool my_disable_locking
extern

◆ my_enable_symlinks

bool my_enable_symlinks

◆ my_file_opened

ulong my_file_opened
extern

◆ my_file_total_opened

ulong my_file_total_opened
extern

◆ my_init_done

bool my_init_done
extern

◆ my_progname

const char* my_progname
extern

◆ my_stream_opened

ulong my_stream_opened
extern

◆ my_thread_stack_size

MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size
extern

◆ my_tmp_file_created

ulong my_tmp_file_created
extern

◆ my_umask

MYSQL_PLUGIN_IMPORT int my_umask
extern

◆ my_umask_dir

int my_umask_dir
extern

◆ psi_cond_hook

MYSQL_PLUGIN_IMPORT PSI_cond_bootstrap* psi_cond_hook
extern

◆ psi_data_lock_hook

MYSQL_PLUGIN_IMPORT PSI_data_lock_bootstrap* psi_data_lock_hook
extern

◆ psi_error_hook

MYSQL_PLUGIN_IMPORT PSI_error_bootstrap* psi_error_hook
extern

◆ psi_file_hook

MYSQL_PLUGIN_IMPORT PSI_file_bootstrap* psi_file_hook
extern

◆ psi_idle_hook

MYSQL_PLUGIN_IMPORT PSI_idle_bootstrap* psi_idle_hook
extern

◆ psi_mdl_hook

MYSQL_PLUGIN_IMPORT PSI_mdl_bootstrap* psi_mdl_hook
extern

◆ psi_memory_hook

MYSQL_PLUGIN_IMPORT PSI_memory_bootstrap* psi_memory_hook
extern

◆ psi_metric_hook

MYSQL_PLUGIN_IMPORT PSI_metric_bootstrap* psi_metric_hook
extern

◆ psi_mutex_hook

MYSQL_PLUGIN_IMPORT PSI_mutex_bootstrap* psi_mutex_hook
extern

◆ psi_rwlock_hook

MYSQL_PLUGIN_IMPORT PSI_rwlock_bootstrap* psi_rwlock_hook
extern

◆ psi_socket_hook

MYSQL_PLUGIN_IMPORT PSI_socket_bootstrap* psi_socket_hook
extern

◆ psi_stage_hook

MYSQL_PLUGIN_IMPORT PSI_stage_bootstrap* psi_stage_hook
extern

◆ psi_statement_hook

MYSQL_PLUGIN_IMPORT PSI_statement_bootstrap* psi_statement_hook
extern

◆ psi_system_hook

MYSQL_PLUGIN_IMPORT PSI_system_bootstrap* psi_system_hook
extern

◆ psi_table_hook

MYSQL_PLUGIN_IMPORT PSI_table_bootstrap* psi_table_hook
extern

◆ psi_thread_hook

MYSQL_PLUGIN_IMPORT PSI_thread_bootstrap* psi_thread_hook
extern

◆ psi_tls_channel_hook

MYSQL_PLUGIN_IMPORT PSI_tls_channel_bootstrap* psi_tls_channel_hook
extern

◆ psi_transaction_hook

MYSQL_PLUGIN_IMPORT PSI_transaction_bootstrap* psi_transaction_hook
extern

◆ set_waiting_for_disk_space_hook

void(* set_waiting_for_disk_space_hook) (void *opaque_thd, bool waiting) ( void *  opaque_thd,
bool  waiting 
)
extern