MySQL 8.4.3
Source Code Documentation
|
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) |
uchar * | my_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... | |
uchar * | my_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_INFO * | get_charset (uint cs_number, myf flags) |
CHARSET_INFO * | get_charset_by_name (const char *cs_name, myf flags) |
CHARSET_INFO * | my_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_INFO * | get_charset_by_csname (const char *cs_name, uint cs_flags, myf my_flags) |
CHARSET_INFO * | my_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) |
unsigned long long | my_physical_memory () |
bool | are_versions_clone_compatible (std::string ver1, std::string ver2) |
Compares versions and determine if clone is allowed. More... | |
#define alloc_root_inited | ( | A | ) | ((A)->inited()) |
#define base_name | ( | A | ) | (A + dirname_length(A)) |
#define DEBUG_SYNC_C | ( | _sync_point_name_ | ) |
#define DEBUG_SYNC_C_IF_THD | ( | thd, | |
_sync_point_name_ | |||
) |
#define DFLT_INIT_HITS 3 |
#define flush_io_cache | ( | info | ) | my_b_flush_io_cache((info), 1) |
#define is_filename_allowed | ( | name, | |
length, | |||
allow_cwd | |||
) | (true) |
#define MALLOC_OVERHEAD 8 |
#define MAP_NORESERVE 0 |
#define MAP_NOSYNC 0 |
#define MAX_SYSLOG_MESSAGE_SIZE 1024 |
#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 MIN_COMPRESS_LENGTH 50 /* Don't compress small bl. */ |
#define my_access access |
#define MY_ALL_CHARSETS_SIZE 2048 |
#define my_alloca | ( | SZ | ) | alloca((size_t)(SZ)) |
#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ |
#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ |
#define MY_COPYTIME 64 /* my_redel() copies time */ |
#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ |
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ |
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ |
#define MY_ERRNO_EDOM 33 |
#define MY_ERRNO_ERANGE 34 |
#define MY_FAE 8 /* Fatal if any error */ |
#define MY_FILE_ERROR ((size_t)-1) |
#define MY_FNABP 2 /* Fatal if not all bytes read/written */ |
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ |
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ |
#define MY_GIVE_INFO 2 /* Give time info about process*/ |
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ |
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ |
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ |
#define MY_INIT | ( | name | ) |
#define my_mmap | ( | a, | |
b, | |||
c, | |||
d, | |||
e, | |||
f | |||
) | mmap64(a, b, c, d, e, f) |
#define my_munmap | ( | a, | |
b | |||
) | munmap((a), (b)) |
#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ |
#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ |
#define MY_REPORT_WAITING_IF_FULL 64 /* my_write: set status as waiting */ |
#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ |
#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ |
#define MY_RETURN_REAL_PATH 32 /* return full path for file */ |
#define my_safe_alloca | ( | size, | |
max_alloca_sz | |||
) |
#define MY_SEEK_CUR 1 |
#define MY_SEEK_END 2 |
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ |
#define MY_SEEK_SET 0 |
#define MY_SYNC 4096 /* my_copy(): sync dst file */ |
#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ |
#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 MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ |
#define MY_WME 16 /* Write message on error */ |
#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ |
#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.
#define MYSYS_STRERROR_SIZE (128) |
#define RECORD_CACHE_SIZE (uint)(64 * 1024 - MALLOC_OVERHEAD) |
using ErrorHandlerFunctionPointer = void (*)(uint, const char *, myf) |
typedef int(* IO_CACHE_CALLBACK) (IO_CACHE *) |
typedef void(* my_error_reporter) (enum loglevel level, uint ecode,...) |
typedef void(* my_error_vreporter) (enum loglevel level, uint ecode, va_list) |
typedef int(* qsort2_cmp) (const void *, const void *, const void *) |
enum cache_type |
enum flush_type |
enum my_syslog_options |
enum UnlinkOrKeepFile |
int _my_b_get | ( | IO_CACHE * | info | ) |
Read buffered from the net.
1 | if can't read requested characters |
0 | if record read |
void * alloc_dynamic | ( | DYNAMIC_ARRAY * | array | ) |
bool are_versions_clone_compatible | ( | std::string | ver1, |
std::string | ver2 | ||
) |
Compares versions and determine if clone is allowed.
Clone is allowed if both the donor and recipient have exactly same version string. In version series 8.1 and above, cloning is allowed if Major and Minor versions match. In 8.0 series, clone is allowed if patch version is above clone backport version. In this comparison, suffixes are ignored: i.e. 8.0.25 should be the same as 8.0.25-debug, but 8.0.25 isn't the same as 8.0.251
ver1 | version1 string |
ver2 | version2 string |
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.
str | String to be appended |
array | The array, terminated by a NULL element, all unused elements pre-initialized to NULL |
size | Size of the array; array must be terminated by a NULL pointer, so can hold size - 1 elements |
false | Success |
true | Failure, array is full |
void charset_uninit | ( | ) |
int check_if_legal_filename | ( | const char * | path | ) |
int check_if_legal_tablename | ( | const char * | path | ) |
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
to | Store result here |
from | Dirname to fix. May be same as to |
void close_cached_file | ( | IO_CACHE * | cache | ) |
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.
to | destination 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. |
from | Original filename. May be == to |
from_end | Pointer at end of filename (normally end \0) |
File create_temp_file | ( | char * | to, |
const char * | dir, | ||
const char * | pfx, | ||
int | mode, | ||
UnlinkOrKeepFile | unlink_or_keep, | ||
myf | MyFlags | ||
) |
void delete_dynamic | ( | DYNAMIC_ARRAY * | array | ) |
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.
name | path to calculate directory length for. |
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'.
to | destination buffer. |
name | path to get the directory part of. |
to_res_length | store the the number of bytes written into 'to'. |
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, | ||
... | |||
) |
void dynstr_free | ( | DYNAMIC_STRING * | str | ) |
bool dynstr_realloc | ( | DYNAMIC_STRING * | str, |
size_t | additional_size | ||
) |
bool dynstr_set | ( | DYNAMIC_STRING * | str, |
const char * | init_str | ||
) |
bool dynstr_trunc | ( | DYNAMIC_STRING * | str, |
size_t | n | ||
) |
int end_io_cache | ( | IO_CACHE * | info | ) |
size_t escape_quotes_for_mysql | ( | CHARSET_INFO * | charset_info, |
char * | to, | ||
size_t | to_length, | ||
const char * | from, | ||
size_t | length, | ||
char | quote | ||
) |
size_t escape_string_for_mysql | ( | const CHARSET_INFO * | charset_info, |
char * | to, | ||
size_t | to_length, | ||
const char * | from, | ||
size_t | length | ||
) |
char * fn_ext | ( | char * | name | ) |
const char * fn_ext | ( | const char * | name | ) |
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.
to | destination buffer. |
name | file name component. |
dir | directory component. |
extension | filename extension |
flag | bitset of 'Bits in last argument of fn_format' from <my_sys.h> like MY_REPLACE_DIR |
char * fn_same | ( | char * | toname, |
const char * | name, | ||
int | flag | ||
) |
void free_tmpdir | ( | MY_TMPDIR * | tmpdir | ) |
CHARSET_INFO * get_charset | ( | uint | cs_number, |
myf | flags | ||
) |
CHARSET_INFO * get_charset_by_csname | ( | const char * | cs_name, |
uint | cs_flags, | ||
myf | my_flags | ||
) |
CHARSET_INFO * get_charset_by_name | ( | const char * | cs_name, |
myf | flags | ||
) |
uint get_charset_number | ( | const char * | cs_name, |
uint | cs_flags | ||
) |
char * get_charsets_dir | ( | char * | buf | ) |
const char * get_collation_name | ( | uint | charset_number | ) |
uint get_collation_number | ( | const char * | name | ) |
MY_MODE get_file_perm | ( | ulong | perm_flags | ) |
const char * get_global_errmsg | ( | int | nr | ) |
bool has_path | ( | const char * | name | ) |
bool init_dynamic_string | ( | DYNAMIC_STRING * | str, |
const char * | init_str, | ||
size_t | init_alloc | ||
) |
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 | ||
) |
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 | ||
) |
void init_io_cache_share | ( | IO_CACHE * | read_cache, |
IO_CACHE_SHARE * | cshare, | ||
IO_CACHE * | write_cache, | ||
uint | num_threads | ||
) |
bool init_tmpdir | ( | MY_TMPDIR * | tmpdir, |
const char * | pathlist | ||
) |
bool insert_dynamic | ( | DYNAMIC_ARRAY * | array, |
const void * | element | ||
) |
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.
to | destination buffer. |
from | source string. |
void * memdup_root | ( | MEM_ROOT * | root, |
const void * | str, | ||
size_t | len | ||
) |
void * multi_alloc_root | ( | MEM_ROOT * | mem_root, |
... | |||
) |
|
inline |
|
inline |
int my_b_copy_to_file | ( | IO_CACHE * | cache, |
FILE * | file | ||
) |
size_t my_b_fill | ( | IO_CACHE * | info | ) |
int my_b_flush_io_cache | ( | IO_CACHE * | info, |
int | need_append_buffer_lock | ||
) |
|
inline |
|
inline |
size_t my_b_gets | ( | IO_CACHE * | info, |
char * | to, | ||
size_t | max_length | ||
) |
|
inline |
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.
info | The IO_CACHE to write to |
fmt | format string |
... | variable list of arguments |
size_t my_b_vprintf | ( | IO_CACHE * | info, |
const char * | fmt, | ||
va_list | args | ||
) |
Implementation of my_b_printf.
info | The IO_CACHE to write to |
fmt | format string |
args | variable list of arguments |
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.
[in] | cs_name | Collation name |
[in] | cs_flags | Character set flags (e.g. default or binary collation) |
[in] | flags | Flags |
[out] | errmsg | Error message buffer (if any) |
bool my_chmod | ( | const char * | filename, |
ulong | perm_flags, | ||
myf | my_flags | ||
) |
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.
fd | File descriptor |
newlength | New file size |
filler | if we don't have truncate, fill up all bytes after new_length with this character |
MyFlags | Flags |
0 | Ok |
1 | Error |
Close a file.
fd | File sescriptor |
MyFlags | Special Flags |
0 | if successful |
-1 | in case of errors |
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.
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.
[in] | collation_name | Collation name |
[in] | flags | Flags |
[out] | errmsg | Error message buffer (if any) |
bool my_compress | ( | mysql_compress_context * | comp_ctx, |
uchar * | packet, | ||
size_t * | len, | ||
size_t * | complen | ||
) |
This replaces the packet with a compressed packet.
[in] | comp_ctx | Compress context |
[in,out] | packet | Data to compress. This is replaced with the compressed data. |
[in] | len | Length of data to compress at 'packet' |
[out] | complen | Compressed packet length. 0, if packet was not compressed |
1 | error. 'len' is not changed |
0 | ok. 'len' contains the size of the compressed packet |
uchar * my_compress_alloc | ( | mysql_compress_context * | comp_ctx, |
const uchar * | packet, | ||
size_t * | len, | ||
size_t * | complen | ||
) |
int my_copy | ( | const char * | from, |
const char * | to, | ||
myf | MyFlags | ||
) |
Create a new file.
FileName | Path-name of file |
CreateFlags | Read | write on file (umask value) |
AccessFlags | Read & Write on open file |
MyFlags | Special flags |
File | descriptor on Posix |
FileInfo | index on Windows. |
-1 | in case of errors. |
File my_create_with_symlink | ( | const char * | linkname, |
const char * | filename, | ||
int | createflags, | ||
int | access_flags, | ||
myf | MyFlags | ||
) |
int my_delete | ( | const char * | name, |
myf | MyFlags | ||
) |
int my_delete_with_symlink | ( | const char * | name, |
myf | MyFlags | ||
) |
void my_end | ( | int | infoflag | ) |
void my_error | ( | int | nr, |
myf | MyFlags, | ||
... | |||
) |
Fill in and print a previously registered error message.
nr | error number |
MyFlags | Flags |
... | variable list matching that error format string |
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.
get_errmsg | function that returns error messages |
first | error number of first message in the array |
last | error number of last message in the array |
0 | OK |
!= | 0 Error |
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.
first | error number of first message |
last | error number of last message |
true | Error, no such number range registered. |
false | OK |
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.
[in] | fd | File descriptor |
[in] | newlength | New file size |
[in] | filler | Fill up all bytes after new_length with this character |
[in] | MyFlags | Flags |
int my_fclose | ( | FILE * | stream, |
myf | MyFlags | ||
) |
Close a stream.
stream | FILE stream to close. |
MyFlags | Flags controlling error reporting. |
0 | on success |
-1 | on error |
Make a stream out of a file handle.
fd | File descriptor to open a stream to. |
filename | Name of file to which the fd refers. May be nullptr. |
flags | Numeric open mode flags (will be converted to string and passed to fdopen) |
MyFlags | Flags for error handling |
nullptr | in case of errors |
FILE | stream if successful |
const char * my_filename | ( | File | fd | ) |
Get filename of file.
fd | file descriptor |
File my_fileno | ( | FILE * | stream | ) |
Portable fileno() wrapper.
FILE * my_fopen | ( | const char * | filename, |
int | flags, | ||
myf | MyFlags | ||
) |
Open a file as stream.
filename | Path-name of file |
flags | Read | write | append | trunc (like for open()) |
MyFlags | Flags for handling errors |
nullptr | in case of errors |
FILE | pointer otherwise |
Read a chunk of bytes from a FILE stream.
stream | Source |
Buffer | Destination |
Count | Number of bytes to read |
MyFlags | Flags for error handling |
Number | of bytes read |
MY_FILE_ERROR | in case of errors |
FILE * my_freopen | ( | const char * | filename, |
const char * | mode, | ||
FILE * | stream | ||
) |
Change the file associated with a file stream.
filename | Path to file. |
mode | Mode of the stream. |
stream | File stream. |
A | FILE pointer on success. Otherwise, NULL. |
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.
stream | to seek in |
pos | offset into stream |
whence | where to seek from |
new | offset in stream |
MY_FILEPOS_ERROR | in case of errors |
my_off_t my_ftell | ( | FILE * | stream | ) |
Portable ftell() wrapper.
Write a chunk of bytes to a FILE stream.
stream | Destination |
Buffer | Source |
Count | Number of bytes to write |
MyFlags | Flags for error handling |
Number | of bytes written |
MY_FILE_ERROR | in case of errors |
const char * my_get_err_msg | ( | int | nr | ) |
Get an error format string from one of the my_error_register()ed sets.
nr | Errno |
NULL | if no message is registered for this error number |
str | C-string |
uint my_get_large_page_size | ( | void | ) |
bool my_gethwaddr | ( | uchar * | to | ) |
|
inlinestatic |
int my_getwd | ( | char * | buf, |
size_t | size, | ||
myf | MyFlags | ||
) |
bool my_init | ( | void | ) |
Initialize my_sys functions, resources and variables.
false | Success |
true | Error. Couldn't initialize environment |
bool my_init_dynamic_array | ( | DYNAMIC_ARRAY * | array, |
PSI_memory_key | key, | ||
uint | element_size, | ||
void * | init_buffer, | ||
uint | init_alloc, | ||
uint | alloc_increment | ||
) |
void my_init_mysys_psi_keys | ( | void | ) |
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.
int my_is_symlink | ( | const char * | filename, |
ST_FILE_ID * | file_id | ||
) |
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.
to | Pointer to destination which will hold the expanded path. |
path | Pointer to buffer containing the supplied path. |
own_path_prefix | Prefix to be appended to path. |
void my_message | ( | uint | error, |
const char * | str, | ||
myf | MyFlags | ||
) |
Print an error message.
error | error number |
str | error message |
MyFlags | Flags |
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.
ll | log level: (ERROR|WARNING|INFORMATION)_LEVEL the printer may use these to filter for verbosity |
ecode | Error code of a error message. |
... | parameters to go with the error message. |
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.
ll | log level: (ERROR|WARNING|INFORMATION)_LEVEL the printer may use these to filter for verbosity |
ecode | Error code of a error message. |
args | parameters to go with the error message. |
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).
error | The error number. Currently unused. |
str | The message to print. Not trailing needed. |
MyFlags | ME_BELL to beep, or 0. |
int my_mkdir | ( | const char * | dir, |
int | Flags, | ||
myf | MyFlags | ||
) |
int my_msync | ( | int | fd, |
void * | addr, | ||
size_t | len, | ||
int | flags | ||
) |
void * my_multi_malloc | ( | PSI_memory_key | key, |
myf | flags, | ||
... | |||
) |
void * my_once_alloc | ( | size_t | Size, |
myf | MyFlags | ||
) |
void my_once_free | ( | void | ) |
void * my_once_memdup | ( | const void * | src, |
size_t | len, | ||
myf | myflags | ||
) |
char * my_once_strdup | ( | const char * | src, |
myf | myflags | ||
) |
Open a file.
filename | Fully qualified file name |
Flags | Read | write |
MyFlags | Special flags |
File | descriptor if successful |
-1 | in case of errors |
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.
name | Name of the event source / syslog ident. |
option | MY_SYSLOG_PIDS to log PID with each message. |
facility | Type of program. Passed to openlog(). |
char * my_path | ( | char * | to, |
const char * | progname, | ||
const char * | own_pathname_part | ||
) |
unsigned long long my_physical_memory | ( | ) |
Read a chunk of bytes from a file from a given position.
Filedes | File descriptor |
Buffer | Buffer to read data into |
Count | Number of bytes to read |
offset | Position to read from |
MyFlags | Flags |
MY_FILE_ERROR | in case of error |
Number | of bytes read, otherwise |
void my_printf_error | ( | uint | error, |
const char * | format, | ||
myf | MyFlags, | ||
... | |||
) |
Print an error message.
error | error number |
format | format string |
MyFlags | Flags |
... | variable list matching that error format string |
void my_printv_error | ( | uint | error, |
const char * | format, | ||
myf | MyFlags, | ||
va_list | ap | ||
) |
Print an error message.
error | error number |
format | format string |
MyFlags | Flags |
ap | variable list matching that error format string |
Write a chunk of bytes to a file at a given position.
Filedes | File descriptor |
Buffer | Buffer to write data from |
Count | Number of bytes to write |
offset | Position to write to |
MyFlags | Flags |
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).
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.
fd | File descriptor to read from | |
[out] | Buffer | Buffer to hold at least Count bytes |
Count | Bytes to read | |
MyFlags | Flags on what to do on error |
-1 | on error |
0 | if flag has bits MY_NABP or MY_FNABP set |
N | number of bytes read |
int my_readlink | ( | char * | to, |
const char * | filename, | ||
myf | MyFlags | ||
) |
int my_realpath | ( | char * | to, |
const char * | filename, | ||
myf | MyFlags | ||
) |
int my_rename | ( | const char * | from, |
const char * | to, | ||
myf | MyFlags | ||
) |
int my_rename_with_symlink | ( | const char * | from, |
const char * | to, | ||
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
fd | The file descriptor |
pos | The expected position (absolute or relative) |
whence | A direction parameter and one of {SEEK_SET, SEEK_CUR, SEEK_END} |
MyFlags | flags to control error handling. |
newpos | The new position in the file. |
MY_FILEPOS_ERROR | An error was encountered while performing the seek. my_errno is set to indicate the actual error. |
uint my_set_max_open_files | ( | uint | files | ) |
Sets the OS limit on the number of open files (if supported).
files | Number of requested files |
int my_setwd | ( | const char * | dir, |
myf | MyFlags | ||
) |
char * my_strerror | ( | char * | buf, |
size_t | len, | ||
int | nr | ||
) |
Get a string describing a system or handler error.
thread-safe.
buf | a buffer in which to return the error message |
len | the size of the aforementioned buffer |
nr | the error number |
int my_symlink | ( | const char * | content, |
const char * | linkname, | ||
myf | MyFlags | ||
) |
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.
cs | Character set info of the message string |
level | Log level |
msg | Message to be logged (C-string) |
char * my_tmpdir | ( | MY_TMPDIR * | tmpdir | ) |
bool my_uncompress | ( | mysql_compress_context * | comp_ctx, |
uchar * | packet, | ||
size_t | len, | ||
size_t * | complen | ||
) |
Uncompress packet.
comp_ctx | Pointer to compression context. | |
packet | Compressed data. This is is replaced with the original data. | |
len | Length of compressed data | |
[out] | complen | Length of the packet buffer after uncompression (must be enough for the original data) |
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
|
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().
errno_val | errno/my_errno number. |
ppck | parameter pack of additional arguments to pass to my_error(). |
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.
to | result buffer, FN_REFLEN chars in length; may be == from |
from | 'packed' directory name, in whatever format |
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 | ) |
bool reinit_io_cache | ( | IO_CACHE * | info, |
enum cache_type | type, | ||
my_off_t | seek_offset, | ||
bool | use_async_io, | ||
bool | clear_cache | ||
) |
void remove_io_thread | ( | IO_CACHE * | info | ) |
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.
[in] | cs_name | Character set name. |
[in] | default_cs | Default character set. |
[out] | cs | Variable to store character set. |
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.
[out] | cl | Variable to store collation. |
[in] | cl_name | Collation name. |
[in] | default_cl | Default collation. |
char * safe_strdup_root | ( | MEM_ROOT * | root, |
const char * | str | ||
) |
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_tls_channel_service | ( | void * | psi | ) |
void set_psi_transaction_service | ( | void * | psi | ) |
void setup_io_cache | ( | IO_CACHE * | info | ) |
char * strdup_root | ( | MEM_ROOT * | root, |
const char * | str | ||
) |
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.
str | input to calculate the length of. |
char * strmake_root | ( | MEM_ROOT * | root, |
const char * | str, | ||
size_t | len | ||
) |
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.
to | destination buffer. |
from | source string. |
int test_if_hard_path | ( | const char * | dir_name | ) |
void thr_set_sync_wait_callback | ( | void(*)(void) | before_sync, |
void(*)(void) | after_sync | ||
) |
void to_unix_path | ( | char * | to | ) |
Convert filename to unix style filename.
to | A pathname. |
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.
to | Result buffer, FN_REFLEN characters. May be == from |
from | 'Packed' directory name (may contain ~) |
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.
to | Store result here. Must be at least of size FN_REFLEN. |
from | Filename in unix format (with ~) |
void wait_for_free_space | ( | const char * | filename, |
int | errors | ||
) |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
constexpr |
|
extern |
|
extern |
|
extern |
bool my_enable_symlinks |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |