MySQL  8.0.16
Source Code Documentation
my_default.h
Go to the documentation of this file.
1 /* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef MY_DEFAULT_INCLUDED
24 #define MY_DEFAULT_INCLUDED
25 
26 /**
27  @file include/my_default.h
28 */
29 
30 #include <sys/types.h>
31 
32 #include "my_inttypes.h"
33 #include "my_macros.h"
34 
35 struct MEM_ROOT;
36 
37 extern const char *my_defaults_extra_file;
38 extern const char *my_defaults_group_suffix;
39 extern const char *my_defaults_file;
41 extern bool my_defaults_read_login_file;
42 extern bool no_defaults;
43 extern char datadir_buffer[];
44 
45 /* Define the type of function to be passed to process_default_option_files */
46 typedef int (*Process_option_func)(void *ctx, const char *group_name,
47  const char *option, const char *cnf_file);
48 void set_persist_args_separator(char **arg);
49 bool my_getopt_is_args_separator(const char *arg);
50 bool my_getopt_is_ro_persist_args_separator(const char *arg);
51 int get_defaults_options(int argc, char **argv, char **defaults,
52  char **extra_defaults, char **group_suffix,
53  char **login_path, bool found_no_defaults);
54 
55 // extern "C" since it is an (undocumented) part of the libmysql ABI.
56 extern "C" int my_load_defaults(const char *conf_file, const char **groups,
57  int *argc, char ***argv, MEM_ROOT *alloc,
58  const char ***);
59 int check_file_permissions(const char *file_name, bool is_login_file);
60 int load_defaults(const char *conf_file, const char **groups, int *argc,
61  char ***argv, MEM_ROOT *alloc);
62 int my_search_option_files(const char *conf_file, int *argc, char ***argv,
63  uint *args_used, Process_option_func func,
64  void *func_ctx, const char **default_directories,
65  bool is_login_file, bool found_no_defaults);
66 void my_print_default_files(const char *conf_file);
67 void print_defaults(const char *conf_file, const char **groups);
69 void update_variable_source(const char *opt_name, const char *config_file);
70 void set_variable_source(const char *opt_name, void *value);
71 
72 #endif // MY_DEFAULT_INCLUDED
Some common macros.
int(* Process_option_func)(void *ctx, const char *group_name, const char *option, const char *cnf_file)
Definition: my_default.h:46
get_options & argc
Definition: do_ctype.cc:51
Some integer typedefs for easier portability.
void set_variable_source(const char *opt_name, void *value)
This function will set value for my_option::arg_source by doing a lookup into variables_hash based on...
Definition: my_default.cc:1451
const char * my_defaults_extra_file
Definition: my_default.cc:192
bool my_defaults_read_login_file
A global to turn off or on reading the mylogin file.
Definition: my_default.cc:628
const char * my_defaults_file
Definition: my_default.cc:190
int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, MEM_ROOT *alloc)
Definition: my_default.cc:621
void init_variable_default_paths()
Initialize all the mappings between default config file paths/ command line options/persistent config...
Definition: my_default.cc:1278
bool my_getopt_is_ro_persist_args_separator(const char *arg)
Definition: my_default.cc:175
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
bool my_getopt_use_args_separator
Definition: my_default.cc:185
char * argv[]
Definition: example1.cc:2
int check_file_permissions(const char *file_name, bool is_login_file)
Check file permissions of the option file.
Definition: my_default.cc:1636
int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, MEM_ROOT *alloc, const char ***)
Definition: my_default.cc:667
const char * my_defaults_group_suffix
Definition: my_default.cc:191
int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, void *func_ctx, const char **default_directories, bool is_login_file, bool found_no_defaults)
Definition: my_default.cc:334
unsigned int uint
Definition: uca-dump.cc:29
void my_print_default_files(const char *conf_file)
Definition: my_default.cc:1194
void set_persist_args_separator(char **arg)
Definition: my_default.cc:172
int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix, char **login_path, bool found_no_defaults)
Definition: my_default.cc:553
void print_defaults(const char *conf_file, const char **groups)
Definition: my_default.cc:1243
bool my_getopt_is_args_separator(const char *arg)
Definition: my_default.cc:186
const string value("\alue\)
char datadir_buffer[]
Holds a reference to the directory where the persisted configuration file is located.
Definition: my_default.cc:125
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
void update_variable_source(const char *opt_name, const char *config_file)
Track all options loaded from config files and command line options along with the path from where op...
Definition: my_default.cc:1370
static const char ** default_directories
Definition: my_default.cc:208
bool no_defaults
Definition: my_default.cc:202