MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / init_common_variables

Function init_common_variables

sql/mysqld.cc:1531–1710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1529}
1530
1531int init_common_variables(char *arg_mysql_home)
1532{
1533 umask(((~my_umask) & 0666));
1534 connection_errors_select= 0;
1535 connection_errors_accept= 0;
1536 connection_errors_tcpwrap= 0;
1537 connection_errors_internal= 0;
1538 connection_errors_max_connection= 0;
1539 connection_errors_peer_addr= 0;
1540 my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
1541 tzset(); // Set tzname
1542
1543 max_system_variables.pseudo_thread_id= (ulong)~0;
1544 server_start_time= flush_status_time= my_time(0);
1545
1546
1547 if (init_thread_environment() ||
1548 mysql_init_variables(arg_mysql_home))
1549 return 1;
1550
1551 if (ignore_db_dirs_init())
1552 return 1;
1553
1554#ifdef HAVE_TZNAME
1555 {
1556 struct tm tm_tmp;
1557 localtime_r(&server_start_time,&tm_tmp);
1558 strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
1559 sizeof(system_time_zone)-1);
1560
1561 }
1562#endif
1563
1564
1565 /* TODO: remove this when my_time_t is 64 bit compatible */
1566 if (!IS_TIME_T_VALID_FOR_TIMESTAMP(server_start_time))
1567 {
1568 sql_print_error("This MySQL server doesn't support dates later then 2038");
1569 return 1;
1570 }
1571
1572 if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
1573 {
1574 strmake(glob_hostname, STRING_WITH_LEN("localhost"));
1575 sql_print_warning("gethostname failed, using '%s' as hostname",
1576 glob_hostname);
1577 strmake(default_logfile_name, STRING_WITH_LEN("mysql"));
1578 }
1579 else
1580 strmake(default_logfile_name, glob_hostname,
1581 sizeof(default_logfile_name)-5);
1582
1583 strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5);
1584 strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
1585
1586 if (fix_paths())
1587 return 1;
1588

Callers 1

mysqld_initFunction · 0.85

Calls 15

my_decimal_set_zeroFunction · 0.85
my_timeFunction · 0.85
init_thread_environmentFunction · 0.85
mysql_init_variablesFunction · 0.85
ignore_db_dirs_initFunction · 0.85
strmakeFunction · 0.85
sql_print_errorFunction · 0.85
sql_print_warningFunction · 0.85
strmovFunction · 0.85
fn_extFunction · 0.85
fix_pathsFunction · 0.85
set_server_versionFunction · 0.85

Tested by

no test coverage detected