The world's most popular open source database
#include "mysql_priv.h"#include <m_ctype.h>#include <my_dir.h>#include "slave.h"#include "sql_repl.h"#include "rpl_filter.h"#include "repl_failsafe.h"#include "stacktrace.h"#include "mysqld_suffix.h"#include "mysys_err.h"#include "events.h"#include "ha_myisam.h"#include <thr_alarm.h>#include <ft_global.h>#include <errmsg.h>#include "sp_rcontext.h"#include "sp_cache.h"#include <errno.h>#include <sys/stat.h>#include <my_getopt.h>#include <my_net.h>#include <sys/resource.h>#include <netdb.h>#include <sys/utsname.h>#include <my_libwrap.h>#include <my_pthread.h>#include "sslopt-vars.h"#include <sslopt-case.h>Include dependency graph for mysqld.cc:

Go to the source code of this file.
| #define decrement_handler_count | ( | ) |
| #define MAYBE_BROKEN_SYSCALL |
| #define MYSQL_KILL_SIGNAL SIGTERM |
Definition at line 201 of file mysqld.cc.
Referenced by kill_mysql(), kill_server(), main(), and wait_for_signal_thread_to_end().
| #define mysqld_charset &my_charset_latin1 |
Definition at line 59 of file mysqld.cc.
Referenced by check_user(), find_bit_type(), and get_one_option().
| #define reset_floating_point_exceptions | ( | ) |
| #define RETURN_FROM_KILL_SERVER DBUG_RETURN(0) |
Referenced by kill_server().
| #define SA_NODEFER 0 |
| #define SA_RESETHAND 0 |
| #define THR_KILL_SIGNAL SIGUSR2 |
| enum options_mysqld |
Definition at line 4636 of file mysqld.cc.
04637 { 04638 OPT_ISAM_LOG=256, OPT_SKIP_NEW, 04639 OPT_SKIP_GRANT, OPT_SKIP_LOCK, 04640 OPT_ENABLE_LOCK, OPT_USE_LOCKING, 04641 OPT_SOCKET, OPT_UPDATE_LOG, 04642 OPT_BIN_LOG, OPT_SKIP_RESOLVE, 04643 OPT_SKIP_NETWORKING, OPT_BIN_LOG_INDEX, 04644 OPT_BIND_ADDRESS, OPT_PID_FILE, 04645 OPT_SKIP_PRIOR, OPT_BIG_TABLES, 04646 OPT_STANDALONE, OPT_ONE_THREAD, 04647 OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES, 04648 OPT_SKIP_HOST_CACHE, OPT_SHORT_LOG_FORMAT, 04649 OPT_FLUSH, OPT_SAFE, 04650 OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB, 04651 OPT_STORAGE_ENGINE, OPT_INIT_FILE, 04652 OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, 04653 OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, 04654 OPT_BDB_HOME, OPT_BDB_LOG, 04655 OPT_BDB_TMP, OPT_BDB_SYNC, 04656 OPT_BDB_LOCK, OPT_BDB, 04657 OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, 04658 OPT_BDB_DATA_DIRECT, OPT_BDB_LOG_DIRECT, 04659 OPT_MASTER_HOST, OPT_MASTER_USER, 04660 OPT_MASTER_PASSWORD, OPT_MASTER_PORT, 04661 OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY, 04662 OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE, 04663 OPT_MASTER_SSL, OPT_MASTER_SSL_KEY, 04664 OPT_MASTER_SSL_CERT, OPT_MASTER_SSL_CAPATH, 04665 OPT_MASTER_SSL_CIPHER, OPT_MASTER_SSL_CA, 04666 OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB, 04667 OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES, 04668 OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB, 04669 OPT_BINLOG_FORMAT, 04670 #ifndef DBUG_OFF 04671 OPT_BINLOG_SHOW_XID, 04672 #endif 04673 #ifdef HAVE_ROW_BASED_REPLICATION 04674 OPT_BINLOG_ROWS_EVENT_MAX_SIZE, 04675 #endif 04676 OPT_WANT_CORE, OPT_CONCURRENT_INSERT, 04677 OPT_MEMLOCK, OPT_MYISAM_RECOVER, 04678 OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, 04679 OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE, 04680 OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE, 04681 OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, 04682 OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID, 04683 OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER, 04684 OPT_ABORT_SLAVE_EVENT_COUNT, 04685 OPT_INNODB_DATA_HOME_DIR, 04686 OPT_INNODB_DATA_FILE_PATH, 04687 OPT_INNODB_LOG_GROUP_HOME_DIR, 04688 OPT_INNODB_LOG_ARCH_DIR, 04689 OPT_INNODB_LOG_ARCHIVE, 04690 OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, 04691 OPT_INNODB_FLUSH_METHOD, 04692 OPT_INNODB_DOUBLEWRITE, 04693 OPT_INNODB_CHECKSUMS, 04694 OPT_INNODB_FAST_SHUTDOWN, 04695 OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB, 04696 OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, 04697 OPT_LOG_BIN_TRUST_FUNCTION_CREATORS, 04698 OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, 04699 OPT_INNODB, OPT_ISAM, 04700 OPT_ENGINE_CONDITION_PUSHDOWN, 04701 OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT, 04702 OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, 04703 OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME, 04704 OPT_NDB_MGMD, OPT_NDB_NODEID, 04705 OPT_NDB_DISTRIBUTION, 04706 OPT_NDB_INDEX_STAT_ENABLE, 04707 OPT_NDB_INDEX_STAT_CACHE_ENTRIES, OPT_NDB_INDEX_STAT_UPDATE_FREQ, 04708 OPT_NDB_EXTRA_LOGGING, 04709 OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP, 04710 OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE, 04711 OPT_NDB_USE_COPYING_ALTER_TABLE, 04712 OPT_SKIP_SAFEMALLOC, 04713 OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, 04714 OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, 04715 OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, 04716 OPT_SAFE_USER_CREATE, OPT_SQL_MODE, 04717 OPT_HAVE_NAMED_PIPE, 04718 OPT_DO_PSTACK, OPT_EVENT_SCHEDULER, OPT_REPORT_HOST, 04719 OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT, 04720 OPT_SHOW_SLAVE_AUTH_INFO, 04721 OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE, 04722 OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE, 04723 OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE, 04724 OPT_SLAVE_SKIP_ERRORS, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE, 04725 OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, 04726 OPT_SSL_CAPATH, OPT_SSL_CIPHER, 04727 OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE, 04728 OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT, 04729 OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE, 04730 OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, OPT_FT_BOOLEAN_SYNTAX, 04731 OPT_FT_MAX_WORD_LEN, OPT_FT_QUERY_EXPANSION_LIMIT, OPT_FT_STOPWORD_FILE, 04732 OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE, 04733 OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, 04734 OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD, 04735 OPT_LONG_QUERY_TIME, 04736 OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET, 04737 OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE, 04738 OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS, 04739 OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE, 04740 OPT_MAX_JOIN_SIZE, OPT_MAX_PREPARED_STMT_COUNT, 04741 OPT_MAX_RELAY_LOG_SIZE, OPT_MAX_SORT_LENGTH, 04742 OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS, 04743 OPT_MAX_LENGTH_FOR_SORT_DATA, 04744 OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, 04745 OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, 04746 OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, 04747 OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, 04748 OPT_MYISAM_USE_MMAP, 04749 OPT_MYISAM_STATS_METHOD, 04750 OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, 04751 OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, 04752 OPT_OPEN_FILES_LIMIT, 04753 OPT_PRELOAD_BUFFER_SIZE, 04754 OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_MIN_RES_UNIT, OPT_QUERY_CACHE_SIZE, 04755 OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER, 04756 OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT, 04757 OPT_RELAY_LOG_PURGE, 04758 OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, 04759 OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING, 04760 OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, 04761 OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, 04762 OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, 04763 OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS, 04764 OPT_INNODB_MIRRORED_LOG_GROUPS, 04765 OPT_INNODB_LOG_FILES_IN_GROUP, 04766 OPT_INNODB_LOG_FILE_SIZE, 04767 OPT_INNODB_LOG_BUFFER_SIZE, 04768 OPT_INNODB_BUFFER_POOL_SIZE, 04769 OPT_INNODB_BUFFER_POOL_AWE_MEM_MB, 04770 OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE, 04771 OPT_INNODB_MAX_PURGE_LAG, 04772 OPT_INNODB_FILE_IO_THREADS, 04773 OPT_INNODB_LOCK_WAIT_TIMEOUT, 04774 OPT_INNODB_THREAD_CONCURRENCY, 04775 OPT_INNODB_COMMIT_CONCURRENCY, 04776 OPT_INNODB_FORCE_RECOVERY, 04777 OPT_INNODB_STATUS_FILE, 04778 OPT_INNODB_MAX_DIRTY_PAGES_PCT, 04779 OPT_INNODB_TABLE_LOCKS, 04780 OPT_INNODB_SUPPORT_XA, 04781 OPT_INNODB_OPEN_FILES, 04782 OPT_INNODB_AUTOEXTEND_INCREMENT, 04783 OPT_INNODB_SYNC_SPIN_LOOPS, 04784 OPT_INNODB_CONCURRENCY_TICKETS, 04785 OPT_INNODB_THREAD_SLEEP_DELAY, 04786 OPT_BDB_CACHE_SIZE, 04787 OPT_BDB_CACHE_PARTS, 04788 OPT_BDB_LOG_BUFFER_SIZE, 04789 OPT_BDB_MAX_LOCK, 04790 OPT_BDB_REGION_SIZE, 04791 OPT_ERROR_LOG_FILE, 04792 OPT_DEFAULT_WEEK_FORMAT, 04793 OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, 04794 OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE, 04795 OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE, 04796 OPT_SYNC_FRM, OPT_SYNC_BINLOG, 04797 OPT_SYNC_REPLICATION, 04798 OPT_SYNC_REPLICATION_SLAVE_ID, 04799 OPT_SYNC_REPLICATION_TIMEOUT, 04800 OPT_BDB_NOSYNC, 04801 OPT_ENABLE_SHARED_MEMORY, 04802 OPT_SHARED_MEMORY_BASE_NAME, 04803 OPT_OLD_PASSWORDS, 04804 OPT_OLD_ALTER_TABLE, 04805 OPT_EXPIRE_LOGS_DAYS, 04806 OPT_GROUP_CONCAT_MAX_LEN, 04807 OPT_DEFAULT_COLLATION, 04808 OPT_CHARACTER_SET_CLIENT_HANDSHAKE, 04809 OPT_CHARACTER_SET_FILESYSTEM, 04810 OPT_INIT_CONNECT, 04811 OPT_INIT_SLAVE, 04812 OPT_SECURE_AUTH, 04813 OPT_DATE_FORMAT, 04814 OPT_TIME_FORMAT, 04815 OPT_DATETIME_FORMAT, 04816 OPT_LOG_QUERIES_NOT_USING_INDEXES, 04817 OPT_DEFAULT_TIME_ZONE, 04818 OPT_SYSDATE_IS_NOW, 04819 OPT_OPTIMIZER_SEARCH_DEPTH, 04820 OPT_OPTIMIZER_PRUNE_LEVEL, 04821 OPT_UPDATABLE_VIEWS_WITH_LIMIT, 04822 OPT_SP_AUTOMATIC_PRIVILEGES, 04823 OPT_MAX_SP_RECURSION_DEPTH, 04824 OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET, 04825 OPT_ENABLE_LARGE_PAGES, 04826 OPT_TIMED_MUTEXES, 04827 OPT_OLD_STYLE_USER_LIMITS, 04828 OPT_LOG_SLOW_ADMIN_STATEMENTS, 04829 OPT_TABLE_LOCK_WAIT_TIMEOUT, 04830 OPT_PLUGIN_DIR, 04831 OPT_LOG_OUTPUT, 04832 OPT_PORT_OPEN_TIMEOUT, 04833 OPT_GENERAL_LOG, 04834 OPT_SLOW_LOG, 04835 OPT_MERGE 04836 };
| static void bootstrap | ( | FILE * | file | ) | [static] |
Definition at line 3932 of file mysqld.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, handle_bootstrap(), my_net_init(), pthread_mutex_lock, pthread_mutex_unlock, and sql_print_warning().
Referenced by main(), and read_init_file().
03933 { 03934 DBUG_ENTER("bootstrap"); 03935 03936 THD *thd= new THD; 03937 thd->bootstrap=1; 03938 my_net_init(&thd->net,(st_vio*) 0); 03939 thd->max_client_packet_length= thd->net.max_packet; 03940 thd->security_ctx->master_access= ~(ulong)0; 03941 thd->thread_id=thread_id++; 03942 thread_count++; 03943 03944 bootstrap_file=file; 03945 #ifndef EMBEDDED_LIBRARY // TODO: Enable this 03946 if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap, 03947 (void*) thd)) 03948 { 03949 sql_print_warning("Can't create thread to handle bootstrap"); 03950 bootstrap_error=-1; 03951 DBUG_VOID_RETURN; 03952 } 03953 /* Wait for thread to die */ 03954 (void) pthread_mutex_lock(&LOCK_thread_count); 03955 while (thread_count) 03956 { 03957 (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); 03958 DBUG_PRINT("quit",("One thread died (count=%u)",thread_count)); 03959 } 03960 (void) pthread_mutex_unlock(&LOCK_thread_count); 03961 #else 03962 thd->mysql= 0; 03963 handle_bootstrap((void *)thd); 03964 #endif 03965 03966 DBUG_VOID_RETURN; 03967 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void check_data_home | ( | const char * | path | ) | [static] |
| static struct passwd* check_user | ( | const char * | user | ) | [static] |
Definition at line 1366 of file mysqld.cc.
References atoi(), err, global_system_variables, system_variables::log_warnings, my_isdigit, mysqld_charset, pos(), sql_print_error(), sql_print_warning(), strcmp(), and unireg_abort().
01367 { 01368 #if !defined(__WIN__) && !defined(__NETWARE__) 01369 struct passwd *user_info; 01370 uid_t user_id= geteuid(); 01371 01372 // Don't bother if we aren't superuser 01373 if (user_id) 01374 { 01375 if (user) 01376 { 01377 // Don't give a warning, if real user is same as given with --user 01378 user_info= getpwnam(user); 01379 if ((!user_info || user_id != user_info->pw_uid) && 01380 global_system_variables.log_warnings) 01381 sql_print_warning( 01382 "One can only use the --user switch if running as root\n"); 01383 } 01384 return NULL; 01385 } 01386 if (!user) 01387 { 01388 if (!opt_bootstrap) 01389 { 01390 sql_print_error("Fatal error: Please read \"Security\" section of the manual to find out how to run mysqld as root!\n"); 01391 unireg_abort(1); 01392 } 01393 return NULL; 01394 } 01395 if (!strcmp(user,"root")) 01396 return NULL; // Avoid problem with dynamic libraries 01397 01398 if (!(user_info= getpwnam(user))) 01399 { 01400 // Allow a numeric uid to be used 01401 const char *pos; 01402 for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ; 01403 if (*pos) // Not numeric id 01404 goto err; 01405 if (!(user_info= getpwuid(atoi(user)))) 01406 goto err; 01407 else 01408 return user_info; 01409 } 01410 else 01411 return user_info; 01412 01413 err: 01414 sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); 01415 unireg_abort(1); 01416 #endif 01417 return NULL; 01418 }
Here is the call graph for this function:

| void clean_up | ( | bool | print_message | ) | [static] |
Definition at line 1155 of file mysqld.cc.
References acl_free(), binlog_filter, bitmap_free(), MYSQL_BIN_LOG::cleanup(), LOGGER::cleanup_base(), LOGGER::cleanup_end(), TC_LOG::close(), current_thd, system_variables::date_format, system_variables::datetime_format, DBUG_PRINT, delete_elements(), end_ssl(), end_thr_alarm, ER, ER_ERROR_FIRST, ER_ERROR_LAST, ER_SHUTDOWN_COMPLETE, finish_client_errs(), free_charsets(), free_defaults(), free_key_cache(), free_max_user_conn(), free_status_vars(), free_tmpdir(), global_system_variables, grant_free(), ha_binlog_end, ha_panic(), HA_PANIC_CLOSE, hostname_cache_free(), item_user_lock_free(), key_caches, lex_free(), logger, multi_keycache_free(), MY_ALLOW_ZERO_PTR, my_database_names_free(), my_delete(), my_error_unregister(), MY_FAE, my_free, my_free_open_file_info(), my_progname, my_regex_end(), my_tz_free(), MY_WME, MYF, mysql_bin_log, mysql_tmpdir_list, plugin_free(), pthread_mutex_lock, pthread_mutex_unlock, rpl_filter, set_var_free(), sql_print_information(), sys_init_connect, sys_init_slave, sys_var_general_log_path, sys_var_slow_log_path, table_cache_free(), table_def_free(), tc_log, temp_pool, system_variables::time_format, sys_var_str::value, vio_end(), x_free, and xid_cache_free().
01156 { 01157 DBUG_PRINT("exit",("clean_up")); 01158 if (cleanup_done++) 01159 return; /* purecov: inspected */ 01160 01161 logger.cleanup_base(); 01162 01163 /* 01164 make sure that handlers finish up 01165 what they have that is dependent on the binlog 01166 */ 01167 ha_binlog_end(current_thd); 01168 #ifdef HAVE_ROW_BASED_REPLICATION 01169 injector::free_instance(); 01170 #endif 01171 mysql_bin_log.cleanup(); 01172 01173 #ifdef HAVE_REPLICATION 01174 if (use_slave_mask) 01175 bitmap_free(&slave_error_mask); 01176 #endif 01177 my_tz_free(); 01178 my_database_names_free(); 01179 #ifndef NO_EMBEDDED_ACCESS_CHECKS 01180 acl_free(1); 01181 grant_free(); 01182 #endif 01183 query_cache_destroy(); 01184 table_cache_free(); 01185 table_def_free(); 01186 hostname_cache_free(); 01187 item_user_lock_free(); 01188 lex_free(); /* Free some memory */ 01189 set_var_free(); 01190 free_charsets(); 01191 (void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */ 01192 if (!opt_noacl) 01193 { 01194 #ifdef HAVE_DLOPEN 01195 udf_free(); 01196 #endif 01197 } 01198 plugin_free(); 01199 if (tc_log) 01200 tc_log->close(); 01201 xid_cache_free(); 01202 delete_elements(&key_caches, (void (*)(const char*, gptr)) free_key_cache); 01203 multi_keycache_free(); 01204 free_status_vars(); 01205 end_thr_alarm(1); /* Free allocated memory */ 01206 my_free_open_file_info(); 01207 my_free((char*) global_system_variables.date_format, 01208 MYF(MY_ALLOW_ZERO_PTR)); 01209 my_free((char*) global_system_variables.time_format, 01210 MYF(MY_ALLOW_ZERO_PTR)); 01211 my_free((char*) global_system_variables.datetime_format, 01212 MYF(MY_ALLOW_ZERO_PTR)); 01213 if (defaults_argv) 01214 free_defaults(defaults_argv); 01215 my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR)); 01216 my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR)); 01217 my_free(sys_var_general_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); 01218 my_free(sys_var_slow_log_path.value, MYF(MY_ALLOW_ZERO_PTR)); 01219 free_tmpdir(&mysql_tmpdir_list); 01220 #ifdef HAVE_REPLICATION 01221 my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR)); 01222 #endif 01223 x_free(opt_bin_logname); 01224 x_free(opt_relay_logname); 01225 bitmap_free(&temp_pool); 01226 free_max_user_conn(); 01227 #ifdef HAVE_REPLICATION 01228 end_slave_list(); 01229 #endif 01230 delete binlog_filter; 01231 delete rpl_filter; 01232 end_ssl(); 01233 vio_end(); 01234 #ifdef USE_REGEX 01235 my_regex_end(); 01236 #endif 01237 01238 if (print_message && errmesg) 01239 sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname); 01240 #if !defined(EMBEDDED_LIBRARY) 01241 if (!opt_bootstrap) 01242 (void) my_delete(pidfile_name,MYF(0)); // This may not always exist 01243 #endif 01244 finish_client_errs(); 01245 my_free((gptr) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST), 01246 MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); 01247 DBUG_PRINT("quit", ("Error messages freed")); 01248 /* Tell main we are ready */ 01249 logger.cleanup_end(); 01250 (void) pthread_mutex_lock(&LOCK_thread_count); 01251 DBUG_PRINT("quit", ("got thread count lock")); 01252 ready_to_exit=1; 01253 /* do the broadcast inside the lock to ensure that my_end() is not called */ 01254 (void) pthread_cond_broadcast(&COND_thread_count); 01255 (void) pthread_mutex_unlock(&LOCK_thread_count); 01256 01257 /* 01258 The following lines may never be executed as the main thread may have 01259 killed us 01260 */ 01261 DBUG_PRINT("quit", ("done with cleanup")); 01262 } /* clean_up */
Here is the call graph for this function:

| static void clean_up_mutexes | ( | void | ) | [static] |
Definition at line 1288 of file mysqld.cc.
References COND_manager, Events::destroy_mutexes(), lock, LOCK_grant, LOCK_lock_db, LOCK_manager, LOCK_sys_init_connect, LOCK_sys_init_slave, OPENSSL_free, pthread_mutex_destroy, and rwlock_destroy.
Referenced by main(), and unireg_abort().
01289 { 01290 (void) pthread_mutex_destroy(&LOCK_mysql_create_db); 01291 (void) pthread_mutex_destroy(&LOCK_lock_db); 01292 (void) pthread_mutex_destroy(&LOCK_Acl); 01293 (void) rwlock_destroy(&LOCK_grant); 01294 (void) pthread_mutex_destroy(&LOCK_open); 01295 (void) pthread_mutex_destroy(&LOCK_thread_count); 01296 (void) pthread_mutex_destroy(&LOCK_mapped_file); 01297 (void) pthread_mutex_destroy(&LOCK_status); 01298 (void) pthread_mutex_destroy(&LOCK_error_log); 01299 (void) pthread_mutex_destroy(&LOCK_delayed_insert); 01300 (void) pthread_mutex_destroy(&LOCK_delayed_status); 01301 (void) pthread_mutex_destroy(&LOCK_delayed_create); 01302 (void) pthread_mutex_destroy(&LOCK_manager); 01303 (void) pthread_mutex_destroy(&LOCK_crypt); 01304 (void) pthread_mutex_destroy(&LOCK_bytes_sent); 01305 (void) pthread_mutex_destroy(&LOCK_bytes_received); 01306 (void) pthread_mutex_destroy(&LOCK_user_conn); 01307 Events::destroy_mutexes(); 01308 #ifdef HAVE_OPENSSL 01309 (void) pthread_mutex_destroy(&LOCK_des_key_file); 01310 #ifndef HAVE_YASSL 01311 for (int i= 0; i < CRYPTO_num_locks(); ++i) 01312 (void) rwlock_destroy(&openssl_stdlocks[i].lock); 01313 OPENSSL_free(openssl_stdlocks); 01314 #endif 01315 #endif 01316 #ifdef HAVE_REPLICATION 01317 (void) pthread_mutex_destroy(&LOCK_rpl_status); 01318 (void) pthread_cond_destroy(&COND_rpl_status); 01319 #endif 01320 (void) pthread_mutex_destroy(&LOCK_active_mi); 01321 (void) rwlock_destroy(&LOCK_sys_init_connect); 01322 (void) rwlock_destroy(&LOCK_sys_init_slave); 01323 (void) pthread_mutex_destroy(&LOCK_global_system_variables); 01324 (void) pthread_mutex_destroy(&LOCK_global_read_lock); 01325 (void) pthread_mutex_destroy(&LOCK_uuid_generator); 01326 (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count); 01327 (void) pthread_cond_destroy(&COND_thread_count); 01328 (void) pthread_cond_destroy(&COND_refresh); 01329 (void) pthread_cond_destroy(&COND_global_read_lock); 01330 (void) pthread_cond_destroy(&COND_thread_cache); 01331 (void) pthread_cond_destroy(&COND_flush_thread_cache); 01332 (void) pthread_cond_destroy(&COND_manager); 01333 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1679 of file mysqld.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, ER, KILL_CONNECTION, net_send_error(), pthread_mutex_lock, pthread_mutex_unlock, vio_close, and vio_description().
01680 { 01681 st_vio *vio; 01682 DBUG_ENTER("close_connection"); 01683 DBUG_PRINT("enter",("fd: %s error: '%s'", 01684 thd->net.vio ? vio_description(thd->net.vio) : 01685 "(not connected)", 01686 errcode ? ER(errcode) : "")); 01687 if (lock) 01688 (void) pthread_mutex_lock(&LOCK_thread_count); 01689 thd->killed= THD::KILL_CONNECTION; 01690 if ((vio= thd->net.vio) != 0) 01691 { 01692 if (errcode) 01693 net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */ 01694 vio_close(vio); /* vio is freed in delete thd */ 01695 } 01696 if (lock) 01697 (void) pthread_mutex_unlock(&LOCK_thread_count); 01698 DBUG_VOID_RETURN; 01699 }
Here is the call graph for this function:

| static void close_connections | ( | void | ) | [static] |
Definition at line 735 of file mysqld.cc.
References close_connection(), close_server_sock(), closesocket, COND_manager, count, DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, end_thr_alarm, ER, ER_FORCING_CLOSE, error, flush_thread_cache(), global_system_variables, HANDLE, INVALID_SOCKET, KILL_CONNECTION, LINT_INIT, LOCK_manager, system_variables::log_warnings, manager_thread, manager_thread_in_use, my_progname, pthread_mutex_lock, pthread_mutex_unlock, set_timespec, Events::shutdown(), sleep, sql_print_error(), sql_print_warning(), THR_CLIENT_ALARM, and threads.
Referenced by kill_server().
00736 { 00737 #ifdef EXTRA_DEBUG 00738 int count=0; 00739 #endif 00740 DBUG_ENTER("close_connections"); 00741 00742 /* Clear thread cache */ 00743 kill_cached_threads++; 00744 flush_thread_cache(); 00745 00746 /* kill flush thread */ 00747 (void) pthread_mutex_lock(&LOCK_manager); 00748 if (manager_thread_in_use) 00749 { 00750 DBUG_PRINT("quit",("killing manager thread: 0x%lx",manager_thread)); 00751 (void) pthread_cond_signal(&COND_manager); 00752 } 00753 (void) pthread_mutex_unlock(&LOCK_manager); 00754 00755 /* kill connection thread */ 00756 #if !defined(__WIN__) && !defined(__NETWARE__) 00757 DBUG_PRINT("quit",("waiting for select thread: 0x%lx",select_thread)); 00758 (void) pthread_mutex_lock(&LOCK_thread_count); 00759 00760 while (select_thread_in_use) 00761 { 00762 struct timespec abstime; 00763 int error; 00764 LINT_INIT(error); 00765 DBUG_PRINT("info",("Waiting for select thread")); 00766 00767 #ifndef DONT_USE_THR_ALARM 00768 if (pthread_kill(select_thread,THR_CLIENT_ALARM)) 00769 break; // allready dead 00770 #endif 00771 set_timespec(abstime, 2); 00772 for (uint tmp=0 ; tmp < 10 && select_thread_in_use; tmp++) 00773 { 00774 error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count, 00775 &abstime); 00776 if (error != EINTR) 00777 break; 00778 } 00779 #ifdef EXTRA_DEBUG 00780 if (error != 0 && !count++) 00781 sql_print_error("Got error %d from pthread_cond_timedwait",error); 00782 #endif 00783 close_server_sock(); 00784 } 00785 (void) pthread_mutex_unlock(&LOCK_thread_count); 00786 #endif /* __WIN__ */ 00787 00788 00789 /* Abort listening to new connections */ 00790 DBUG_PRINT("quit",("Closing sockets")); 00791 if (!opt_disable_networking ) 00792 { 00793 if (ip_sock != INVALID_SOCKET) 00794 { 00795 (void) shutdown(ip_sock,2); 00796 (void) closesocket(ip_sock); 00797 ip_sock= INVALID_SOCKET; 00798 } 00799 } 00800 #ifdef __NT__ 00801 if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe) 00802 { 00803 HANDLE temp; 00804 DBUG_PRINT("quit", ("Closing named pipes") ); 00805 00806 /* Create connection to the handle named pipe handler to break the loop */ 00807 if ((temp = CreateFile(pipe_name, 00808 GENERIC_READ | GENERIC_WRITE, 00809 0, 00810 NULL, 00811 OPEN_EXISTING, 00812 0, 00813 NULL )) != INVALID_HANDLE_VALUE) 00814 { 00815 WaitNamedPipe(pipe_name, 1000); 00816 DWORD dwMode = PIPE_READMODE_BYTE | PIPE_WAIT; 00817 SetNamedPipeHandleState(temp, &dwMode, NULL, NULL); 00818 CancelIo(temp); 00819 DisconnectNamedPipe(temp); 00820 CloseHandle(temp); 00821 } 00822 } 00823 #endif 00824 #ifdef HAVE_SYS_UN_H 00825 if (unix_sock != INVALID_SOCKET) 00826 { 00827 (void) shutdown(unix_sock,2); 00828 (void) closesocket(unix_sock); 00829 (void) unlink(mysqld_unix_port); 00830 unix_sock= INVALID_SOCKET; 00831 } 00832 #endif 00833 end_thr_alarm(0); // Abort old alarms. 00834 00835 /* 00836 First signal all threads that it's time to die 00837 This will give the threads some time to gracefully abort their 00838 statements and inform their clients that the server is about to die. 00839 */ 00840 00841 THD *tmp; 00842 (void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list 00843 00844 I_List_iterator<THD> it(threads); 00845 while ((tmp=it++)) 00846 { 00847 DBUG_PRINT("quit",("Informing thread %ld that it's time to die", 00848 tmp->thread_id)); 00849 /* We skip slave threads & scheduler on this first loop through. */ 00850 if (tmp->slave_thread || tmp->system_thread == SYSTEM_THREAD_EVENT_SCHEDULER) 00851 continue; 00852 00853 tmp->killed= THD::KILL_CONNECTION; 00854 if (tmp->mysys_var) 00855 { 00856 tmp->mysys_var->abort=1; 00857 pthread_mutex_lock(&tmp->mysys_var->mutex); 00858 if (tmp->mysys_var->current_cond) 00859 { 00860 pthread_mutex_lock(tmp->mysys_var->current_mutex); 00861 pthread_cond_broadcast(tmp->mysys_var->current_cond); 00862 pthread_mutex_unlock(tmp->mysys_var->current_mutex); 00863 } 00864 pthread_mutex_unlock(&tmp->mysys_var->mutex); 00865 } 00866 } 00867 (void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list 00868 00869 Events::shutdown(); 00870 end_slave(); 00871 00872 if (thread_count) 00873 sleep(2); // Give threads time to die 00874 00875 /* 00876 Force remaining threads to die by closing the connection to the client 00877 This will ensure that threads that are waiting for a command from the 00878 client on a blocking read call are aborted. 00879 */ 00880 00881 for (;;) 00882 { 00883 DBUG_PRINT("quit",("Locking LOCK_thread_count")); 00884 (void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list 00885 if (!(tmp=threads.get())) 00886 { 00887 DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); 00888 (void) pthread_mutex_unlock(&LOCK_thread_count); 00889 break; 00890 } 00891 #ifndef __bsdi__ // Bug in BSDI kernel 00892 if (tmp->vio_ok()) 00893 { 00894 if (global_system_variables.log_warnings) 00895 sql_print_warning(ER(ER_FORCING_CLOSE),my_progname, 00896 tmp->thread_id, 00897 (tmp->main_security_ctx.user ? 00898 tmp->main_security_ctx.user : "")); 00899 close_connection(tmp,0,0); 00900 } 00901 #endif 00902 DBUG_PRINT("quit",("Unlocking LOCK_thread_count")); 00903 (void) pthread_mutex_unlock(&LOCK_thread_count); 00904 } 00905 /* All threads has now been aborted */ 00906 DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count)); 00907 (void) pthread_mutex_lock(&LOCK_thread_count); 00908 while (thread_count) 00909 { 00910 (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); 00911 DBUG_PRINT("quit",("One thread died (count=%u)",thread_count)); 00912 } 00913 (void) pthread_mutex_unlock(&LOCK_thread_count); 00914 00915 DBUG_PRINT("quit",("close_connections thread")); 00916 DBUG_VOID_RETURN; 00917 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void close_server_sock | ( | ) | [static] |
Definition at line 921 of file mysqld.cc.
References closesocket, DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, INVALID_SOCKET, my_socket, and VOID.
Referenced by close_connections(), and kill_mysql().
00922 { 00923 #ifdef HAVE_CLOSE_SERVER_SOCK 00924 DBUG_ENTER("close_server_sock"); 00925 my_socket tmp_sock; 00926 tmp_sock=ip_sock; 00927 if (tmp_sock != INVALID_SOCKET) 00928 { 00929 ip_sock=INVALID_SOCKET; 00930 DBUG_PRINT("info",("calling shutdown on TCP/IP socket")); 00931 VOID(shutdown(tmp_sock,2)); 00932 #if defined(__NETWARE__) 00933 /* 00934 The following code is disabled for normal systems as it causes MySQL 00935 to hang on AIX 4.3 during shutdown 00936 */ 00937 DBUG_PRINT("info",("calling closesocket on TCP/IP socket")); 00938 VOID(closesocket(tmp_sock)); 00939 #endif 00940 } 00941 tmp_sock=unix_sock; 00942 if (tmp_sock != INVALID_SOCKET) 00943 { 00944 unix_sock=INVALID_SOCKET; 00945 DBUG_PRINT("info",("calling shutdown on unix socket")); 00946 VOID(shutdown(tmp_sock,2)); 00947 #if defined(__NETWARE__) 00948 /* 00949 The following code is disabled for normal systems as it may cause MySQL 00950 to hang on AIX 4.3 during shutdown 00951 */ 00952 DBUG_PRINT("info",("calling closesocket on unix/IP socket")); 00953 VOID(closesocket(tmp_sock)); 00954 #endif 00955 VOID(unlink(mysqld_unix_port)); 00956 } 00957 DBUG_VOID_RETURN; 00958 #endif 00959 }
Here is the caller graph for this function:

| static void create_maintenance_thread | ( | ) | [static] |
Definition at line 3335 of file mysqld.cc.
References handle_manager(), and sql_print_warning().
Referenced by main().
03336 { 03337 if (flush_time && flush_time != ~(ulong) 0L) 03338 { 03339 pthread_t hThread; 03340 if (pthread_create(&hThread,&connection_attrib,handle_manager,0)) 03341 sql_print_warning("Can't create thread to manage maintenance"); 03342 } 03343 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void create_new_thread | ( | THD * | thd | ) | [static] |
Definition at line 4003 of file mysqld.cc.
References close_connection(), DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, ER_CANT_CREATE_THREAD, ER_CON_COUNT_ERROR, error, handle_one_connection(), KILL_CONNECTION, net_printf_error(), pthread_mutex_lock, pthread_mutex_unlock, st_net::read_timeout, st_net::return_errno, statistic_increment, TEST_NO_THREADS, thread_cache, and threads.
Referenced by handle_connections_sockets().
04004 { 04005 DBUG_ENTER("create_new_thread"); 04006 04007 NET *net=&thd->net; // For easy ref 04008 net->read_timeout = (uint) connect_timeout; 04009 if (protocol_version > 9) 04010 net->return_errno=1; 04011 04012 /* don't allow too many connections */ 04013 if (thread_count - delayed_insert_threads >= max_connections+1 || abort_loop) 04014 { 04015 DBUG_PRINT("error",("Too many connections")); 04016 close_connection(thd, ER_CON_COUNT_ERROR, 1); 04017 delete thd; 04018 DBUG_VOID_RETURN; 04019 } 04020 pthread_mutex_lock(&LOCK_thread_count); 04021 thd->thread_id=thread_id++; 04022 04023 thd->real_id=pthread_self(); // Keep purify happy 04024 04025 /* Start a new thread to handle connection */ 04026 thread_count++; 04027 04028 #ifdef ONE_THREAD 04029 if (test_flags & TEST_NO_THREADS) // For debugging under Linux 04030 { 04031 thread_cache_size=0; // Safety 04032 threads.append(thd); 04033 thd->real_id=pthread_self(); 04034 (void) pthread_mutex_unlock(&LOCK_thread_count); 04035 handle_one_connection((void*) thd); 04036 } 04037 else 04038 #endif 04039 { 04040 if (thread_count-delayed_insert_threads > max_used_connections) 04041 max_used_connections=thread_count-delayed_insert_threads; 04042 04043 if (cached_thread_count > wake_thread) 04044 { 04045 thread_cache.append(thd); 04046 wake_thread++; 04047 pthread_cond_signal(&COND_thread_cache); 04048 } 04049 else 04050 { 04051 int error; 04052 thread_created++; 04053 threads.append(thd); 04054 DBUG_PRINT("info",(("creating thread %d"), thd->thread_id)); 04055 thd->connect_time = time(NULL); 04056 if ((error=pthread_create(&thd->real_id,&connection_attrib, 04057 handle_one_connection, 04058 (void*) thd))) 04059 { 04060 DBUG_PRINT("error", 04061 ("Can't create thread to handle request (error %d)", 04062 error)); 04063 thread_count--; 04064 thd->killed= THD::KILL_CONNECTION; // Safety 04065 (void) pthread_mutex_unlock(&LOCK_thread_count); 04066 statistic_increment(aborted_connects,&LOCK_status); 04067 net_printf_error(thd, ER_CANT_CREATE_THREAD, error); 04068 (void) pthread_mutex_lock(&LOCK_thread_count); 04069 close_connection(thd,0,0); 04070 delete thd; 04071 (void) pthread_mutex_unlock(&LOCK_thread_count); 04072 DBUG_VOID_RETURN; 04073 } 04074 } 04075 (void) pthread_mutex_unlock(&LOCK_thread_count); 04076 04077 } 04078 DBUG_PRINT("info",("Thread created")); 04079 DBUG_VOID_RETURN; 04080 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void create_pid_file | ( | ) | [static] |
Definition at line 8019 of file mysqld.cc.
References exit, int10_to_str(), my_close(), my_create(), MY_NABP, MY_WME, my_write, MYF, and sql_perror().
08020 { 08021 File file; 08022 if ((file = my_create(pidfile_name,0664, 08023 O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0) 08024 { 08025 char buff[21], *end; 08026 end= int10_to_str((long) getpid(), buff, 10); 08027 *end++= '\n'; 08028 if (!my_write(file, (byte*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP))) 08029 { 08030 (void) my_close(file, MYF(0)); 08031 return; 08032 } 08033 (void) my_close(file, MYF(0)); 08034 } 08035 sql_perror("Can't start server: can't create PID file"); 08036 exit(1); 08037 }
Here is the call graph for this function:

| static void create_shutdown_thread | ( | ) | [static] |
Definition at line 3346 of file mysqld.cc.
References FALSE, NTService::SetShutdownEvent(), and sql_print_warning().
Referenced by main().
03347 { 03348 #if !defined(EMBEDDED_LIBRARY) 03349 #ifdef __WIN__ 03350 hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name); 03351 pthread_t hThread; 03352 if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0)) 03353 sql_print_warning("Can't create thread to handle shutdown requests"); 03354 03355 // On "Stop Service" we have to do regular shutdown 03356 Service.SetShutdownEvent(hEventShutdown); 03357 #endif 03358 #endif // EMBEDDED_LIBRARY 03359 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void end_ssl | ( | ) | [static] |
Definition at line 3001 of file mysqld.cc.
Referenced by clean_up().
03002 { 03003 #ifdef HAVE_OPENSSL 03004 if (ssl_acceptor_fd) 03005 { 03006 free_vio_ssl_acceptor_fd(ssl_acceptor_fd); 03007 ssl_acceptor_fd= 0; 03008 } 03009 #endif /* HAVE_OPENSSL */ 03010 }
Here is the caller graph for this function:

| void end_thread | ( | THD * | thd, | |
| bool | put_in_cache | |||
| ) |
Definition at line 1719 of file mysqld.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, my_thread_end(), pthread_mutex_lock, pthread_mutex_unlock, TEST_NO_THREADS, thread_cache, and threads.
Referenced by end_thread_signal(), and handle_one_connection().
01720 { 01721 DBUG_ENTER("end_thread"); 01722 thd->cleanup(); 01723 (void) pthread_mutex_lock(&LOCK_thread_count); 01724 thread_count--; 01725 delete thd; 01726 01727 if (put_in_cache && cached_thread_count < thread_cache_size && 01728 ! abort_loop && !kill_cached_threads) 01729 { 01730 /* Don't kill the thread, just put it in cache for reuse */ 01731 DBUG_PRINT("info", ("Adding thread to cache")); 01732 cached_thread_count++; 01733 while (!abort_loop && ! wake_thread && ! kill_cached_threads) 01734 (void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count); 01735 cached_thread_count--; 01736 if (kill_cached_threads) 01737 pthread_cond_signal(&COND_flush_thread_cache); 01738 if (wake_thread) 01739 { 01740 wake_thread--; 01741 thd=thread_cache.get(); 01742 thd->real_id=pthread_self(); 01743 thd->thread_stack= (char*) &thd; // For store_globals 01744 (void) thd->store_globals(); 01745 thd->thr_create_time= time(NULL); 01746 threads.append(thd); 01747 pthread_mutex_unlock(&LOCK_thread_count); 01748 DBUG_VOID_RETURN; 01749 } 01750 } 01751 01752 /* Tell main we are ready */ 01753 (void) pthread_mutex_unlock(&LOCK_thread_count); 01754 /* It's safe to broadcast outside a lock (COND... is not deleted here) */ 01755 DBUG_PRINT("signal", ("Broadcasting COND_thread_count")); 01756 (void) pthread_cond_broadcast(&COND_thread_count); 01757 #ifdef ONE_THREAD 01758 if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux 01759 #endif 01760 { 01761 my_thread_end(); 01762 pthread_exit(0); 01763 } 01764 DBUG_VOID_RETURN; 01765 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sig_handler end_thread_signal | ( | int sig | __attribute__((unused)) | ) |
Definition at line 1706 of file mysqld.cc.
References current_thd, DBUG_ENTER, DBUG_VOID_RETURN, end_thread(), and statistic_increment.
Referenced by init_signals().
01707 { 01708 THD *thd=current_thd; 01709 DBUG_ENTER("end_thread_signal"); 01710 if (thd && ! thd->bootstrap) 01711 { 01712 statistic_increment(killed_threads, &LOCK_status); 01713 end_thread(thd,0); 01714 } 01715 DBUG_VOID_RETURN; /* purecov: deadcode */ 01716 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 7921 of file mysqld.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, my_toupper, mysqld_charset, skip(), strcend(), and st_typelib::type_names.
Referenced by get_one_option(), and mysql_init_variables().
07922 { 07923 bool found_end; 07924 int found_count; 07925 const char *end,*i,*j; 07926 const char **array, *pos; 07927 ulong found,found_int,bit; 07928 DBUG_ENTER("find_bit_type"); 07929 DBUG_PRINT("enter",("x: '%s'",x)); 07930 07931 found=0; 07932 found_end= 0; 07933 pos=(my_string) x; 07934 while (*pos == ' ') pos++; 07935 found_end= *pos == 0; 07936 while (!found_end) 07937 { 07938 if (!*(end=strcend(pos,','))) /* Let end point at fieldend */ 07939 { 07940 while (end > pos && end[-1] == ' ') 07941 end--; /* Skip end-space */ 07942 found_end=1; 07943 } 07944 found_int=0; found_count=0; 07945 for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1) 07946 { 07947 j=pos; 07948 while (j != end) 07949 { 07950 if (my_toupper(mysqld_charset,*i++) != 07951 my_toupper(mysqld_charset,*j++)) 07952 goto skip; 07953 } 07954 found_int=bit; 07955 if (! *i) 07956 { 07957 found_count=1; 07958 break; 07959 } 07960 else if (j != pos) // Half field found 07961 { 07962 found_count++; // Could be one of two values 07963 } 07964 skip: ; 07965 } 07966 if (found_count != 1) 07967 DBUG_RETURN(~(ulong) 0); // No unique value 07968 found|=found_int; 07969 pos=end+1; 07970 } 07971 07972 DBUG_PRINT("exit",("bit-field: %ld",(ulong) found)); 07973 DBUG_RETURN(found); 07974 } /* find_bit_type */
Here is the call graph for this function:

Here is the caller graph for this function:

| static void fix_paths | ( | void | ) | [static] |
Definition at line 7864 of file mysqld.cc.
References CHARSET_DIR, charsets_dir, convert_dirname(), exit, FN_LIBCHAR, FN_REFLEN, get_relative_path(), init_tmpdir(), LIBDIR, MY_FAE, my_load_path(), my_realpath(), my_strdup(), MYF, mysql_tmpdir_list, NullS, opt_plugin_dir, opt_plugin_dir_ptr, SHAREDIR, strend(), strmake(), strxnmov(), and test_if_hard_path().
Referenced by get_options(), and usage().
07865 { 07866 char buff[FN_REFLEN],*pos; 07867 convert_dirname(mysql_home,mysql_home,NullS); 07868 /* Resolve symlinks to allow 'mysql_home' to be a relative symlink */ 07869 my_realpath(mysql_home,mysql_home,MYF(0)); 07870 /* Ensure that mysql_home ends in FN_LIBCHAR */ 07871 pos=strend(mysql_home); 07872 if (pos[-1] != FN_LIBCHAR) 07873 { 07874 pos[0]= FN_LIBCHAR; 07875 pos[1]= 0; 07876 } 07877 convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); 07878 convert_dirname(language,language,NullS); 07879 (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir 07880 (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home); 07881 (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home); 07882 (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : 07883 get_relative_path(LIBDIR), mysql_home); 07884 opt_plugin_dir_ptr= opt_plugin_dir; 07885 07886 char *sharedir=get_relative_path(SHAREDIR); 07887 if (test_if_hard_path(sharedir)) 07888 strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */ 07889 else 07890 strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS); 07891 convert_dirname(buff,buff,NullS); 07892 (void) my_load_path(language,language,buff); 07893 07894 /* If --character-sets-dir isn't given, use shared library dir */ 07895 if (charsets_dir != mysql_charsets_dir) 07896 { 07897 strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff, 07898 CHARSET_DIR, NullS); 07899 } 07900 (void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff); 07901 convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS); 07902 charsets_dir=mysql_charsets_dir; 07903 07904 if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) 07905 exit(1); 07906 #ifdef HAVE_REPLICATION 07907 if (!slave_load_tmpdir) 07908 { 07909 if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE)))) 07910 exit(1); 07911 } 07912 #endif /* HAVE_REPLICATION */ 07913 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void flush_thread_cache | ( | ) |
Definition at line 1768 of file mysqld.cc.
References pthread_mutex_lock, and pthread_mutex_unlock.
Referenced by close_connections().
01769 { 01770 (void) pthread_mutex_lock(&LOCK_thread_count); 01771 kill_cached_threads++; 01772 while (cached_thread_count) 01773 { 01774 pthread_cond_broadcast(&COND_thread_cache); 01775 pthread_cond_wait(&COND_flush_thread_cache,&LOCK_thread_count); 01776 } 01777 kill_cached_threads--; 01778 (void) pthread_mutex_unlock(&LOCK_thread_count); 01779 }
Here is the caller graph for this function:

| bool fn_format_relative_to_data_home | ( | my_string | to, | |
| const char * | name, | |||
| const char * | dir, | |||
| const char * | extension | |||
| ) |
Definition at line 7849 of file mysqld.cc.
References fn_format(), FN_REFLEN, MY_APPEND_EXT, MY_SAFE_PATH, MY_UNPACK_FILENAME, NullS, strxnmov(), and test_if_hard_path().
07851 { 07852 char tmp_path[FN_REFLEN]; 07853 if (!test_if_hard_path(dir)) 07854 { 07855 strxnmov(tmp_path,sizeof(tmp_path)-1, mysql_real_data_home, 07856 dir, NullS); 07857 dir=tmp_path; 07858 } 07859 return !fn_format(to, name, dir, extension, 07860 MY_APPEND_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH); 07861 }
Here is the call graph for this function:

| static my_bool get_one_option | ( | int | optid, | |
| const struct my_option *opt | __attribute__((unused)), | |||
| char * | argument | |||
| ) | [static] |
Definition at line 7104 of file mysqld.cc.
References Rpl_filter::add_db_rewrite(), Rpl_filter::add_do_db(), Rpl_filter::add_do_table(), Rpl_filter::add_ignore_db(), Rpl_filter::add_ignore_table(), Rpl_filter::add_wild_do_table(), Rpl_filter::add_wild_ignore_table(), atoi(), binlog_filter, system_variables::binlog_format, BINLOG_FORMAT_STMT, binlog_format_typelib, charsets_dir, DBUG_SET, DBUG_SET_INITIAL, DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, delay_key_write_typelib, disabled_my_option, exit, find_bit_type(), find_type(), fix_sql_mode(), ft_boolean_check_syntax_string(), ft_boolean_syntax, global_system_variables, HA_OPEN_ABORT_IF_CRASHED, HA_OPEN_DELAY_KEY_WRITE, HA_RECOVER_DEFAULT, HA_RECOVER_NONE, have_innodb, have_ndbcluster, id, INADDR_NONE, ISO_SERIALIZABLE, key, LINT_INIT, log_output_typelib, LOG_TABLE, system_variables::log_warnings, system_variables::low_priority_updates, MI_STATS_METHOD_IGNORE_NULLS, MI_STATS_METHOD_NULLS_EQUAL, MI_STATS_METHOD_NULLS_NOT_EQUAL, MODE_ANSI, my_isspace, my_snprintf(), my_use_symdir, myisam_concurrent_insert, myisam_flush, myisam_recover_options, myisam_recover_typelib, system_variables::myisam_stats_method, myisam_stats_method_typelib, mysqld_charset, ND_KEYHASH, ND_LINHASH, OPT_BDB, OPT_BIG_TABLES, OPT_BIN_LOG, OPT_BIND_ADDRESS, OPT_BINLOG_DO_DB, OPT_BINLOG_FORMAT, OPT_BINLOG_IGNORE_DB, OPT_BOOTSTRAP, OPT_CHARSETS_DIR, OPT_CONCURRENT_INSERT, opt_console, OPT_CONSOLE, OPT_DELAY_KEY_WRITE, OPT_DELAY_KEY_WRITE_ALL, OPT_ERROR_LOG_FILE, Events::opt_event_scheduler, OPT_EVENT_SCHEDULER, opt_external_locking, OPT_FLUSH, OPT_FT_BOOLEAN_SYNTAX, OPT_INIT_RPL_ROLE, OPT_INNODB, OPT_INNODB_DATA_FILE_PATH, OPT_INNODB_LOG_ARCHIVE, OPT_ISAM_LOG, OPT_LOG_OUTPUT, OPT_LOW_PRIORITY_UPDATES, OPT_LOWER_CASE_TABLE_NAMES, OPT_MYISAM_RECOVER, OPT_MYISAM_STATS_METHOD, OPT_NDB_CONNECTSTRING, OPT_NDB_DISTRIBUTION, OPT_NDB_EXTRA_LOGGING, OPT_NDB_MGMD, OPT_NDB_NODEID, OPT_NDBCLUSTER, OPT_ONE_THREAD, OPT_PID_FILE, OPT_REPLICATE_DO_DB, OPT_REPLICATE_DO_TABLE, OPT_REPLICATE_IGNORE_DB, OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_REWRITE_DB, OPT_REPLICATE_WILD_DO_TABLE, OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_SAFE, OPT_SAFEMALLOC_MEM_LIMIT, OPT_SERVER_ID, OPT_SKIP_HOST_CACHE, OPT_SKIP_LOCK, OPT_SKIP_NETWORKING, OPT_SKIP_NEW, OPT_SKIP_PRIOR, OPT_SKIP_RESOLVE, OPT_SKIP_SAFEMALLOC, opt_skip_show_db, OPT_SKIP_SHOW_DB, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SLAVE_SKIP_ERRORS, OPT_SLOW_QUERY_LOG, OPT_SQL_MODE, OPT_STANDALONE, OPT_TC_HEURISTIC_RECOVER, OPT_TX_ISOLATION, Events::opt_typelib, OPT_UPDATE_LOG, OPT_WANT_CORE, OPTION_BIG_TABLES, print_version(), rpl_filter, sf_malloc_mem_limit, sf_malloc_quick, SHOW_OPTION_DISABLED, SHOW_OPTION_YES, SPECIAL_NO_HOST_CACHE, SPECIAL_NO_NEW_FUNC, SPECIAL_NO_PRIOR, SPECIAL_NO_RESOLVE, SPECIAL_SAFE_MODE, SPECIAL_SKIP_SHOW_DB, system_variables::sql_mode, sql_mode_typelib, sql_perror(), sql_print_warning(), strcmp(), strmake(), strstr(), tc_heuristic_recover_typelib, test, TEST_CORE_ON_SIGNAL, TEST_NO_STACKTRACE, TEST_NO_THREADS, thr_upgraded_concurrent_insert_lock, TL_WRITE_LOW_PRIORITY, system_variables::tx_isolation, tx_isolation_typelib, and st_typelib::type_names.
07106 { 07107 switch(optid) { 07108 case '#': 07109 #ifndef DBUG_OFF 07110 DBUG_SET(argument ? argument : default_dbug_option); 07111 DBUG_SET_INITIAL(argument ? argument : default_dbug_option); 07112 #endif 07113 opt_endinfo=1; /* unireg: memory allocation */ 07114 break; 07115 case 'a': 07116 global_system_variables.sql_mode= fix_sql_mode(MODE_ANSI); 07117 global_system_variables.tx_isolation= ISO_SERIALIZABLE; 07118 break; 07119 case 'b': 07120 strmake(mysql_home,argument,sizeof(mysql_home)-1); 07121 break; 07122 case 'C': 07123 if (default_collation_name == compiled_default_collation_name) 07124 default_collation_name= 0; 07125 break; 07126 case 'l': 07127 opt_log=1; 07128 break; 07129 case 'h': 07130 strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1); 07131 /* Correct pointer set by my_getopt (for embedded library) */ 07132 mysql_data_home= mysql_real_data_home; 07133 break; 07134 case 'u': 07135 if (!mysqld_user || !strcmp(mysqld_user, argument)) 07136 mysqld_user= argument; 07137 else 07138 sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user); 07139 break; 07140 case 'L': 07141 strmake(language, argument, sizeof(language)-1); 07142 break; 07143 #ifdef HAVE_REPLICATION 07144 case OPT_SLAVE_SKIP_ERRORS: 07145 init_slave_skip_errors(argument); 07146 break; 07147 #endif 07148 case OPT_SAFEMALLOC_MEM_LIMIT: 07149 #if !defined(DBUG_OFF) && defined(SAFEMALLOC) 07150 sf_malloc_mem_limit = atoi(argument); 07151 #endif 07152 break; 07153 #include <sslopt-case.h> 07154 case 'V': 07155 print_version(); 07156 exit(0); 07157 case 'W': 07158 if (!argument) 07159 global_system_variables.log_warnings++; 07160 else if (argument == disabled_my_option) 07161 global_system_variables.log_warnings= 0L; 07162 else 07163 global_system_variables.log_warnings= atoi(argument); 07164 break; 07165 case 'T': 07166 test_flags= argument ? (uint) atoi(argument) : 0; 07167 test_flags&= ~TEST_NO_THREADS; 07168 opt_endinfo=1; 07169 break; 07170 case (int) OPT_BIG_TABLES: 07171 thd_startup_options|=OPTION_BIG_TABLES; 07172 break; 07173 case (int) OPT_ISAM_LOG: 07174 opt_myisam_log=1; 07175 break; 07176 case (int) OPT_UPDATE_LOG: 07177 opt_update_log=1; 07178 break; 07179 case (int) OPT_BIN_LOG: 07180 opt_bin_log= test(argument != disabled_my_option); 07181 break; 07182 case (int) OPT_ERROR_LOG_FILE: 07183 opt_error_log= 1; 07184 break; 07185 #ifdef HAVE_REPLICATION 07186 case (int) OPT_INIT_RPL_ROLE: 07187 { 07188 int role; 07189 if ((role=find_type(argument, &rpl_role_typelib, 2)) <= 0) 07190 { 07191 fprintf(stderr, "Unknown replication role: %s\n", argument); 07192 exit(1); 07193 } 07194 rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE; 07195 break; 07196 } 07197 case (int)OPT_REPLICATE_IGNORE_DB: 07198 { 07199 rpl_filter->add_ignore_db(argument); 07200 break; 07201 } 07202 case (int)OPT_REPLICATE_DO_DB: 07203 { 07204 rpl_filter->add_do_db(argument); 07205 break; 07206 } 07207 case (int)OPT_REPLICATE_REWRITE_DB: 07208 { 07209 char* key = argument,*p, *val; 07210 07211 if (!(p= strstr(argument, "->"))) 07212 { 07213 fprintf(stderr, 07214 "Bad syntax in replicate-rewrite-db - missing '->'!\n"); 07215 exit(1); 07216 } 07217 val= p--; 07218 while (my_isspace(mysqld_charset, *p) && p > argument) 07219 *p-- = 0; 07220 if (p == argument) 07221 { 07222 fprintf(stderr, 07223 "Bad syntax in replicate-rewrite-db - empty FROM db!\n"); 07224 exit(1); 07225 } 07226 *val= 0; 07227 val+= 2; 07228 while (*val && my_isspace(mysqld_charset, *val)) 07229 *val++; 07230 if (!*val) 07231 { 07232 fprintf(stderr, 07233 "Bad syntax in replicate-rewrite-db - empty TO db!\n"); 07234 exit(1); 07235 } 07236 07237 rpl_filter->add_db_rewrite(key, val); 07238 break; 07239 } 07240 07241 case (int)OPT_BINLOG_IGNORE_DB: 07242 { 07243 binlog_filter->add_ignore_db(argument); 07244 break; 07245 } 07246 case OPT_BINLOG_FORMAT: 07247 { 07248 int id; 07249 if ((id= find_type(argument, &binlog_format_typelib, 2)) <= 0) 07250 { 07251 #ifdef HAVE_ROW_BASED_REPLICATION 07252 fprintf(stderr, 07253 "Unknown binary log format: '%s' " 07254 "(should be one of '%s', '%s', '%s')\n", 07255 argument, 07256 binlog_format_names[BINLOG_FORMAT_STMT], 07257 binlog_format_names[BINLOG_FORMAT_ROW], 07258 binlog_format_names[BINLOG_FORMAT_MIXED]); 07259 #else 07260 fprintf(stderr, 07261 "Unknown binary log format: '%s' (only legal value is '%s')\n", 07262 argument, binlog_format_names[BINLOG_FORMAT_STMT]); 07263 #endif 07264 exit(1); 07265 } 07266 global_system_variables.binlog_format= id-1; 07267 break; 07268 } 07269 case (int)OPT_BINLOG_DO_DB: 07270 { 07271 binlog_filter->add_do_db(argument); 07272 break; 07273 } 07274 case (int)OPT_REPLICATE_DO_TABLE: 07275 { 07276 if (rpl_filter->add_do_table(argument)) 07277 { 07278 fprintf(stderr, "Could not add do table rule '%s'!\n", argument); 07279 exit(1); 07280 } 07281 break; 07282 } 07283 case (int)OPT_REPLICATE_WILD_DO_TABLE: 07284 { 07285 if (rpl_filter->add_wild_do_table(argument)) 07286 { 07287 fprintf(stderr, "Could not add do table rule '%s'!\n", argument); 07288 exit(1); 07289 } 07290 break; 07291 } 07292 case (int)OPT_REPLICATE_WILD_IGNORE_TABLE: 07293 { 07294 if (rpl_filter->add_wild_ignore_table(argument)) 07295 { 07296 fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); 07297 exit(1); 07298 } 07299 break; 07300 } 07301 case (int)OPT_REPLICATE_IGNORE_TABLE: 07302 { 07303 if (rpl_filter->add_ignore_table(argument)) 07304 { 07305 fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument); 07306 exit(1); 07307 } 07308 break; 07309 } 07310 #endif /* HAVE_REPLICATION */ 07311 case (int) OPT_SLOW_QUERY_LOG: 07312 opt_slow_log= 1; 07313 break; 07314 #ifdef WITH_CSV_STORAGE_ENGINE 07315 case OPT_LOG_OUTPUT: 07316 { 07317 if (!argument || !argument[0]) 07318 { 07319 log_output_options= LOG_TABLE; 07320 log_output_str= log_output_typelib.type_names[1]; 07321 } 07322 else 07323 { 07324 log_output_str= argument; 07325 if ((log_output_options= 07326 find_bit_type(argument, &log_output_typelib)) == ~(ulong) 0) 07327 { 07328 fprintf(stderr, "Unknown option to log-output: %s\n", argument); 07329 exit(1); 07330 } 07331 } 07332 break; 07333 } 07334 #endif 07335 case OPT_EVENT_SCHEDULER: 07336 if (!argument) 07337 Events::opt_event_scheduler= 2; 07338 else 07339 { 07340 int type; 07341 if ((type=find_type(argument, &Events::opt_typelib, 1)) <= 0) 07342 { 07343 fprintf(stderr,"Unknown option to event-scheduler: %s\n",argument); 07344 exit(1); 07345 } 07346 /* 07347 type= 1 2 3 4 5 6 07348 (OFF | 0) - (ON | 1) - (2 | SUSPEND) 07349 */ 07350 Events::opt_event_scheduler= (type-1) / 2; 07351 } 07352 break; 07353 case (int) OPT_SKIP_NEW: 07354 opt_specialflag|= SPECIAL_NO_NEW_FUNC; 07355 delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; 07356 myisam_concurrent_insert=0; 07357 myisam_recover_options= HA_RECOVER_NONE; 07358 sp_automatic_privileges=0; 07359 my_use_symdir=0; 07360 ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE); 07361 #ifdef HAVE_QUERY_CACHE 07362 query_cache_size=0; 07363 #endif 07364 break; 07365 case (int) OPT_SAFE: 07366 opt_specialflag|= SPECIAL_SAFE_MODE; 07367 delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; 07368 myisam_recover_options= HA_RECOVER_DEFAULT; 07369 ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE); 07370 break; 07371 case (int) OPT_SKIP_PRIOR: 07372 opt_specialflag|= SPECIAL_NO_PRIOR; 07373 break; 07374 case (int) OPT_SKIP_LOCK: 07375 opt_external_locking=0; 07376 break; 07377 case (int) OPT_SKIP_HOST_CACHE: 07378 opt_specialflag|= SPECIAL_NO_HOST_CACHE; 07379 break; 07380 case (int) OPT_SKIP_RESOLVE: 07381 opt_specialflag|=SPECIAL_NO_RESOLVE; 07382 break; 07383 case (int) OPT_SKIP_NETWORKING: 07384 #if defined(__NETWARE__) 07385 sql_perror("Can't start server: skip-networking option is currently not supported on NetWare"); 07386 exit(1); 07387 #endif 07388 opt_disable_networking=1; 07389 mysqld_port=0; 07390 break; 07391 case (int) OPT_SKIP_SHOW_DB: 07392 opt_skip_show_db=1; 07393 opt_specialflag|=SPECIAL_SKIP_SHOW_DB; 07394 break; 07395 #ifdef ONE_THREAD 07396 case (int) OPT_ONE_THREAD: 07397 test_flags |= TEST_NO_THREADS; 07398 #endif 07399 break; 07400 case (int) OPT_WANT_CORE: 07401 test_flags |= TEST_CORE_ON_SIGNAL; 07402 break; 07403 case (int) OPT_SKIP_STACK_TRACE: 07404 test_flags|=TEST_NO_STACKTRACE; 07405 break; 07406 case (int) OPT_SKIP_SYMLINKS: 07407 my_use_symdir=0; 07408 break; 07409 case (int) OPT_BIND_ADDRESS: 07410 if ((my_bind_addr= (ulong) inet_addr(argument)) == INADDR_NONE) 07411 { 07412 struct hostent *ent; 07413 if (argument[0]) 07414 ent=gethostbyname(argument); 07415 else 07416 { 07417 char myhostname[255]; 07418 if (gethostname(myhostname,sizeof(myhostname)) < 0) 07419 { 07420 sql_perror("Can't start server: cannot get my own hostname!"); 07421 exit(1); 07422 } 07423 ent=gethostbyname(myhostname); 07424 } 07425 if (!ent) 07426 { 07427 sql_perror("Can't start server: cannot resolve hostname!"); 07428 exit(1); 07429 } 07430 my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr; 07431 } 07432 break; 07433 case (int) OPT_PID_FILE: 07434 strmake(pidfile_name, argument, sizeof(pidfile_name)-1); 07435 break; 07436 #ifdef __WIN__ 07437 case (int) OPT_STANDALONE: /* Dummy option for NT */ 07438 break; 07439 #endif 07440 case OPT_CONSOLE: 07441 if (opt_console) 07442 opt_error_log= 0; // Force logs to stdout 07443 break; 07444 case (int) OPT_FLUSH: 07445 myisam_flush=1; 07446 flush_time=0; // No auto flush 07447 break; 07448 case OPT_LOW_PRIORITY_UPDATES: 07449 thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; 07450 global_system_variables.low_priority_updates=1; 07451 break; 07452 case OPT_BOOTSTRAP: 07453 opt_noacl=opt_bootstrap=1; 07454 break; 07455 case OPT_SERVER_ID: 07456 server_id_supplied = 1; 07457 break; 07458 case OPT_DELAY_KEY_WRITE_ALL: 07459 if (argument != disabled_my_option) 07460 argument= (char*) "ALL"; 07461 /* Fall through */ 07462 case OPT_DELAY_KEY_WRITE: 07463 if (argument == disabled_my_option) 07464 delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE; 07465 else if (! argument) 07466 delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; 07467 else 07468 { 07469 int type; 07470 if ((type=find_type(argument, &delay_key_write_typelib, 2)) <= 0) 07471 { 07472 fprintf(stderr,"Unknown delay_key_write type: %s\n",argument); 07473 exit(1); 07474 } 07475 delay_key_write_options= (uint) type-1; 07476 } 07477 break; 07478 case OPT_CHARSETS_DIR: 07479 strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1); 07480 charsets_dir = mysql_charsets_dir; 07481 break; 07482 case OPT_TX_ISOLATION: 07483 { 07484 int type; 07485 if ((type=find_type(argument, &tx_isolation_typelib, 2)) <= 0) 07486 { 07487 fprintf(stderr,"Unknown transaction isolation type: %s\n",argument); 07488 exit(1); 07489 } 07490 global_system_variables.tx_isolation= (type-1); 07491 break; 07492 } 07493 case OPT_MERGE: 07494 if (opt_merge) 07495 have_merge_db= SHOW_OPTION_YES; 07496 else 07497 have_merge_db= SHOW_OPTION_DISABLED; 07498 case OPT_BDB: 07499 break; 07500 case OPT_NDBCLUSTER: 07501 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE 07502 if (opt_ndbcluster) 07503 have_ndbcluster= SHOW_OPTION_YES; 07504 else 07505 have_ndbcluster= SHOW_OPTION_DISABLED; 07506 #endif 07507 break; 07508 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE 07509 case OPT_NDB_MGMD: 07510 case OPT_NDB_NODEID: 07511 { 07512 int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, 07513 sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, 07514 "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"", 07515 optid == OPT_NDB_NODEID ? "nodeid=" : "", 07516 argument); 07517 opt_ndb_constrbuf_len+= len; 07518 } 07519 /* fall through to add the connectstring to the end 07520 * and set opt_ndbcluster_connectstring 07521 */ 07522 case OPT_NDB_CONNECTSTRING: 07523 if (opt_ndb_connectstring && opt_ndb_connectstring[0]) 07524 my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, 07525 sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, 07526 "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"", 07527 opt_ndb_connectstring); 07528 else 07529 opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0; 07530 opt_ndbcluster_connectstring= opt_ndb_constrbuf; 07531 break; 07532 case OPT_NDB_DISTRIBUTION: 07533 int id; 07534 if ((id= find_type(argument, &ndb_distribution_typelib, 2)) <= 0) 07535 { 07536 fprintf(stderr, 07537 "Unknown ndb distribution type: '%s' " 07538 "(should be '%s' or '%s')\n", 07539 argument, 07540 ndb_distribution_names[ND_KEYHASH], 07541 ndb_distribution_names[ND_LINHASH]); 07542 exit(1); 07543 } 07544 opt_ndb_distribution_id= (enum ndb_distribution)(id-1); 07545 break; 07546 case OPT_NDB_EXTRA_LOGGING: 07547 if (!argument) 07548 ndb_extra_logging++; 07549 else if (argument == disabled_my_option) 07550 ndb_extra_logging= 0L; 07551 else 07552 ndb_extra_logging= atoi(argument); 07553 break; 07554 #endif 07555 case OPT_INNODB: 07556 #ifdef WITH_INNOBASE_STORAGE_ENGINE 07557 if (opt_innodb) 07558 have_innodb= SHOW_OPTION_YES; 07559 else 07560 have_innodb= SHOW_OPTION_DISABLED; 07561 #endif 07562 break; 07563 case OPT_INNODB_DATA_FILE_PATH: 07564 #ifdef WITH_INNOBASE_STORAGE_ENGINE 07565 innobase_data_file_path= argument; 07566 #endif 07567 break; 07568 #ifdef WITH_INNOBASE_STORAGE_ENGINE 07569 case OPT_INNODB_LOG_ARCHIVE: 07570 innobase_log_archive= argument ? test(atoi(argument)) : 1; 07571 break; 07572 #endif /* WITH_INNOBASE_STORAGE_ENGINE */ 07573 case OPT_MYISAM_RECOVER: 07574 { 07575 if (!argument || !argument[0]) 07576 { 07577 myisam_recover_options= HA_RECOVER_DEFAULT; 07578 myisam_recover_options_str= myisam_recover_typelib.type_names[0]; 07579 } 07580 else 07581 { 07582 myisam_recover_options_str=argument; 07583 if ((myisam_recover_options= 07584 find_bit_type(argument, &myisam_recover_typelib)) == ~(ulong) 0) 07585 { 07586 fprintf(stderr, "Unknown option to myisam-recover: %s\n",argument); 07587 exit(1); 07588 } 07589 } 07590 ha_open_options|=HA_OPEN_ABORT_IF_CRASHED; 07591 break; 07592 } 07593 case OPT_CONCURRENT_INSERT: 07594 /* The following code is mainly here to emulate old behavior */ 07595 if (!argument) /* --concurrent-insert */ 07596 myisam_concurrent_insert= 1; 07597 else if (argument == disabled_my_option) 07598 myisam_concurrent_insert= 0; /* --skip-concurrent-insert */ 07599 break; 07600 case OPT_TC_HEURISTIC_RECOVER: 07601 { 07602 if ((tc_heuristic_recover=find_type(argument, 07603 &tc_heuristic_recover_typelib, 2)) <=0) 07604 { 07605 fprintf(stderr, "Unknown option to tc-heuristic-recover: %s\n",argument); 07606 exit(1); 07607 } 07608 } 07609 case OPT_MYISAM_STATS_METHOD: 07610 { 07611 ulong method_conv; 07612 int method; 07613 LINT_INIT(method_conv); 07614 07615 myisam_stats_method_str= argument; 07616 if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0) 07617 { 07618 fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument); 07619 exit(1); 07620 } 07621 switch (method-1) { 07622 case 0: 07623 method_conv= MI_STATS_METHOD_NULLS_EQUAL; 07624 break; 07625 case 1: 07626 method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL; 07627 break; 07628 case 2: 07629 method_conv= MI_STATS_METHOD_IGNORE_NULLS; 07630 break; 07631 } 07632 global_system_variables.myisam_stats_method= method_conv; 07633 break; 07634 } 07635 case OPT_SQL_MODE: 07636 { 07637 sql_mode_str= argument; 07638 if ((global_system_variables.sql_mode= 07639 find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0) 07640 { 07641 fprintf(stderr, "Unknown option to sql-mode: %s\n", argument); 07642 exit(1); 07643 } 07644 global_system_variables.sql_mode= fix_sql_mode(global_system_variables. 07645 sql_mode); 07646 break; 07647 } 07648 case OPT_FT_BOOLEAN_SYNTAX: 07649 if (ft_boolean_check_syntax_string((byte*) argument)) 07650 { 07651 fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument); 07652 exit(1); 07653 } 07654 strmake(ft_boolean_syntax, argument, sizeof(ft_boolean_syntax)-1); 07655 break; 07656 case OPT_SKIP_SAFEMALLOC: 07657 #ifdef SAFEMALLOC 07658 sf_malloc_quick=1; 07659 #endif 07660 break; 07661 case OPT_LOWER_CASE_TABLE_NAMES: 07662 lower_case_table_names= argument ? atoi(argument) : 1; 07663 lower_case_table_names_used= 1; 07664 break; 07665 } 07666 return 0; 07667 }
Here is the call graph for this function:

| static void get_options | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 7708 of file mysqld.cc.
References system_variables::date_format, system_variables::datetime_format, def_ft_boolean_syntax, exit, fix_delay_key_write(), fix_paths(), ft_boolean_syntax, get_one_option(), global_system_variables, handle_options(), init_global_datetime_format(), system_variables::max_allowed_packet, max_allowed_packet, my_bit_log2(), my_default_record_cache_size, my_disable_locking, my_disable_symlinks, my_getopt_error_reporter, my_getopt_register_get_addr(), my_long_options, my_progname, my_use_symdir, myisam_block_size, system_variables::myisam_max_sort_file_size, myisam_max_temp_length, myisam_single_user, mysql_getopt_value(), MYSQL_TIMESTAMP_DATE, MYSQL_TIMESTAMP_DATETIME, MYSQL_TIMESTAMP_TIME, system_variables::net_buffer_length, net_buffer_length, opt_external_locking, OPT_GLOBAL, option_error_reporter(), system_variables::read_buff_size, set_root(), SHOW_OPTION_DISABLED, SHOW_OPTION_NO, SPECIAL_LOG_QUERIES_NOT_USING_INDEXES, SPECIAL_SHORT_LOG_FORMAT, sql_print_warning(), strmake(), test, TEST_CORE_ON_SIGNAL, TEST_NO_STACKTRACE, TEST_SIGINT, system_variables::time_format, and usage().
07709 { 07710 int ho_error; 07711 07712 my_getopt_register_get_addr(mysql_getopt_value); 07713 strmake(def_ft_boolean_syntax, ft_boolean_syntax, 07714 sizeof(ft_boolean_syntax)-1); 07715 my_getopt_error_reporter= option_error_reporter; 07716 if ((ho_error= handle_options(&argc, &argv, my_long_options, 07717 get_one_option))) 07718 exit(ho_error); 07719 07720 #ifndef WITH_NDBCLUSTER_STORAGE_ENGINE 07721 if (opt_ndbcluster) 07722 sql_print_warning("this binary does not contain NDBCLUSTER storage engine"); 07723 #endif 07724 #ifndef WITH_INNOBASE_STORAGE_ENGINE 07725 if (opt_innodb) 07726 sql_print_warning("this binary does not contain INNODB storage engine"); 07727 #endif 07728 #ifndef WITH_ISAM_STORAGE_ENGINE 07729 if (opt_isam) 07730 sql_print_warning("this binary does not contain ISAM storage engine"); 07731 #endif 07732 if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) && 07733 !opt_slow_log) 07734 sql_print_warning("options --log-slow-admin-statements and --log-queries-not-using-indexes have no effect if --log-slow-queries is not set"); 07735 07736 if (argc > 0) 07737 { 07738 fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv); 07739 /* FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code? */ 07740 exit(1); 07741 } 07742 07743 if (opt_help) 07744 { 07745 usage(); 07746 exit(0); 07747 } 07748 #if defined(HAVE_BROKEN_REALPATH) 07749 my_use_symdir=0; 07750 my_disable_symlinks=1; 07751 have_symlink=SHOW_OPTION_NO; 07752 #else 07753 if (!my_use_symdir) 07754 { 07755 my_disable_symlinks=1; 07756 have_symlink=SHOW_OPTION_DISABLED; 07757 } 07758 #endif 07759 if (opt_debugging) 07760 { 07761 /* Allow break with SIGINT, no core or stack trace */ 07762 test_flags|= TEST_SIGINT | TEST_NO_STACKTRACE; 07763 test_flags&= ~TEST_CORE_ON_SIGNAL; 07764 } 07765 /* Set global MyISAM variables from delay_key_write_options */ 07766 fix_delay_key_write((THD*) 0, OPT_GLOBAL); 07767 07768 #ifndef EMBEDDED_LIBRARY 07769 if (mysqld_chroot) 07770 set_root(mysqld_chroot); 07771 #else 07772 max_allowed_packet= global_system_variables.max_allowed_packet; 07773 net_buffer_length= global_system_variables.net_buffer_length; 07774 #endif 07775 fix_paths(); 07776 07777 /* 07778 Set some global variables from the global_system_variables 07779 In most cases the global variables will not be used 07780 */ 07781 my_disable_locking= myisam_single_user= test(opt_external_locking == 0); 07782 my_default_record_cache_size=global_system_variables.read_buff_size; 07783 myisam_max_temp_length= 07784 (my_off_t) global_system_variables.myisam_max_sort_file_size; 07785 07786 /* Set global variables based on startup options */ 07787 myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); 07788 07789 if (opt_short_log_format) 07790 opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; 07791 if (opt_log_queries_not_using_indexes) 07792 opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES; 07793 07794 if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, 07795 &global_system_variables.date_format) || 07796 init_global_datetime_format(MYSQL_TIMESTAMP_TIME, 07797 &global_system_variables.time_format) || 07798 init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME, 07799 &global_system_variables.datetime_format)) 07800 exit(1); 07801 07802 }
Here is the call graph for this function:

| static char * get_relative_path | ( | const char * | path | ) | [static] |
Definition at line 7828 of file mysqld.cc.
References DEFAULT_MYSQL_HOME, FN_LIBCHAR, FN_ROOTDIR, is_prefix(), strcmp(), strlen(), and test_if_hard_path().
Referenced by fix_paths(), and mysql_init_variables().
07829 { 07830 if (test_if_hard_path(path) && 07831 is_prefix(path,DEFAULT_MYSQL_HOME) && 07832 strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)) 07833 { 07834 path+=(uint) strlen(DEFAULT_MYSQL_HOME); 07835 while (*path == FN_LIBCHAR) 07836 path++; 07837 } 07838 return (char*) path; 07839 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pthread_handler_t handle_connections_sockets | ( | void *arg | __attribute__((unused)) | ) |
Definition at line 4107 of file mysqld.cc.
References closesocket, create_new_thread(), DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, decrement_handler_count, flags, global_system_variables, INVALID_SOCKET, kill_server(), LINT_INIT, max, MAX_ACCEPT_RETRY, MAYBE_BROKEN_SYSCALL, my_net_init(), my_pthread_getprio(), my_reinterpret_cast, my_socket, system_variables::net_wait_timeout, sleep, sock, SOCKET_EAGAIN, SOCKET_EINTR, SOCKET_EMFILE, SOCKET_ENFILE, socket_errno, sql_perror(), sql_print_error(), TEST_BLOCKING, vio_delete, VIO_LOCALHOST, vio_new(), VIO_TYPE_SOCKET, VIO_TYPE_TCPIP, and VOID.
04108 { 04109 my_socket sock,new_sock; 04110 uint error_count=0; 04111 uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); 04112 fd_set readFDs,clientFDs; 04113 THD *thd; 04114 struct sockaddr_in cAddr; 04115 int ip_flags=0,socket_flags=0,flags; 04116 st_vio *vio_tmp; 04117 DBUG_ENTER("handle_connections_sockets"); 04118 04119 LINT_INIT(new_sock); 04120 04121 (void) my_pthread_getprio(pthread_self()); // For debugging 04122 04123 FD_ZERO(&clientFDs); 04124 if (ip_sock != INVALID_SOCKET) 04125 { 04126 FD_SET(ip_sock,&clientFDs); 04127 #ifdef HAVE_FCNTL 04128 ip_flags = fcntl(ip_sock, F_GETFL, 0); 04129 #endif 04130 } 04131 #ifdef HAVE_SYS_UN_H 04132 FD_SET(unix_sock,&clientFDs); 04133 #ifdef HAVE_FCNTL 04134 socket_flags=fcntl(unix_sock, F_GETFL, 0); 04135 #endif 04136 #endif 04137 04138 DBUG_PRINT("general",("Waiting for connections.")); 04139 MAYBE_BROKEN_SYSCALL; 04140 while (!abort_loop) 04141 { 04142 readFDs=clientFDs; 04143 #ifdef HPUX10 04144 if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0) 04145 continue; 04146 #else 04147 if (select((int) max_used_connection,&readFDs,0,0,0) < 0) 04148 { 04149 if (socket_errno != SOCKET_EINTR) 04150 { 04151 if (!select_errors++ && !abort_loop) /* purecov: inspected */ 04152 sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */ 04153 } 04154 MAYBE_BROKEN_SYSCALL 04155 continue; 04156 } 04157 #endif /* HPUX10 */ 04158 if (abort_loop) 04159 { 04160 MAYBE_BROKEN_SYSCALL; 04161 break; 04162 } 04163 04164 /* Is this a new connection request ? */ 04165 #ifdef HAVE_SYS_UN_H 04166 if (FD_ISSET(unix_sock,&readFDs)) 04167 { 04168 sock = unix_sock; 04169 flags= socket_flags; 04170 } 04171 else 04172 #endif 04173 { 04174 sock = ip_sock; 04175 flags= ip_flags; 04176 } 04177 04178 #if !defined(NO_FCNTL_NONBLOCK) 04179 if (!(test_flags & TEST_BLOCKING)) 04180 { 04181 #if defined(O_NONBLOCK) 04182 fcntl(sock, F_SETFL, flags | O_NONBLOCK); 04183 #elif defined(O_NDELAY) 04184 fcntl(sock, F_SETFL, flags | O_NDELAY); 04185 #endif 04186 } 04187 #endif /* NO_FCNTL_NONBLOCK */ 04188 for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++) 04189 { 04190 size_socket length=sizeof(struct sockaddr_in); 04191 new_sock = accept(sock, my_reinterpret_cast(struct sockaddr *) (&cAddr), 04192 &length); 04193 #ifdef __NETWARE__ 04194 // TODO: temporary fix, waiting for TCP/IP fix - DEFECT000303149 04195 if ((new_sock == INVALID_SOCKET) && (socket_errno == EINVAL)) 04196 { 04197 kill_server(SIGTERM); 04198 } 04199 #endif 04200 if (new_sock != INVALID_SOCKET || 04201 (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)) 04202 break; 04203 MAYBE_BROKEN_SYSCALL; 04204 #if !defined(NO_FCNTL_NONBLOCK) 04205 if (!(test_flags & TEST_BLOCKING)) 04206 { 04207 if (retry == MAX_ACCEPT_RETRY - 1) 04208 fcntl(sock, F_SETFL, flags); // Try without O_NONBLOCK 04209 } 04210 #endif 04211 } 04212 #if !defined(NO_FCNTL_NONBLOCK) 04213 if (!(test_flags & TEST_BLOCKING)) 04214 fcntl(sock, F_SETFL, flags); 04215 #endif 04216 if (new_sock == INVALID_SOCKET) 04217 { 04218 if ((error_count++ & 255) == 0) // This can happen often 04219 sql_perror("Error in accept"); 04220 MAYBE_BROKEN_SYSCALL; 04221 if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE) 04222 sleep(1); // Give other threads some time 04223 continue; 04224 } 04225 04226 #ifdef HAVE_LIBWRAP 04227 { 04228 if (sock == ip_sock) 04229 { 04230 struct request_info req; 04231 signal(SIGCHLD, SIG_DFL); 04232 request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL); 04233 my_fromhost(&req); 04234 if (!my_hosts_access(&req)) 04235 { 04236 /* 04237 This may be stupid but refuse() includes an exit(0) 04238 which we surely don't want... 04239 clean_exit() - same stupid thing ... 04240 */ 04241 syslog(deny_severity, "refused connect from %s", 04242 my_eval_client(&req)); 04243 04244 /* 04245 C++ sucks (the gibberish in front just translates the supplied 04246 sink function pointer in the req structure from a void (*sink)(); 04247 to a void(*sink)(int) if you omit the cast, the C++ compiler 04248 will cry... 04249 */ 04250 if (req.sink) 04251 ((void (*)(int))req.sink)(req.fd); 04252 04253 (void) shutdown(new_sock,2); 04254 (void) closesocket(new_sock); 04255 continue; 04256 } 04257 } 04258 } 04259 #endif /* HAVE_LIBWRAP */ 04260 04261 { 04262 size_socket dummyLen; 04263 struct sockaddr dummy; 04264 dummyLen = sizeof(struct sockaddr); 04265 if (getsockname(new_sock,&dummy, &dummyLen) < 0) 04266 { 04267 sql_perror("Error on new connection socket"); 04268 (void) shutdown(new_sock,2); 04269 (void) closesocket(new_sock); 04270 continue; 04271 } 04272 } 04273 04274 /* 04275 ** Don't allow too many connections 04276 */ 04277 04278 if (!(thd= new THD)) 04279 { 04280 (void) shutdown(new_sock,2); 04281 VOID(closesocket(new_sock)); 04282 continue; 04283 } 04284 if (!(vio_tmp=vio_new(new_sock, 04285 sock == unix_sock ? VIO_TYPE_SOCKET : 04286 VIO_TYPE_TCPIP, 04287 sock == unix_sock ? VIO_LOCALHOST: 0)) || 04288 my_net_init(&thd->net,vio_tmp)) 04289 { 04290 if (vio_tmp) 04291 vio_delete(vio_tmp); 04292 else 04293 { 04294 (void) shutdown(new_sock,2); 04295 (void) closesocket(new_sock); 04296 } 04297 delete thd; 04298 continue; 04299 } 04300 if (sock == unix_sock) 04301 thd->security_ctx->host=(char*) my_localhost; 04302 #ifdef __WIN__ 04303 /* Set default wait_timeout */ 04304 ulong wait_timeout= global_system_variables.net_wait_timeout * 1000; 04305 (void) setsockopt(new_sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&wait_timeout, 04306 sizeof(wait_timeout)); 04307 #endif 04308 create_new_thread(thd); 04309 } 04310 04311 decrement_handler_count(); 04312 DBUG_RETURN(0); 04313 }
Here is the call graph for this function:

| pthread_handler_t handle_connections_sockets | ( | void * | arg | ) |
| sig_handler handle_segfault | ( | int | sig | ) |
Definition at line 2071 of file mysqld.cc.
References current_thd, dflt_key_cache, exit, global_system_variables, st_key_cache::key_cache_mem_size, print_stacktrace, system_variables::read_buff_size, safe_print_str, system_variables::sortbuff_size, TEST_CORE_ON_SIGNAL, TEST_NO_STACKTRACE, and write_core().
Referenced by init_signals().
02072 { 02073 THD *thd=current_thd; 02074 /* 02075 Strictly speaking, one needs a mutex here 02076 but since we have got SIGSEGV already, things are a mess 02077 so not having the mutex is not as bad as possibly using a buggy 02078 mutex - so we keep things simple 02079 */ 02080 if (segfaulted) 02081 { 02082 fprintf(stderr, "Fatal signal %d while backtracing\n", sig); 02083 exit(1); 02084 } 02085 02086 segfaulted = 1; 02087 fprintf(stderr,"\ 02088 mysqld got signal %d;\n\ 02089 This could be because you hit a bug. It is also possible that this binary\n\ 02090 or one of the libraries it was linked against is corrupt, improperly built,\n\ 02091 or misconfigured. This error can also be caused by malfunctioning hardware.\n", 02092 sig); 02093 fprintf(stderr, "\ 02094 We will try our best to scrape up some info that will hopefully help diagnose\n\ 02095 the problem, but since we have already crashed, something is definitely wrong\n\ 02096 and this may fail.\n\n"); 02097 fprintf(stderr, "key_buffer_size=%lu\n", 02098 (ulong) dflt_key_cache->key_cache_mem_size); 02099 fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size); 02100 fprintf(stderr, "max_used_connections=%lu\n", max_used_connections); 02101 fprintf(stderr, "max_connections=%lu\n", max_connections); 02102 fprintf(stderr, "threads_connected=%u\n", thread_count); 02103 fprintf(stderr, "It is possible that mysqld could use up to \n\ 02104 key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %lu K\n\ 02105 bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size + 02106 (global_system_variables.read_buff_size + 02107 global_system_variables.sortbuff_size) * 02108 max_connections)/ 1024); 02109 fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n"); 02110 02111 #if defined(HAVE_LINUXTHREADS) 02112 if (sizeof(char*) == 4 && thread_count > UNSAFE_DEFAULT_LINUX_THREADS) 02113 { 02114 fprintf(stderr, "\ 02115 You seem to be running 32-bit Linux and have %d concurrent connections.\n\ 02116 If you have not changed STACK_SIZE in LinuxThreads and built the binary \n\ 02117 yourself, LinuxThreads is quite likely to steal a part of the global heap for\n\ 02118 the thread stack. Please read http://www.mysql.com/doc/en/Linux.html\n\n", 02119 thread_count); 02120 } 02121 #endif /* HAVE_LINUXTHREADS */ 02122 02123 #ifdef HAVE_STACKTRACE 02124 if (!(test_flags & TEST_NO_STACKTRACE)) 02125 { 02126 fprintf(stderr,"thd=%p\n",thd); 02127 print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr) 0, 02128 thread_stack); 02129 } 02130 if (thd) 02131 { 02132 fprintf(stderr, "Trying to get some variables.\n\ 02133 Some pointers may be invalid and cause the dump to abort...\n"); 02134 safe_print_str("thd->query", thd->query, 1024); 02135 fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id); 02136 } 02137 fprintf(stderr, "\ 02138 The manual page at http://www.mysql.com/doc/en/Crashing.html contains\n\ 02139 information that should help you find out what is causing the crash.\n"); 02140 fflush(stderr); 02141 #endif /* HAVE_STACKTRACE */ 02142 02143 #ifdef HAVE_INITGROUPS 02144 if (calling_initgroups) 02145 fprintf(stderr, "\n\ 02146 This crash occured while the server was calling initgroups(). This is\n\ 02147 often due to the use of a mysqld that is statically linked against glibc\n\ 02148 and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\ 02149 upgrade to a version of glibc that does not have this problem (2.3.4 or\n\ 02150 later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ 02151 mysqld that is not statically linked.\n"); 02152 #endif 02153 02154 if (test_flags & TEST_CORE_ON_SIGNAL) 02155 { 02156 fprintf(stderr, "Writing a core file\n"); 02157 fflush(stderr); 02158 write_core(sig); 02159 } 02160 exit(1); 02161 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pthread_handler_t handle_slave | ( | void * | arg | ) |
| static int init_common_variables | ( | const char * | conf_file_name, | |
| int | argc, | |||
| char ** | argv, | |||
| const char ** | groups | |||
| ) | [static] |
Definition at line 2594 of file mysqld.cc.
References add_status_vars(), bitmap_init(), system_variables::character_set_client, system_variables::character_set_filesystem, character_set_filesystem, system_variables::character_set_results, system_variables::collation_connection, system_variables::collation_database, system_variables::collation_server, charset_info_st::csname, DBUG_PRINT, decimal_zero, default_charset_info, ER, ER_COLLATION_CHARSET_MISMATCH, ER_UNKNOWN_COLLATION, files, files_charset_info, fn_ext(), FN_REFLEN, get_charset_by_csname(), get_charset_by_name(), get_options(), global_system_variables, init_client_errs(), init_errmessage(), MYSQL_BIN_LOG::init_pthread_objects(), init_thread_environment(), item_init(), lex_init(), load_defaults(), localtime_r(), LOG_FILE, LOG_NONE, system_variables::log_warnings, MACHINE_TYPE, make_default_log_name(), max, max_system_variables, min, my_charset_bin, my_charset_latin1, my_charset_same(), MY_CS_PRIMARY, my_database_names_init(), my_decimal_set_zero(), my_get_large_page_size, my_progname, my_regex_init(), my_set_max_open_files(), my_strdup(), my_tz_SYSTEM, my_umask, MY_WME, MYF, mysql_bin_log, mysql_init_variables(), mysys_uses_curses, system_variables::pseudo_thread_id, set_if_bigger, set_server_version(), set_var_init(), sql_print_error(), sql_print_warning(), status_vars, strlen(), strmake(), strmov(), sys_init_connect, sys_init_slave, sys_var_general_log_path, sys_var_slow_log_path, SYSTEM_TYPE, table_alias_charset, temp_pool, test_if_case_insensitive(), system_variables::time_zone, unireg_init(), sys_var_str::value, and sys_var_str::value_length.
Referenced by main().
02596 { 02597 char buff[FN_REFLEN]; 02598 umask(((~my_umask) & 0666)); 02599 my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; 02600 tzset(); // Set tzname 02601 02602 max_system_variables.pseudo_thread_id= (ulong)~0; 02603 start_time=time((time_t*) 0); 02604 if (init_thread_environment()) 02605 return 1; 02606 mysql_init_variables(); 02607 02608 #ifdef HAVE_TZNAME 02609 { 02610 struct tm tm_tmp; 02611 localtime_r(&start_time,&tm_tmp); 02612 strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0], 02613 sizeof(system_time_zone)-1); 02614 02615 } 02616 #endif 02617 /* 02618 We set SYSTEM time zone as reasonable default and 02619 also for failure of my_tz_init() and bootstrap mode. 02620 If user explicitly set time zone with --default-time-zone 02621 option we will change this value in my_tz_init(). 02622 */ 02623 global_system_variables.time_zone= my_tz_SYSTEM; 02624 02625 /* 02626 Init mutexes for the global MYSQL_BIN_LOG objects. 02627 As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of 02628 global MYSQL_BIN_LOGs in their constructors, because then they would be 02629 inited before MY_INIT(). So we do it here. 02630 */ 02631 mysql_bin_log.init_pthread_objects(); 02632 02633 if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) 02634 strmov(glob_hostname,"mysql"); 02635 strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); 02636 strmov(fn_ext(pidfile_name),".pid"); // Add proper extension 02637 02638 /* 02639 Add server status variables to the dynamic list of 02640 status variables that is shown by SHOW STATUS. 02641 Later, in plugin_init, plugin_load, and mysql_install_plugin 02642 new entries could be added to that list. 02643 */ 02644 if (add_status_vars(status_vars)) 02645 return 1; // an error was already reported 02646 02647 load_defaults(conf_file_name, groups, &argc, &argv); 02648 defaults_argv=argv; 02649 get_options(argc,argv); 02650 set_server_version(); 02651 02652 DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, 02653 server_version, SYSTEM_TYPE,MACHINE_TYPE)); 02654 02655 #ifdef HAVE_LARGE_PAGES 02656 /* Initialize large page size */ 02657 if (opt_large_pages && (opt_large_page_size= my_get_large_page_size())) 02658 { 02659 my_use_large_pages= 1; 02660 my_large_page_size= opt_large_page_size; 02661 #ifdef WITH_INNOBASE_STORAGE_ENGINE 02662 innobase_use_large_pages= 1; 02663 innobase_large_page_size= opt_large_page_size; 02664 #endif 02665 } 02666 #endif /* HAVE_LARGE_PAGES */ 02667 02668 /* connections and databases needs lots of files */ 02669 { 02670 uint files, wanted_files; 02671 02672 wanted_files= 10+(uint) max(max_connections*5, 02673 max_connections+table_cache_size*2); 02674 set_if_bigger(wanted_files, open_files_limit); 02675 files= my_set_max_open_files(wanted_files); 02676 02677 if (files < wanted_files) 02678 { 02679 if (!open_files_limit) 02680 { 02681 max_connections= (ulong) min((files-10),max_connections); 02682 table_cache_size= (ulong) max((files-10-max_connections)/2,64); 02683 DBUG_PRINT("warning", 02684 ("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld", 02685 files, max_connections, table_cache_size)); 02686 if (global_system_variables.log_warnings) 02687 sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld", 02688 files, max_connections, table_cache_size); 02689 } 02690 else if (global_system_variables.log_warnings) 02691 sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); 02692 } 02693 open_files_limit= files; 02694 } 02695 unireg_init(opt_specialflag); /* Set up extern variabels */ 02696 if (init_errmessage()) /* Read error messages from file */ 02697 return 1; 02698 init_client_errs(); 02699 lex_init(); 02700 item_init(); 02701 set_var_init(); 02702 mysys_uses_curses=0; 02703 #ifdef USE_REGEX 02704 my_regex_init(&my_charset_latin1); 02705 #endif 02706 if (!(default_charset_info= get_charset_by_csname(default_character_set_name, 02707 MY_CS_PRIMARY, 02708 MYF(MY_WME)))) 02709 return 1; 02710 if (default_collation_name) 02711 { 02712 CHARSET_INFO *default_collation; 02713 default_collation= get_charset_by_name(default_collation_name, MYF(0)); 02714 if (!default_collation) 02715 { 02716 sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name); 02717 return 1; 02718 } 02719 if (!my_charset_same(default_charset_info, default_collation)) 02720 { 02721 sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH), 02722 default_collation_name, 02723 default_charset_info->csname); 02724 return 1; 02725 } 02726 default_charset_info= default_collation; 02727 } 02728 /* Set collactions that depends on the default collation */ 02729 global_system_variables.collation_server= default_charset_info; 02730 global_system_variables.collation_database= default_charset_info; 02731 global_system_variables.collation_connection= default_charset_info; 02732 global_system_variables.character_set_results= default_charset_info; 02733 global_system_variables.character_set_client= default_charset_info; 02734 global_system_variables.collation_connection= default_charset_info; 02735 02736 if (!(character_set_filesystem= 02737 get_charset_by_csname(character_set_filesystem_name, 02738 MY_CS_PRIMARY, MYF(MY_WME)))) 02739 return 1; 02740 global_system_variables.character_set_filesystem= character_set_filesystem; 02741 02742 sys_init_connect.value_length= 0; 02743 if ((sys_init_connect.value= opt_init_connect)) 02744 sys_init_connect.value_length= strlen(opt_init_connect); 02745 else 02746 sys_init_connect.value=my_strdup("",MYF(0)); 02747 02748 sys_init_slave.value_length= 0; 02749 if ((sys_init_slave.value= opt_init_slave)) 02750 sys_init_slave.value_length= strlen(opt_init_slave); 02751 else 02752 sys_init_slave.value=my_strdup("",MYF(0)); 02753 02754 /* check log options and issue warnings if needed */ 02755 if (opt_log && opt_logname && !(log_output_options & LOG_FILE) && 02756 !(log_output_options & LOG_NONE)) 02757 sql_print_warning("Although a path was specified for the " 02758 "--log option, log tables are used. " 02759 "To enable logging to file use the --log-output option."); 02760 02761 if (opt_slow_log && opt_slow_logname && !(log_output_options & LOG_FILE) 02762 && !(log_output_options & LOG_NONE)) 02763 sql_print_warning("Although a path was specified for the " 02764 "--log-slow-queries option, log tables are used. " 02765 "To enable logging to file use the --log-output option."); 02766 02767 if (!opt_logname) 02768 opt_logname= make_default_log_name(buff, ".log"); 02769 sys_var_general_log_path.value= my_strdup(opt_logname, MYF(0)); 02770 sys_var_general_log_path.value_length= strlen(opt_logname); 02771 02772 if (!opt_slow_logname) 02773 opt_slow_logname= make_default_log_name(buff, "-slow.log"); 02774 sys_var_slow_log_path.value= my_strdup(opt_slow_logname, MYF(0)); 02775 sys_var_slow_log_path.value_length= strlen(opt_slow_logname); 02776 02777 if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) 02778 return 1; 02779 if (my_database_names_init()) 02780 return 1; 02781 02782 /* 02783 Ensure that lower_case_table_names is set on system where we have case 02784 insensitive names. If this is not done the users MyISAM tables will 02785 get corrupted if accesses with names of different case. 02786 */ 02787 DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names)); 02788 lower_case_file_system= test_if_case_insensitive(mysql_real_data_home); 02789 if (!lower_case_table_names && lower_case_file_system == 1) 02790 { 02791 if (lower_case_table_names_used) 02792 { 02793 if (global_system_variables.log_warnings) 02794 sql_print_warning("\ 02795 You have forced lower_case_table_names to 0 through a command-line \ 02796 option, even though your file system '%s' is case insensitive. This means \ 02797 that you can corrupt a MyISAM table by accessing it with different cases. \ 02798 You should consider changing lower_case_table_names to 1 or 2", 02799 mysql_real_data_home); 02800 } 02801 else 02802 { 02803 if (global_system_variables.log_warnings) 02804 sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home); 02805 lower_case_table_names= 2; 02806 } 02807 } 02808 else if (lower_case_table_names == 2 && 02809 !(lower_case_file_system= 02810 (test_if_case_insensitive(mysql_real_data_home) == 1))) 02811 { 02812 if (global_system_variables.log_warnings) 02813 sql_print_warning("lower_case_table_names was set to 2, even though your " 02814 "the file system '%s' is case sensitive. Now setting " 02815 "lower_case_table_names to 0 to avoid future problems.", 02816 mysql_real_data_home); 02817 lower_case_table_names= 0; 02818 } 02819 else 02820 { 02821 lower_case_file_system= 02822 (test_if_case_insensitive(mysql_real_data_home) == 1); 02823 } 02824 02825 /* Reset table_alias_charset, now that lower_case_table_names is set. */ 02826 table_alias_charset= (lower_case_table_names ? 02827 files_charset_info : 02828 &my_charset_bin); 02829 02830 return 0; 02831 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static bool init_global_datetime_format | ( | timestamp_type | format_type, | |
| DATE_TIME_FORMAT ** | var_ptr | |||
| ) | [static] |
Definition at line 2569 of file mysqld.cc.
References date_time_format_make(), get_date_time_format_str(), ISO_FORMAT, known_date_time_formats, and strlen().
Referenced by get_options().
02571 { 02572 /* Get command line option */ 02573 const char *str= opt_date_time_formats[format_type]; 02574 02575 if (!str) // No specified format 02576 { 02577 str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT], 02578 format_type); 02579 /* 02580 Set the "command line" option to point to the generated string so 02581 that we can set global formats back to default 02582 */ 02583 opt_date_time_formats[format_type]= str; 02584 } 02585 if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str)))) 02586 { 02587 fprintf(stderr, "Wrong date/time format specifier: %s\n", str); 02588 return 1; 02589 } 02590 return 0; 02591 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int init_server_components | ( | ) | [static] |
Definition at line 3013 of file mysqld.cc.
References array_elements, system_variables::binlog_format, BINLOG_FORMAT_STMT, BINLOG_FORMAT_UNSPEC, buf, DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, errno, exit, EXIT_OUT_OF_MEMORY, fn_format(), FN_REFLEN, ft_init_stopwords(), MYSQL_LOG::generate_name(), global_system_variables, ha_init(), ha_init_key_cache(), ha_recover(), ha_resolve_by_name(), ha_storage_engine_is_enabled(), have_csv_db, have_ndbcluster, hostname_cache_init(), LOGGER::init_log_tables(), init_max_user_conn(), init_thr_lock(), init_update_queries(), LOG_BIN, LOG_FILE, LOG_NONE, LOG_TABLE, system_variables::log_warnings, logger, mi_log(), MY_ALLOW_ZERO_PTR, my_free, MY_REPLACE_EXT, MY_SAFE_PATH, my_strdup(), MY_UNPACK_FILENAME, MY_WME, MYF, myisam_hton, mysql_bin_log, name, NW_THD_STACKSIZE, MYSQL_BIN_LOG::open(), TC_LOG::open(), MYSQL_BIN_LOG::open_index_file(), plugin_init(), process_key_caches(), pthread_attr_setstacksize, MYSQL_BIN_LOG::purge_logs_before_date(), randominit(), reset_floating_point_exceptions, LOGGER::set_handlers(), set_user(), SHOW_OPTION_NO, SHOW_OPTION_YES, sql_perror(), sql_print_error(), sql_print_warning(), sql_rand, strlen(), table_cache_init(), table_def_init(), system_variables::table_type, tc_log, tc_log_dummy, tc_log_mmap, total_ha_2pc, unireg_abort(), WRITE_CACHE, and xid_cache_init().
Referenced by main().
03014 { 03015 DBUG_ENTER("init_server_components"); 03016 /* 03017 We need to call each of these following functions to ensure that 03018 all things are initialized so that unireg_abort() doesn't fail 03019 */ 03020 if (table_cache_init() | table_def_init() | hostname_cache_init()) 03021 unireg_abort(1); 03022 03023 query_cache_result_size_limit(query_cache_limit); 03024 query_cache_set_min_res_unit(query_cache_min_res_unit); 03025 query_cache_init(); 03026 query_cache_resize(query_cache_size); 03027 randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2); 03028 reset_floating_point_exceptions(); 03029 init_thr_lock(); 03030 #ifdef HAVE_REPLICATION 03031 init_slave_list(); 03032 #endif 03033 03034 /* Setup logs */ 03035 03036 /* enable old-fashioned error log */ 03037 if (opt_error_log) 03038 { 03039 if (!log_error_file_ptr[0]) 03040 fn_format(log_error_file, glob_hostname, mysql_data_home, ".err", 03041 MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */ 03042 else 03043 fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err", 03044 MY_UNPACK_FILENAME | MY_SAFE_PATH); 03045 if (!log_error_file[0]) 03046 opt_error_log= 1; // Too long file name 03047 else 03048 { 03049 #ifndef EMBEDDED_LIBRARY 03050 if (freopen(log_error_file, "a+", stdout)) 03051 #endif 03052 freopen(log_error_file, "a+", stderr); 03053 } 03054 } 03055 03056 if (xid_cache_init()) 03057 { 03058 sql_print_error("Out of memory"); 03059 unireg_abort(1); 03060 } 03061 03062 /* need to configure logging before initializing storage engines */ 03063 if (opt_update_log) 03064 { 03065 /* 03066 Update log is removed since 5.0. But we still accept the option. 03067 The idea is if the user already uses the binlog and the update log, 03068 we completely ignore any option/variable related to the update log, like 03069 if the update log did not exist. But if the user uses only the update 03070 log, then we translate everything into binlog for him (with warnings). 03071 Implementation of the above : 03072 - If mysqld is started with --log-update and --log-bin, 03073 ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE 03074 is used, and turn off --sql-bin-update-same. 03075 This will completely ignore SQL_LOG_UPDATE 03076 - If mysqld is started with --log-update only, 03077 change it to --log-bin (with the filename passed to log-update, 03078 plus '-bin') (print a warning), push a warning when SQL_LOG_UPDATE is 03079 used, and turn on --sql-bin-update-same. 03080 This will translate SQL_LOG_UPDATE to SQL_LOG_BIN. 03081 03082 Note that we tell the user that --sql-bin-update-same is deprecated and 03083 does nothing, and we don't take into account if he used this option or 03084 not; but internally we give this variable a value to have the behaviour 03085 we want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not). 03086 As sql-bin-update-same, log-update and log-bin cannot be changed by the 03087 user after starting the server (they are not variables), the user will 03088 not later interfere with the settings we do here. 03089 */ 03090 if (opt_bin_log) 03091 { 03092 opt_sql_bin_update= 0; 03093 sql_print_error("The update log is no longer supported by MySQL in \ 03094 version 5.0 and above. It is replaced by the binary log."); 03095 } 03096 else 03097 { 03098 opt_sql_bin_update= 1; 03099 opt_bin_log= 1; 03100 if (opt_update_logname) 03101 { 03102 /* as opt_bin_log==0, no need to free opt_bin_logname */ 03103 if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME)))) 03104 exit(EXIT_OUT_OF_MEMORY); 03105 sql_print_error("The update log is no longer supported by MySQL in \ 03106 version 5.0 and above. It is replaced by the binary log. Now starting MySQL \ 03107 with --log-bin='%s' instead.",opt_bin_logname); 03108 } 03109 else 03110 sql_print_error("The update log is no longer supported by MySQL in \ 03111 version 5.0 and above. It is replaced by the binary log. Now starting MySQL \ 03112 with --log-bin instead."); 03113 } 03114 } 03115 if (opt_log_slave_updates && !opt_bin_log) 03116 { 03117 sql_print_warning("You need to use --log-bin to make " 03118 "--log-slave-updates work."); 03119 unireg_abort(1); 03120 } 03121 03122 if (!opt_bin_log && (global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC)) 03123 { 03124 sql_print_warning("You need to use --log-bin to make " 03125 "--binlog-format work."); 03126 unireg_abort(1); 03127 } 03128 if (global_system_variables.binlog_format == BINLOG_FORMAT_UNSPEC) 03129 { 03130 #if defined(HAVE_NDB_BINLOG) && defined(HAVE_ROW_BASED_REPLICATION) 03131 if (opt_bin_log && have_ndbcluster == SHOW_OPTION_YES) 03132 global_system_variables.binlog_format= BINLOG_FORMAT_ROW; 03133 else 03134 #endif 03135 global_system_variables.binlog_format= BINLOG_FORMAT_STMT; 03136 } 03137 03138 /* Check that we have not let the format to unspecified at this point */ 03139 DBUG_ASSERT((uint)global_system_variables.binlog_format <= 03140 array_elements(binlog_format_names)-1); 03141 03142 #ifdef HAVE_REPLICATION 03143 if (opt_log_slave_updates && replicate_same_server_id) 03144 { 03145 sql_print_error("\ 03146 using --replicate-same-server-id in conjunction with \ 03147 --log-slave-updates is impossible, it would lead to infinite loops in this \ 03148 server."); 03149 unireg_abort(1); 03150 } 03151 #endif 03152 03153 if (opt_bin_log) 03154 { 03155 char buf[FN_REFLEN]; 03156 const char *ln; 03157 ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf); 03158 if (!opt_bin_logname && !opt_binlog_index_name) 03159 { 03160 /* 03161 User didn't give us info to name the binlog index file. 03162 Picking `hostname`-bin.index like did in 4.x, causes replication to 03163 fail if the hostname is changed later. So, we would like to instead 03164 require a name. But as we don't want to break many existing setups, we 03165 only give warning, not error. 03166 */ 03167 sql_print_warning("No argument was provided to --log-bin, and " 03168 "--log-bin-index was not used; so replication " 03169 "may break when this MySQL server acts as a " 03170 "master and has his hostname changed!! Please " 03171 "use '--log-bin=%s' to avoid this problem.", ln); 03172 } 03173 if (ln == buf) 03174 { 03175 my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR)); 03176 opt_bin_logname=my_strdup(buf, MYF(0)); 03177 } 03178 if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln)) 03179 { 03180 unireg_abort(1); 03181 } 03182 03183 /* 03184 Used to specify which type of lock we need to use for queries of type 03185 INSERT ... SELECT. This will change when we have row level logging. 03186 */ 03187 using_update_log=1; 03188 } 03189 03190 if (plugin_init()) 03191 { 03192 sql_print_error("Failed to init plugins."); 03193 return 1; 03194 } 03195 03196 /* We have to initialize the storage engines before CSV logging */ 03197 if (ha_init()) 03198 { 03199 sql_print_error("Can't init databases"); 03200 unireg_abort(1); 03201 } 03202 03203 #ifdef WITH_CSV_STORAGE_ENGINE 03204 if (opt_bootstrap) 03205 log_output_options= LOG_FILE; 03206 else 03207 logger.init_log_tables(); 03208 03209 if (log_output_options & LOG_NONE) 03210 { 03211 /* 03212 Issue a warining if there were specified additional options to the 03213 log-output along with NONE. Probably this wasn't what user wanted. 03214 */ 03215 if ((log_output_options & LOG_NONE) && (log_output_options & ~LOG_NONE)) 03216 sql_print_warning("There were other values specified to " 03217 "log-output besides NONE. Disabling slow " 03218 "and general logs anyway."); 03219 logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE); 03220 } 03221 else 03222 { 03223 /* fall back to the log files if tables are not present */ 03224 if (have_csv_db == SHOW_OPTION_NO) 03225 { 03226 /* purecov: begin inspected */ 03227 sql_print_error("CSV engine is not present, falling back to the " 03228 "log files"); 03229 log_output_options= (log_output_options & ~LOG_TABLE) | LOG_FILE; 03230 /* purecov: end */ 03231 } 03232 03233 logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE, 03234 opt_log ? log_output_options:LOG_NONE); 03235 } 03236 #else 03237 logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE, 03238 opt_log ? LOG_FILE:LOG_NONE); 03239 #endif 03240 03241 /* 03242 Check that the default storage engine is actually available. 03243 */ 03244 { 03245 LEX_STRING name= { default_storage_engine_str, 03246 strlen(default_storage_engine_str) }; 03247 handlerton *hton= ha_resolve_by_name(0, &name); 03248 if (hton == NULL) 03249 { 03250 sql_print_error("Unknown/unsupported table type: %s", 03251 default_storage_engine_str); 03252 unireg_abort(1); 03253 } 03254 if (!ha_storage_engine_is_enabled(hton)) 03255 { 03256 if (!opt_bootstrap) 03257 { 03258 sql_print_error("Default storage engine (%s) is not available", 03259 default_storage_engine_str); 03260 unireg_abort(1); 03261 } 03262 hton= &myisam_hton; 03263 } 03264 global_system_variables.table_type= hton; 03265 } 03266 03267 tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? 03268 (TC_LOG *) &mysql_bin_log : 03269 (TC_LOG *) &tc_log_mmap) : 03270 (TC_LOG *) &tc_log_dummy); 03271 03272 if (tc_log->open(opt_bin_logname)) 03273 { 03274 sql_print_error("Can't init tc log"); 03275 unireg_abort(1); 03276 } 03277 03278 if (ha_recover(0)) 03279 { 03280 unireg_abort(1); 03281 } 03282 03283 if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 03284 WRITE_CACHE, 0, max_binlog_size, 0)) 03285 unireg_abort(1); 03286 03287 #ifdef HAVE_REPLICATION 03288 if (opt_bin_log && expire_logs_days) 03289 { 03290 long purge_time= time(0) - expire_logs_days*24*60*60; 03291 if (purge_time >= 0) 03292 mysql_bin_log.purge_logs_before_date(purge_time); 03293 } 03294 #endif 03295 #ifdef __NETWARE__ 03296 /* Increasing stacksize of threads on NetWare */ 03297 pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); 03298 #endif 03299 03300 if (opt_myisam_log) 03301 (void) mi_log(1); 03302 03303 /* call ha_init_key_cache() on all key caches to init them */ 03304 process_key_caches(&ha_init_key_cache); 03305 03306 #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && !defined(EMBEDDED_LIBRARY) 03307 if (locked_in_memory && !getuid()) 03308 { 03309 if (setreuid((uid_t)-1, 0) == -1) 03310 { // this should never happen 03311 sql_perror("setreuid"); 03312 unireg_abort(1); 03313 } 03314 if (mlockall(MCL_CURRENT)) 03315 { 03316 if (global_system_variables.log_warnings) 03317 sql_print_warning("Failed to lock memory. Errno: %d\n",errno); 03318 locked_in_memory= 0; 03319 } 03320 if (user_info) 03321 set_user(mysqld_user, user_info); 03322 } 03323 else 03324 #endif 03325 locked_in_memory=0; 03326 03327 ft_init_stopwords(); 03328 03329 init_max_user_conn(); 03330 init_update_queries(); 03331 DBUG_RETURN(0); 03332 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void init_signals | ( | void | ) | [static] |
Definition at line 2170 of file mysqld.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, end_thread_signal(), global_system_variables, handle_segfault(), init_stacktrace, system_variables::log_warnings, my_sigset, print_signal_warning(), SA_NODEFER, SA_RESETHAND, sigemptyset, SIGPIPE, SIGQUIT, sql_print_warning(), STRUCT_RLIMIT, TEST_CORE_ON_SIGNAL, TEST_NO_STACKTRACE, TEST_SIGINT, THR_CLIENT_ALARM, THR_KILL_SIGNAL, and THR_SERVER_ALARM.
Referenced by handle_one_connection(), and main().
02171 { 02172 sigset_t set; 02173 struct sigaction sa; 02174 DBUG_ENTER("init_signals"); 02175 02176 if (test_flags & TEST_SIGINT) 02177 my_sigset(THR_KILL_SIGNAL,end_thread_signal); 02178 my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called! 02179 02180 if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL)) 02181 { 02182 sa.sa_flags = SA_RESETHAND | SA_NODEFER; 02183 sigemptyset(&sa.sa_mask); 02184 sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); 02185 02186 init_stacktrace(); 02187 #if defined(__amiga__) 02188 sa.sa_handler=(void(*)())handle_segfault; 02189 #else 02190 sa.sa_handler=handle_segfault; 02191 #endif 02192 sigaction(SIGSEGV, &sa, NULL); 02193 sigaction(SIGABRT, &sa, NULL); 02194 #ifdef SIGBUS 02195 sigaction(SIGBUS, &sa, NULL); 02196 #endif 02197 sigaction(SIGILL, &sa, NULL); 02198 sigaction(SIGFPE, &sa, NULL); 02199 } 02200 02201 #ifdef HAVE_GETRLIMIT 02202 if (test_flags & TEST_CORE_ON_SIGNAL) 02203 { 02204 /* Change limits so that we will get a core file */ 02205 STRUCT_RLIMIT rl; 02206 rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; 02207 if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings) 02208 sql_print_warning("setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals"); 02209 } 02210 #endif 02211 (void) sigemptyset(&set); 02212 my_sigset(SIGPIPE,SIG_IGN); 02213 sigaddset(&set,SIGPIPE); 02214 sigaddset(&set,SIGINT); 02215 #ifndef IGNORE_SIGHUP_SIGQUIT 02216 sigaddset(&set,SIGQUIT); 02217 sigaddset(&set,SIGHUP); 02218 #endif 02219 sigaddset(&set,SIGTERM); 02220 02221 /* Fix signals if blocked by parents (can happen on Mac OS X) */ 02222 sigemptyset(&sa.sa_mask); 02223 sa.sa_flags = 0; 02224 sa.sa_handler = print_signal_warning; 02225 sigaction(SIGTERM, &sa, (struct sigaction*) 0); 02226 sa.sa_flags = 0; 02227 sa.sa_handler = print_signal_warning; 02228 sigaction(SIGHUP, &sa, (struct sigaction*) 0); 02229 #ifdef SIGTSTP 02230 sigaddset(&set,SIGTSTP); 02231 #endif 02232 sigaddset(&set,THR_SERVER_ALARM); 02233 if (test_flags & TEST_SIGINT) 02234 sigdelset(&set,THR_KILL_SIGNAL); // May be SIGINT 02235 sigdelset(&set,THR_CLIENT_ALARM); // For alarms 02236 sigprocmask(SIG_SETMASK,&set,NULL); 02237 pthread_sigmask(SIG_SETMASK,&set,NULL); 02238 DBUG_VOID_RETURN; 02239 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void init_ssl | ( | ) | [static] |
Definition at line 2975 of file mysqld.cc.
References DBUG_PRINT, and SHOW_OPTION_DISABLED.
Referenced by main().
02976 { 02977 #ifdef HAVE_OPENSSL 02978 if (opt_use_ssl) 02979 { 02980 /* having ssl_acceptor_fd != 0 signals the use of SSL */ 02981 ssl_acceptor_fd= new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert, 02982 opt_ssl_ca, opt_ssl_capath, 02983 opt_ssl_cipher); 02984 DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd)); 02985 if (!ssl_acceptor_fd) 02986 { 02987 opt_use_ssl = 0; 02988 have_openssl= SHOW_OPTION_DISABLED; 02989 } 02990 } 02991 else 02992 { 02993 have_openssl= SHOW_OPTION_DISABLED; 02994 } 02995 if (des_key_file) 02996 load_des_key_file(des_key_file); 02997 #endif /* HAVE_OPENSSL */ 02998 }
Here is the caller graph for this function:

| static int init_thread_environment | ( | ) | [static] |
Definition at line 2834 of file mysqld.cc.
References COND_manager, Events::init_mutexes(), lock, LOCK_grant, LOCK_lock_db, LOCK_manager, LOCK_sys_init_connect, LOCK_sys_init_slave, MY_MUTEX_INIT_FAST, MY_MUTEX_INIT_SLOW, my_pthread_attr_setprio(), my_rwlock_init, OPENSSL_malloc, pthread_attr_setscope, pthread_mutex_init, sp_cache_init(), SPECIAL_NO_PRIOR, sql_print_error(), and WAIT_PRIOR.
Referenced by init_common_variables().
02835 { 02836 (void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW); 02837 (void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW); 02838 (void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW); 02839 (void) pthread_mutex_init(&LOCK_open, NULL); 02840 (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST); 02841 (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW); 02842 (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST); 02843 (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST); 02844 (void) pthread_mutex_init(&LOCK_delayed_insert,MY_MUTEX_INIT_FAST); 02845 (void) pthread_mutex_init(&LOCK_delayed_status,MY_MUTEX_INIT_FAST); 02846 (void) pthread_mutex_init(&LOCK_delayed_create,MY_MUTEX_INIT_SLOW); 02847 (void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST); 02848 (void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST); 02849 (void) pthread_mutex_init(&LOCK_bytes_sent,MY_MUTEX_INIT_FAST); 02850 (void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST); 02851 (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST); 02852 (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); 02853 (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST); 02854 (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); 02855 (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST); 02856 (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); 02857 #ifdef HAVE_OPENSSL 02858 (void) pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST); 02859 #ifndef HAVE_YASSL 02860 openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() * 02861 sizeof(openssl_lock_t)); 02862 for (int i= 0; i < CRYPTO_num_locks(); ++i) 02863 (void) my_rwlock_init(&openssl_stdlocks[i].lock, NULL); 02864 CRYPTO_set_dynlock_create_callback(openssl_dynlock_create); 02865 CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy); 02866 CRYPTO_set_dynlock_lock_callback(openssl_lock); 02867 CRYPTO_set_locking_callback(openssl_lock_function); 02868 CRYPTO_set_id_callback(openssl_id_function); 02869 #endif 02870 #endif 02871 (void) my_rwlock_init(&LOCK_sys_init_connect, NULL); 02872 (void) my_rwlock_init(&LOCK_sys_init_slave, NULL); 02873 (void) my_rwlock_init(&LOCK_grant, NULL); 02874 (void) pthread_cond_init(&COND_thread_count,NULL); 02875 (void) pthread_cond_init(&COND_refresh,NULL); 02876 (void) pthread_cond_init(&COND_global_read_lock,NULL); 02877 (void) pthread_cond_init(&COND_thread_cache,NULL); 02878 (void) pthread_cond_init(&COND_flush_thread_cache,NULL); 02879 (void) pthread_cond_init(&COND_manager,NULL); 02880 #ifdef HAVE_REPLICATION 02881 (void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST); 02882 (void) pthread_cond_init(&COND_rpl_status, NULL); 02883 #endif 02884 (void) pthread_mutex_init(&LOCK_server_started, MY_MUTEX_INIT_FAST); 02885 (void) pthread_cond_init(&COND_server_started,NULL); 02886 sp_cache_init(); 02887 Events::init_mutexes(); 02888 /* Parameter for threads created for connections */ 02889 (void) pthread_attr_init(&connection_attrib); 02890 (void) pthread_attr_setdetachstate(&connection_attrib, 02891 PTHREAD_CREATE_DETACHED); 02892 pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM); 02893 if (!(opt_specialflag & SPECIAL_NO_PRIOR)) 02894 my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR); 02895 02896 if (pthread_key_create(&THR_THD,NULL) || 02897 pthread_key_create(&THR_MALLOC,NULL)) 02898 { 02899 sql_print_error("Can't create thread-keys"); 02900 return 1; 02901 } 02902 return 0; 02903 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void kill_mysql | ( | void | ) |
Definition at line 962 of file mysqld.cc.
References close_server_sock(), DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, errno, kill_server_thread(), MYSQL_KILL_SIGNAL, and sql_print_error().
Referenced by dispatch_command(), handle_sigint(), and mysql_sigint().
00963 { 00964 DBUG_ENTER("kill_mysql"); 00965 00966 #ifdef SIGNALS_DONT_BREAK_READ 00967 abort_loop=1; // Break connection loops 00968 close_server_sock(); // Force accept to wake up 00969 #endif 00970 00971 #if defined(__WIN__) 00972 #if !defined(EMBEDDED_LIBRARY) 00973 { 00974 if (!SetEvent(hEventShutdown)) 00975 { 00976 DBUG_PRINT("error",("Got error: %ld from SetEvent",GetLastError())); 00977 } 00978 /* 00979 or: 00980 HANDLE hEvent=OpenEvent(0, FALSE, "MySqlShutdown"); 00981 SetEvent(hEventShutdown); 00982 CloseHandle(hEvent); 00983 */ 00984 } 00985 #endif 00986 #elif defined(HAVE_PTHREAD_KILL) 00987 if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL)) 00988 { 00989 DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */ 00990 } 00991 #elif !defined(SIGNALS_DONT_BREAK_READ) 00992 kill(current_pid, MYSQL_KILL_SIGNAL); 00993 #endif 00994 DBUG_PRINT("quit",("After pthread_kill")); 00995 shutdown_in_progress=1; // Safety if kill didn't work 00996 #ifdef SIGNALS_DONT_BREAK_READ 00997 if (!kill_in_progress) 00998 { 00999 pthread_t tmp; 01000 abort_loop=1; 01001 if (pthread_create(&tmp,&connection_attrib, kill_server_thread, 01002 (void*) 0)) 01003 sql_print_error("Can't create thread to kill server"); 01004 } 01005 #endif 01006 DBUG_VOID_RETURN; 01007 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void* kill_server | ( | void * | sig_ptr | ) | [static] |
Definition at line 1028 of file mysqld.cc.
References __WIN__, close_connections(), DBUG_ENTER, DBUG_PRINT, ER, ER_GOT_SIGNAL, ER_NORMAL_SHUTDOWN, int(), my_progname, my_sigset, my_thread_end(), my_thread_init(), MYSQL_KILL_SIGNAL, RETURN_FROM_KILL_SERVER, sig(), sql_print_error(), sql_print_information(), TRUE, unireg_abort(), and unireg_end().
Referenced by handle_connections_sockets(), and signal_hand().
01034 { 01035 DBUG_ENTER("kill_server"); 01036 #ifndef EMBEDDED_LIBRARY 01037 int sig=(int) (long) sig_ptr; // This is passed a int 01038 // if there is a signal during the kill in progress, ignore the other 01039 if (kill_in_progress) // Safety 01040 RETURN_FROM_KILL_SERVER; 01041 kill_in_progress=TRUE; 01042 abort_loop=1; // This should be set 01043 if (sig != 0) // 0 is not a valid signal number 01044 my_sigset(sig,SIG_IGN); 01045 if (sig == MYSQL_KILL_SIGNAL || sig == 0) 01046 sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname); 01047 else 01048 sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */ 01049 01050 #if defined(HAVE_SMEM) && defined(__WIN__) 01051 /* 01052 Send event to smem_event_connect_request for aborting 01053 */ 01054 if (!SetEvent(smem_event_connect_request)) 01055 { 01056 DBUG_PRINT("error", 01057 ("Got error: %ld from SetEvent of smem_event_connect_request", 01058 GetLastError())); 01059 } 01060 #endif 01061 01062 #if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__)) 01063 my_thread_init(); // If this is a new thread 01064 #endif 01065 close_connections(); 01066 if (sig != MYSQL_KILL_SIGNAL && 01067 #ifdef __WIN__ 01068 sig != SIGINT && /* Bug#18235 */ 01069 #endif 01070 sig != 0) 01071 unireg_abort(1); /* purecov: inspected */ 01072 else 01073 unireg_end(); 01074 01075 #ifdef __NETWARE__ 01076 if (!event_flag) 01077 pthread_join(select_thread, NULL); // wait for main thread 01078 #endif /* __NETWARE__ */ 01079 01080 #if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2)) 01081 my_thread_end(); 01082 #endif 01083 01084 pthread_exit(0); /* purecov: deadcode */ 01085 01086 #endif /* EMBEDDED_LIBRARY */ 01087 RETURN_FROM_KILL_SERVER; 01088 }
Here is the call graph for this function:

Here is the caller graph for this function:

| pthread_handler_t kill_server_thread | ( | void * | arg | ) |
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 3437 of file mysqld.cc.
References acl_init(), binlog_filter, bootstrap(), check_data_home(), check_user(), clean_up(), clean_up_mutexes(), CONNECT_PRIOR, create_maintenance_thread(), create_shutdown_thread(), DBUG_PRINT, dirname_length(), end_thr_alarm, ER, ER_STARTUP, ER_WSAS_FAILED, error, error_handler_hook, execute_ddl_log_recovery(), exit, FN_CURLIB, global_system_variables, grant_init(), handle_connections_sockets(), Events::init(), LOGGER::init_base(), init_common_variables(), init_server_components(), init_signals(), init_ssl(), init_status_vars(), INVALID_SOCKET, NTService::IsNT(), system_variables::log_warnings, logger, MY_CHECK_ERROR, my_delete(), my_end(), MY_GIVE_INFO, MY_INIT, my_message(), my_message_sql(), my_progname, my_pthread_setprio(), my_setwd(), my_str_free, my_str_free_mysqld(), my_str_malloc, my_str_malloc_mysqld(), my_tz_init(), MY_WME, MYF, MYSQL_COMPILATION_COMMENT, MYSQL_CONFIG_NAME, MYSQL_KILL_SIGNAL, network_init(), NW_THD_STACKSIZE, opt_console, plugin_load(), pthread_attr_setstacksize, pthread_mutex_lock, pthread_mutex_unlock, read_init_file(), release_ddl_log(), rpl_filter, set_effective_user(), set_user(), NTService::SetShutdownEvent(), SOCKET_ERROR, SPECIAL_NO_PRIOR, sql_perror(), sql_print_error(), sql_print_information(), sql_print_warning(), start_signal_handler(), NTService::Stop(), thr_setconcurrency, unireg_abort(), and wait_for_signal_thread_to_end().
03439 { 03440 rpl_filter= new Rpl_filter; 03441 binlog_filter= new Rpl_filter; 03442 if (!rpl_filter || !binlog_filter) 03443 { 03444 sql_perror("Could not allocate replication and binlog filters"); 03445 exit(1); 03446 } 03447 03448 MY_INIT(argv[0]); // init my_sys library & pthreads 03449 03450 /* 03451 Perform basic logger initialization logger. Should be called after 03452 MY_INIT, as it initializes mutexes. Log tables are inited later. 03453 */ 03454 logger.init_base(); 03455 03456 #ifdef _CUSTOMSTARTUPCONFIG_ 03457 if (_cust_check_startup()) 03458 { 03459 / * _cust_check_startup will report startup failure error * / 03460 exit(1); 03461 } 03462 #endif 03463 03464 #ifdef __WIN__ 03465 /* 03466 Before performing any socket operation (like retrieving hostname 03467 in init_common_variables we have to call WSAStartup 03468 */ 03469 { 03470 WSADATA WsaData; 03471 if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData)) 03472 { 03473 /* errors are not read yet, so we use english text here */ 03474 my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0)); 03475 unireg_abort(1); 03476 } 03477 } 03478 #endif /* __WIN__ */ 03479 03480 if (init_common_variables(MYSQL_CONFIG_NAME, 03481 argc, argv, load_default_groups)) 03482 unireg_abort(1); // Will do exit 03483 03484 init_signals(); 03485 if (!(opt_specialflag & SPECIAL_NO_PRIOR)) 03486 my_pthread_setprio(pthread_self(),CONNECT_PRIOR); 03487 #if defined(__ia64__) || defined(__ia64) 03488 /* 03489 Peculiar things with ia64 platforms - it seems we only have half the 03490 stack size in reality, so we have to double it here 03491 */ 03492 pthread_attr_setstacksize(&connection_attrib,thread_stack*2); 03493 #else 03494 pthread_attr_setstacksize(&connection_attrib,thread_stack); 03495 #endif 03496 #ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE 03497 { 03498 /* Retrieve used stack size; Needed for checking stack overflows */ 03499 size_t stack_size= 0; 03500 pthread_attr_getstacksize(&connection_attrib, &stack_size); 03501 #if defined(__ia64__) || defined(__ia64) 03502 stack_size/= 2; 03503 #endif 03504 /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ 03505 if (stack_size && stack_size < thread_stack) 03506 { 03507 if (global_system_variables.log_warnings) 03508 sql_print_warning("Asked for %ld thread stack, but got %ld", 03509 thread_stack, stack_size); 03510 #if defined(__ia64__) || defined(__ia64) 03511 thread_stack= stack_size*2; 03512 #else 03513 thread_stack= stack_size; 03514 #endif 03515 } 03516 } 03517 #endif 03518 #ifdef __NETWARE__ 03519 /* Increasing stacksize of threads on NetWare */ 03520 pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); 03521 #endif 03522 03523 (void) thr_setconcurrency(concurrency); // 10 by default 03524 03525 select_thread=pthread_self(); 03526 select_thread_in_use=1; 03527 init_ssl(); 03528 03529 #ifdef HAVE_LIBWRAP 03530 libwrapName= my_progname+dirname_length(my_progname); 03531 openlog(libwrapName, LOG_PID, LOG_AUTH); 03532 #endif 03533 03534 /* 03535 We have enough space for fiddling with the argv, continue 03536 */ 03537 check_data_home(mysql_real_data_home); 03538 if (my_setwd(mysql_real_data_home,MYF(MY_WME))) 03539 unireg_abort(1); /* purecov: inspected */ 03540 mysql_data_home= mysql_data_home_buff; 03541 mysql_data_home[0]=FN_CURLIB; // all paths are relative from here 03542 mysql_data_home[1]=0; 03543 03544 if ((user_info= check_user(mysqld_user))) 03545 { 03546 #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) 03547 if (locked_in_memory) // getuid() == 0 here 03548 set_effective_user(user_info); 03549 else 03550 #endif 03551 set_user(mysqld_user, user_info); 03552 } 03553 03554 if (opt_bin_log && !server_id) 03555 { 03556 server_id= !master_host ? 1 : 2; 03557 #ifdef EXTRA_DEBUG 03558 switch (server_id) { 03559 case 1: 03560 sql_print_warning("\ 03561 You have enabled the binary log, but you haven't set server-id to \ 03562 a non-zero value: we force server id to 1; updates will be logged to the \ 03563 binary log, but connections from slaves will not be accepted."); 03564 break; 03565 case 2: 03566 sql_print_warning("\ 03567 You should set server-id to a non-0 value if master_host is set; \ 03568 we force server id to 2, but this MySQL server will not act as a slave."); 03569 break; 03570 } 03571 #endif 03572 } 03573 03574 if (init_server_components()) 03575 unireg_abort(1); 03576 03577 network_init(); 03578 03579 #ifdef __WIN__ 03580 if (!opt_console) 03581 { 03582 freopen(log_error_file,"a+",stdout); 03583 freopen(log_error_file,"a+",stderr); 03584 FreeConsole(); // Remove window 03585 } 03586 #endif 03587 03588 /* 03589 Initialize my_str_malloc() and my_str_free() 03590 */ 03591 my_str_malloc= &my_str_malloc_mysqld; 03592 my_str_free= &my_str_free_mysqld; 03593 03594 /* 03595 init signals & alarm 03596 After this we can't quit by a simple unireg_abort 03597 */ 03598 error_handler_hook= my_message_sql; 03599 start_signal_handler(); // Creates pidfile 03600 03601 if (acl_init(opt_noacl) || 03602 my_tz_init((THD *)0, default_tz_name, opt_bootstrap)) 03603 { 03604 abort_loop=1; 03605 select_thread_in_use=0; 03606 #ifndef __NETWARE__ 03607 (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL); 03608 #endif /* __NETWARE__ */ 03609 03610 if (!opt_bootstrap) 03611 (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore 03612 03613 if (unix_sock != INVALID_SOCKET) 03614 unlink(mysqld_unix_port); 03615 exit(1); 03616 } 03617 if (!opt_noacl) 03618 (void) grant_init(); 03619 03620 if (!opt_noacl) 03621 { 03622 plugin_load(); 03623 #ifdef HAVE_DLOPEN 03624 udf_init(); 03625 #endif 03626 } 03627 init_status_vars(); 03628 if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ 03629 opt_skip_slave_start= 1; 03630 /* 03631 init_slave() must be called after the thread keys are created. 03632 Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other 03633 places) assume that active_mi != 0, so let's fail if it's 0 (out of 03634 memory); a message has already been printed. 03635 */ 03636 if (init_slave() && !active_mi) 03637 { 03638 end_thr_alarm(1); // Don't allow alarms 03639 unireg_abort(1); 03640 } 03641 03642 if (opt_bootstrap) 03643 { 03644 select_thread_in_use= 0; // Allow 'kill' to work 03645 bootstrap(stdin); 03646 end_thr_alarm(1); // Don't allow alarms 03647 unireg_abort(bootstrap_error ? 1 : 0); 03648 } 03649 if (opt_init_file) 03650 { 03651 if (read_init_file(opt_init_file)) 03652 { 03653 end_thr_alarm(1); // Don't allow alarms 03654 unireg_abort(1); 03655 } 03656 } 03657 execute_ddl_log_recovery(); 03658 03659 create_shutdown_thread(); 03660 create_maintenance_thread(); 03661 03662 sql_print_information(ER(ER_STARTUP),my_progname,server_version, 03663 ((unix_sock == INVALID_SOCKET) ? (char*) "" 03664 : mysqld_unix_port), 03665 mysqld_port, 03666 MYSQL_COMPILATION_COMMENT); 03667 03668 // Signal threads waiting for server to be started 03669 mysqld_server_started= 1; 03670 pthread_cond_signal(&COND_server_started); 03671 03672 if (!opt_noacl) 03673 { 03674 Events::init(); 03675 } 03676 #if defined(__NT__) || defined(HAVE_SMEM) 03677 handle_connections_methods(); 03678 #else 03679 #ifdef __WIN__ 03680 if (!have_tcpip || opt_disable_networking) 03681 { 03682 sql_print_error("TCP/IP unavailable or disabled with --skip-networking; no available interfaces"); 03683 unireg_abort(1); 03684 } 03685 #endif 03686 handle_connections_sockets(0); 03687 #endif /* __NT__ */ 03688 03689 /* (void) pthread_attr_destroy(&connection_attrib); */ 03690 03691 DBUG_PRINT("quit",("Exiting main thread")); 03692 03693 #ifndef __WIN__ 03694 #ifdef EXTRA_DEBUG2 03695 sql_print_error("Before Lock_thread_count"); 03696 #endif 03697 (void) pthread_mutex_lock(&LOCK_thread_count); 03698 DBUG_PRINT("quit", ("Got thread_count mutex")); 03699 select_thread_in_use=0; // For close_connections 03700 (void) pthread_mutex_unlock(&LOCK_thread_count); 03701 (void) pthread_cond_broadcast(&COND_thread_count); 03702 #ifdef EXTRA_DEBUG2 03703 sql_print_error("After lock_thread_count"); 03704 #endif 03705 #endif /* __WIN__ */ 03706 03707 /* Wait until cleanup is done */ 03708 (void) pthread_mutex_lock(&LOCK_thread_count); 03709 while (!ready_to_exit) 03710 pthread_cond_wait(&COND_thread_count,&LOCK_thread_count); 03711 (void) pthread_mutex_unlock(&LOCK_thread_count); 03712 03713 release_ddl_log(); 03714 #if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) 03715 if (Service.IsNT() && start_mode) 03716 Service.Stop(); 03717 else 03718 { 03719 Service.SetShutdownEvent(0); 03720 if (hEventShutdown) 03721 CloseHandle(hEventShutdown); 03722 } 03723 #endif 03724 clean_up(1); 03725 wait_for_signal_thread_to_end(); 03726 clean_up_mutexes(); 03727 my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); 03728 03729 exit(0); 03730 return(0); /* purecov: deadcode */ 03731 }
Here is the call graph for this function:

Definition at line 2431 of file mysqld.cc.
References current_thd, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, ER_UNKNOWN_ERROR, st_net::last_errno, st_net::last_error, ME_NOREFRESH, my_progname, push_warning(), query_cache_abort(), st_net::report_error, sql_print_error(), strmake(), and MYSQL_ERROR::WARN_LEVEL_ERROR.
Referenced by main().
02432 { 02433 THD *thd; 02434 DBUG_ENTER("my_message_sql"); 02435 DBUG_PRINT("error", ("error: %u message: '%s'", error, str)); 02436 /* 02437 Put here following assertion when situation with EE_* error codes 02438 will be fixed 02439 DBUG_ASSERT(error != 0); 02440 */ 02441 if ((thd= current_thd)) 02442 { 02443 if (thd->spcont && 02444 thd->spcont->find_handler(error, MYSQL_ERROR::WARN_LEVEL_ERROR)) 02445 { 02446 if (! thd->spcont->found_handler_here()) 02447 thd->net.report_error= 1; /* Make "select" abort correctly */ 02448 DBUG_RETURN(0); 02449 } 02450 02451 thd->query_error= 1; // needed to catch query errors during replication 02452 02453 if (!thd->no_warnings_for_error) 02454 push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str); 02455 /* 02456 thd->lex->current_select == 0 if lex structure is not inited 02457 (not query command (COM_QUERY)) 02458 */ 02459 if (thd->lex->current_select && 02460 thd->lex->current_select->no_error && !thd->is_fatal_error) 02461 { 02462 DBUG_PRINT("error", 02463 ("Error converted to warning: current_select: no_error %d " 02464 "fatal_error: %d", 02465 (thd->lex->current_select ? 02466 thd->lex->current_select->no_error : 0), 02467 (int) thd->is_fatal_error)); 02468 } 02469 else 02470 { 02471 NET *net= &thd->net; 02472 net->report_error= 1; 02473 query_cache_abort(net); 02474 if (!net->last_error[0]) // Return only first message 02475 { 02476 strmake(net->last_error, str, sizeof(net->last_error)-1); 02477 net->last_errno= error ? error : ER_UNKNOWN_ERROR; 02478 } 02479 } 02480 } 02481 if (!thd || MyFlags & ME_NOREFRESH) 02482 sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */ 02483 DBUG_RETURN(0); 02484 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void my_str_free_mysqld | ( | void * | ptr | ) | [static] |
| static void* my_str_malloc_mysqld | ( | size_t | size | ) | [static] |
| static gptr* mysql_getopt_value | ( | const char * | keyname, | |
| uint | key_length, | |||
| const struct my_option * | option | |||
| ) | [static] |
Definition at line 7671 of file mysqld.cc.
References exit, get_or_create_key_cache(), my_option::id, OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_AGE_THRESHOLD, OPT_KEY_CACHE_BLOCK_SIZE, OPT_KEY_CACHE_DIVISION_LIMIT, st_key_cache::param_age_threshold, st_key_cache::param_block_size, st_key_cache::param_buff_size, st_key_cache::param_division_limit, and my_option::value.
Referenced by get_options().
07673 { 07674 switch (option->id) { 07675 case OPT_KEY_BUFFER_SIZE: 07676 case OPT_KEY_CACHE_BLOCK_SIZE: 07677 case OPT_KEY_CACHE_DIVISION_LIMIT: 07678 case OPT_KEY_CACHE_AGE_THRESHOLD: 07679 { 07680 KEY_CACHE *key_cache; 07681 if (!(key_cache= get_or_create_key_cache(keyname, key_length))) 07682 exit(1); 07683 switch (option->id) { 07684 case OPT_KEY_BUFFER_SIZE: 07685 return (gptr*) &key_cache->param_buff_size; 07686 case OPT_KEY_CACHE_BLOCK_SIZE: 07687 return (gptr*) &key_cache->param_block_size; 07688 case OPT_KEY_CACHE_DIVISION_LIMIT: 07689 return (gptr*) &key_cache->param_division_limit; 07690 case OPT_KEY_CACHE_AGE_THRESHOLD: 07691 return (gptr*) &key_cache->param_age_threshold; 07692 } 07693 } 07694 } 07695 return option->value; 07696 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void mysql_init_variables | ( | void | ) | [static] |
Definition at line 6892 of file mysqld.cc.
References binlog_cache_disk_use, system_variables::binlog_format, BINLOG_FORMAT_UNSPEC, bzero, character_set_filesystem, charsets_dir, cleanup_dirname(), COM_TIME, charset_info_st::csname, DATADIR, default_key_cache_base, DEFAULT_MYSQL_HOME, default_shared_memory_base_name, DELAY_KEY_WRITE_ON, dflt_key_cache, exit, files_charset_info, find_bit_type(), FN_CURLIB, get_or_create_key_cache(), get_relative_path(), getenv(), global_status_var, global_system_variables, HA_POS_ERROR, have_ndbcluster, IF_WIN, INVALID_SOCKET, ISO_REPEATABLE_READ, key_caches, key_map_full, LANGUAGE, LEX_STRING::length, LIBLEN, log_output_typelib, system_variables::max_join_size, max_system_variables, MI_STATS_METHOD_NULLS_NOT_EQUAL, multi_keycache_init(), my_charset_bin, my_charset_utf8_general_ci, my_path(), my_progname, myisam_hton, system_variables::myisam_stats_method, MYSQL_DEFAULT_CHARSET_NAME, MYSQL_SERVER_VERSION, mysql_tmpdir_list, national_charset_info, system_variables::ndb_index_stat_cache_entries, system_variables::ndb_index_stat_enable, system_variables::ndb_index_stat_update_freq, NullS, system_variables::old_alter_table, system_variables::old_passwords, opt_relaylog_index_name, opt_skip_show_db, OPTION_AUTO_IS_NULL, OPTION_BIN_LOG, OPTION_QUOTE_SHOW_CREATE, OPTION_SQL_NOTES, PROTOCOL_VERSION, system_variables::select_limit, Bitmap< 64 >::set_all(), SHOW_OPTION_DISABLED, SHOW_OPTION_NO, SHOW_OPTION_YES, SPECIAL_ENGLISH, SPECIAL_NO_PRIOR, LEX_STRING::str, strcat(), strmake(), strmov(), sys_charset_system, system_charset_info, table_alias_charset, system_variables::table_type, thread_cache, threads, TRUE, system_variables::tx_isolation, and sys_var_const_str::value.
Referenced by init_common_variables().
06893 { 06894 /* Things reset to zero */ 06895 opt_skip_slave_start= opt_reckless_slave = 0; 06896 mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0; 06897 opt_log= opt_slow_log= 0; 06898 opt_update_log= 0; 06899 log_output_options= find_bit_type(log_output_str, &log_output_typelib); 06900 opt_bin_log= 0; 06901 opt_disable_networking= opt_skip_show_db=0; 06902 opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0; 06903 opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name ! 06904 opt_secure_auth= 0; 06905 opt_bootstrap= opt_myisam_log= 0; 06906 mqh_used= 0; 06907 segfaulted= kill_in_progress= 0; 06908 cleanup_done= 0; 06909 defaults_argv= 0; 06910 server_id_supplied= 0; 06911 test_flags= select_errors= dropping_tables= ha_open_options=0; 06912 thread_count= thread_running= kill_cached_threads= wake_thread=0; 06913 slave_open_temp_tables= 0; 06914 cached_thread_count= 0; 06915 opt_endinfo= using_udf_functions= 0; 06916 opt_using_transactions= using_update_log= 0; 06917 abort_loop= select_thread_in_use= signal_thread_in_use= 0; 06918 ready_to_exit= shutdown_in_progress= grant_option= 0; 06919 aborted_threads= aborted_connects= 0; 06920 delayed_insert_threads= delayed_insert_writes= delayed_rows_in_use= 0; 06921 delayed_insert_errors= thread_created= 0; 06922 specialflag= 0; 06923 binlog_cache_use= binlog_cache_disk_use= 0; 06924 max_used_connections= slow_launch_threads = 0; 06925 mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0; 06926 errmesg= 0; 06927 mysqld_unix_port= opt_mysql_tmpdir= my_bind_addr_str= NullS; 06928 bzero((gptr) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list)); 06929 bzero((char *) &global_status_var, sizeof(global_status_var)); 06930 opt_large_pages= 0; 06931 key_map_full.set_all(); 06932 06933 /* Character sets */ 06934 system_charset_info= &my_charset_utf8_general_ci; 06935 files_charset_info= &my_charset_utf8_general_ci; 06936 national_charset_info= &my_charset_utf8_general_ci; 06937 table_alias_charset= &my_charset_bin; 06938 character_set_filesystem= &my_charset_bin; 06939 06940 opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0; 06941 06942 /* Things with default values that are not zero */ 06943 delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; 06944 opt_specialflag= SPECIAL_ENGLISH; 06945 unix_sock= ip_sock= INVALID_SOCKET; 06946 mysql_home_ptr= mysql_home; 06947 pidfile_name_ptr= pidfile_name; 06948 log_error_file_ptr= log_error_file; 06949 language_ptr= language; 06950 mysql_data_home= mysql_real_data_home; 06951 thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG | 06952 OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES); 06953 protocol_version= PROTOCOL_VERSION; 06954 what_to_log= ~ (1L << (uint) COM_TIME); 06955 refresh_version= flush_version= 1L; /* Increments on each reload */ 06956 query_id= thread_id= 1L; 06957 strmov(server_version, MYSQL_SERVER_VERSION); 06958 myisam_recover_options_str= sql_mode_str= "OFF"; 06959 myisam_stats_method_str= "nulls_unequal"; 06960 my_bind_addr = htonl(INADDR_ANY); 06961 threads.empty(); 06962 thread_cache.empty(); 06963 key_caches.empty(); 06964 if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str, 06965 default_key_cache_base.length))) 06966 exit(1); 06967 multi_keycache_init(); /* set key_cache_hash.default_value = dflt_key_cache */ 06968 06969 /* Set directory paths */ 06970 strmake(language, LANGUAGE, sizeof(language)-1); 06971 strmake(mysql_real_data_home, get_relative_path(DATADIR), 06972 sizeof(mysql_real_data_home)-1); 06973 mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here 06974 mysql_data_home_buff[1]=0; 06975 06976 /* Replication parameters */ 06977 master_user= (char*) "test"; 06978 master_password= master_host= 0; 06979 master_info_file= (char*) "master.info", 06980 relay_log_info_file= (char*) "relay-log.info"; 06981 master_ssl_key= master_ssl_cert= master_ssl_ca= 06982 master_ssl_capath= master_ssl_cipher= 0; 06983 report_user= report_password = report_host= 0; /* TO BE DELETED */ 06984 opt_relay_logname= opt_relaylog_index_name= 0; 06985 06986 /* Variables in libraries */ 06987 charsets_dir= 0; 06988 default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; 06989 default_collation_name= compiled_default_collation_name; 06990 sys_charset_system.value= (char*) system_charset_info->csname; 06991 character_set_filesystem_name= (char*) "binary"; 06992 06993 /* Set default values for some option variables */ 06994 default_storage_engine_str= (char*) "MyISAM"; 06995 global_system_variables.table_type= &myisam_hton; 06996 global_system_variables.tx_isolation= ISO_REPEATABLE_READ; 06997 global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; 06998 max_system_variables.select_limit= (ulonglong) HA_POS_ERROR; 06999 global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; 07000 max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; 07001 global_system_variables.old_passwords= 0; 07002 global_system_variables.old_alter_table= 0; 07003 global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC; 07004 /* 07005 Default behavior for 4.1 and 5.0 is to treat NULL values as unequal 07006 when collecting index statistics for MyISAM tables. 07007 */ 07008 global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; 07009 07010 /* Variables that depends on compile options */ 07011 #ifndef DBUG_OFF 07012 default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace", 07013 "d:t:i:o,/tmp/mysqld.trace"); 07014 #endif 07015 opt_error_log= IF_WIN(1,0); 07016 #ifdef HAVE_ROW_BASED_REPLICATION 07017 have_row_based_replication= SHOW_OPTION_YES; 07018 #else 07019 have_row_based_replication= SHOW_OPTION_NO; 07020 #endif 07021 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE 07022 have_ndbcluster=SHOW_OPTION_DISABLED; 07023 global_system_variables.ndb_index_stat_enable=TRUE; 07024 max_system_variables.ndb_index_stat_enable=TRUE; 07025 global_system_variables.ndb_index_stat_cache_entries=32; 07026 max_system_variables.ndb_index_stat_cache_entries=~0L; 07027 global_system_variables.ndb_index_stat_update_freq=20; 07028 max_system_variables.ndb_index_stat_update_freq=~0L; 07029 #else 07030 have_ndbcluster=SHOW_OPTION_NO; 07031 #endif 07032 #ifdef HAVE_OPENSSL 07033 have_openssl=SHOW_OPTION_YES; 07034 #else 07035 have_openssl=SHOW_OPTION_NO; 07036 #endif 07037 #ifdef HAVE_BROKEN_REALPATH 07038 have_symlink=SHOW_OPTION_NO; 07039 #else 07040 have_symlink=SHOW_OPTION_YES; 07041 #endif 07042 #ifdef HAVE_DLOPEN 07043 have_dlopen=SHOW_OPTION_YES; 07044 #else 07045 have_dlopen=SHOW_OPTION_NO; 07046 #endif 07047 #ifdef HAVE_QUERY_CACHE 07048 have_query_cache=SHOW_OPTION_YES; 07049 #else 07050 have_query_cache=SHOW_OPTION_NO; 07051 #endif 07052 #ifdef HAVE_SPATIAL 07053 have_geometry=SHOW_OPTION_YES; 07054 #else 07055 have_geometry=SHOW_OPTION_NO; 07056 #endif 07057 #ifdef HAVE_RTREE_KEYS 07058 have_rtree_keys=SHOW_OPTION_YES; 07059 #else 07060 have_rtree_keys=SHOW_OPTION_NO; 07061 #endif 07062 #ifdef HAVE_CRYPT 07063 have_crypt=SHOW_OPTION_YES; 07064 #else 07065 have_crypt=SHOW_OPTION_NO; 07066 #endif 07067 #ifdef HAVE_COMPRESS 07068 have_compress= SHOW_OPTION_YES; 07069 #else 07070 have_compress= SHOW_OPTION_NO; 07071 #endif 07072 #ifdef HAVE_LIBWRAP 07073 libwrapName= NullS; 07074 #endif 07075 #ifdef HAVE_OPENSSL 07076 des_key_file = 0; 07077 ssl_acceptor_fd= 0; 07078 #endif 07079 #ifdef HAVE_SMEM 07080 shared_memory_base_name= default_shared_memory_base_name; 07081 #endif 07082 #if !defined(my_pthread_setprio) && !defined(HAVE_PTHREAD_SETSCHEDPARAM) 07083 opt_specialflag |= SPECIAL_NO_PRIOR; 07084 #endif 07085 07086 #if defined(__WIN__) || defined(__NETWARE__) 07087 /* Allow Win32 and NetWare users to move MySQL anywhere */ 07088 { 07089 char prg_dev[LIBLEN]; 07090 my_path(prg_dev,my_progname,"mysql/bin"); 07091 strcat(prg_dev,"/../"); // Remove 'bin' to get base dir 07092 cleanup_dirname(mysql_home,prg_dev); 07093 } 07094 #else 07095 const char *tmpenv; 07096 if (!(tmpenv = getenv("MY_BASEDIR_VERSION"))) 07097 tmpenv = DEFAULT_MYSQL_HOME; 07098 (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); 07099 #endif 07100 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void MYSQLerror | ( | const char * | s | ) |
EMBEDDED_LIBRARY
Definition at line 1652 of file mysqld.cc.
References current_thd, ER, ER_PARSE_ERROR, ER_SYNTAX_ERROR, my_printf_error(), MYF, strcmp(), and yytext.
01653 { 01654 THD *thd=current_thd; 01655 char *yytext= (char*) thd->lex->tok_start; 01656 /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ 01657 if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) 01658 s=ER(ER_SYNTAX_ERROR); 01659 my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s, 01660 (yytext ? (char*) yytext : ""), 01661 thd->lex->yylineno); 01662 }
Here is the call graph for this function:

| static void network_init | ( | void | ) | [static] |
Definition at line 1481 of file mysqld.cc.
References bzero, DBUG_ENTER, DBUG_PRINT, DBUG_VOID_RETURN, ER, ER_IPSOCK_ERROR, error, FALSE, global_system_variables, INVALID_SOCKET, NTService::IsNT(), LINT_INIT, my_reinterpret_cast, my_umask, system_variables::net_buffer_length, NullS, set_ports(), sleep, SOCKET_EADDRINUSE, socket_errno, sql_perror(), sql_print_error(), sql_print_information(), sql_print_warning(), strlen(), strmov(), strxnmov(), TRUE, and unireg_abort().
Referenced by main().
01482 { 01483 struct sockaddr_in IPaddr; 01484 #ifdef HAVE_SYS_UN_H 01485 struct sockaddr_un UNIXaddr; 01486 #endif 01487 int arg=1; 01488 int ret; 01489 uint waited; 01490 uint this_wait; 01491 uint retry; 01492 DBUG_ENTER("network_init"); 01493 LINT_INIT(ret); 01494 01495 set_ports(); 01496 01497 if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap) 01498 { 01499 DBUG_PRINT("general",("IP Socket is %d",mysqld_port)); 01500 ip_sock = socket(AF_INET, SOCK_STREAM, 0); 01501 if (ip_sock == INVALID_SOCKET) 01502 { 01503 DBUG_PRINT("error",("Got error: %d from socket()",socket_errno)); 01504 sql_perror(ER(ER_IPSOCK_ERROR)); /* purecov: tested */ 01505 unireg_abort(1); /* purecov: tested */ 01506 } 01507 bzero((char*) &IPaddr, sizeof(IPaddr)); 01508 IPaddr.sin_family = AF_INET; 01509 IPaddr.sin_addr.s_addr = my_bind_addr; 01510 IPaddr.sin_port = (unsigned short) htons((unsigned short) mysqld_port); 01511 01512 #ifndef __WIN__ 01513 /* 01514 We should not use SO_REUSEADDR on windows as this would enable a 01515 user to open two mysqld servers with the same TCP/IP port. 01516 */ 01517 (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg)); 01518 #endif /* __WIN__ */ 01519 /* 01520 Sometimes the port is not released fast enough when stopping and 01521 restarting the server. This happens quite often with the test suite 01522 on busy Linux systems. Retry to bind the address at these intervals: 01523 Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ... 01524 Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ... 01525 Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#). 01526 */ 01527 for (waited= 0, retry= 1; ; retry++, waited+= this_wait) 01528 { 01529 if (((ret= bind(ip_sock, my_reinterpret_cast(struct sockaddr *) (&IPaddr), 01530 sizeof(IPaddr))) >= 0) || 01531 (socket_errno != SOCKET_EADDRINUSE) || 01532 (waited >= mysqld_port_timeout)) 01533 break; 01534 sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port); 01535 this_wait= retry * retry / 3 + 1; 01536 sleep(this_wait); 01537 } 01538 if (ret < 0) 01539 { 01540 DBUG_PRINT("error",("Got error: %d from bind",socket_errno)); 01541 sql_perror("Can't start server: Bind on TCP/IP port"); 01542 sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port); 01543 unireg_abort(1); 01544 } 01545 if (listen(ip_sock,(int) back_log) < 0) 01546 { 01547 sql_perror("Can't start server: listen() on TCP/IP port"); 01548 sql_print_error("listen() on TCP/IP failed with error %d", 01549 socket_errno); 01550 unireg_abort(1); 01551 } 01552 } 01553 01554 #ifdef __NT__ 01555 /* create named pipe */ 01556 if (Service.IsNT() && mysqld_unix_port[0] && !opt_bootstrap && 01557 opt_enable_named_pipe) 01558 { 01559 01560 pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */ 01561 strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\", 01562 mysqld_unix_port, NullS); 01563 bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity)); 01564 bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor)); 01565 if (!InitializeSecurityDescriptor(&sdPipeDescriptor, 01566 SECURITY_DESCRIPTOR_REVISION)) 01567 { 01568 sql_perror("Can't start server : Initialize security descriptor"); 01569 unireg_abort(1); 01570 } 01571 if (!SetSecurityDescriptorDacl(&sdPipeDescriptor, TRUE, NULL, FALSE)) 01572 { 01573 sql_perror("Can't start server : Set security descriptor"); 01574 unireg_abort(1); 01575 } 01576 saPipeSecurity.nLength = sizeof(SECURITY_ATTRIBUTES); 01577 saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor; 01578 saPipeSecurity.bInheritHandle = FALSE; 01579 if ((hPipe= CreateNamedPipe(pipe_name, 01580 PIPE_ACCESS_DUPLEX, 01581 PIPE_TYPE_BYTE | 01582 PIPE_READMODE_BYTE | 01583 PIPE_WAIT, 01584 PIPE_UNLIMITED_INSTANCES, 01585 (int) global_system_variables.net_buffer_length, 01586 (int) global_system_variables.net_buffer_length, 01587 NMPWAIT_USE_DEFAULT_WAIT, 01588 &saPipeSecurity)) == INVALID_HANDLE_VALUE) 01589 { 01590 LPVOID lpMsgBuf; 01591 int error=GetLastError(); 01592 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 01593 FORMAT_MESSAGE_FROM_SYSTEM, 01594 NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 01595 (LPTSTR) &lpMsgBuf, 0, NULL ); 01596 MessageBox(NULL, (LPTSTR) lpMsgBuf, "Error from CreateNamedPipe", 01597 MB_OK|MB_ICONINFORMATION); 01598 LocalFree(lpMsgBuf); 01599 unireg_abort(1); 01600 } 01601 } 01602 #endif 01603 01604 #if defined(HAVE_SYS_UN_H) 01605 /* 01606 ** Create the UNIX socket 01607 */ 01608 if (mysqld_unix_port[0] && !opt_bootstrap) 01609 { 01610 DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port)); 01611 01612 if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1)) 01613 { 01614 sql_print_error("The socket file path is too long (> %d): %s", 01615 sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port); 01616 unireg_abort(1); 01617 } 01618 if ((unix_sock= socket(AF_UNIX, SOCK_STREAM, 0)) < 0) 01619 { 01620 sql_perror("Can't start server : UNIX Socket "); /* purecov: inspected */ 01621 unireg_abort(1); /* purecov: inspected */ 01622 } 01623 bzero((char*) &UNIXaddr, sizeof(UNIXaddr)); 01624 UNIXaddr.sun_family = AF_UNIX; 01625 strmov(UNIXaddr.sun_path, mysqld_unix_port); 01626 (void) unlink(mysqld_unix_port); 01627 (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg, 01628 sizeof(arg)); 01629 umask(0); 01630 if (bind(unix_sock, my_reinterpret_cast(struct sockaddr *) (&UNIXaddr), 01631 sizeof(UNIXaddr)) < 0) 01632 { 01633 sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */ 01634 sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysqld_unix_port); 01635 unireg_abort(1); /* purecov: tested */ 01636 } 01637 umask(((~my_umask) & 0666)); 01638 #if defined(S_IFSOCK) && defined(SECURE_SOCKETS) 01639 (void) chmod(mysqld_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */ 01640 #endif 01641 if (listen(unix_sock,(int) back_log) < 0) 01642 sql_print_warning("listen() on Unix socket failed with error %d", 01643 socket_errno); 01644 } 01645 #endif 01646 DBUG_PRINT("info",("server started")); 01647 DBUG_VOID_RETURN; 01648 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void option_error_reporter | ( | enum loglevel | level, | |
| const char * | format, | |||
| ... | ||||
| ) | [static] |
Definition at line 7699 of file mysqld.cc.
References args, and vprint_msg_to_log().
Referenced by get_options().
07700 { 07701 va_list args; 07702 va_start(args, format); 07703 vprint_msg_to_log(level, format, args); 07704 va_end(args); 07705 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sig_handler print_signal_warning | ( | int | sig | ) |
Definition at line 1101 of file mysqld.cc.
References global_system_variables, system_variables::log_warnings, my_sigset, my_thread_id(), and sql_print_warning().
Referenced by init_signals().
01102 { 01103 if (global_system_variables.log_warnings) 01104 sql_print_warning("Got signal %d from thread %d", sig,my_thread_id()); 01105 #ifdef DONT_REMEMBER_SIGNAL 01106 my_sigset(sig,print_signal_warning); /* int. thread system calls */ 01107 #endif 01108 #if !defined(__WIN__) && !defined(__NETWARE__) 01109 if (sig == SIGALRM) 01110 alarm(2); /* reschedule alarm */ 01111 #endif 01112 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void print_version | ( | void | ) | [static] |
Definition at line 6817 of file mysqld.cc.
References MACHINE_TYPE, my_progname, MYSQL_COMPILATION_COMMENT, set_server_version(), and SYSTEM_TYPE.
06818 { 06819 set_server_version(); 06820 /* 06821 Note: the instance manager keys off the string 'Ver' so it can find the 06822 version from the output of 'mysqld --version', so don't change it! 06823 */ 06824 printf("%s Ver %s for %s on %s (%s)\n",my_progname, 06825 server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); 06826 }
Here is the call graph for this function:

| pthread_key | ( | THD * | , | |
| THR_THD | ||||
| ) |
| pthread_key | ( | MEM_ROOT ** | , | |
| THR_MALLOC | ||||
| ) |
| static bool read_init_file | ( | char * | file_name | ) | [static] |
Definition at line 3970 of file mysqld.cc.
References bootstrap(), DBUG_ENTER, DBUG_PRINT, my_fclose(), my_fopen(), MY_WME, and MYF.
Referenced by main().
03971 { 03972 FILE *file; 03973 DBUG_ENTER("read_init_file"); 03974 DBUG_PRINT("enter",("name: %s",file_name)); 03975 if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME)))) 03976 return(1); 03977 bootstrap(file); 03978 (void) my_fclose(file,MYF(MY_WME)); 03979 return 0; 03980 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void refresh_status | ( | THD * | thd | ) |
Definition at line 8041 of file mysqld.cc.
References add_to_status(), bzero, global_status_var, st_mysql_show_var::name, process_key_caches(), pthread_mutex_lock, pthread_mutex_unlock, reset_key_cache_counters(), and status_vars.
08042 { 08043 pthread_mutex_lock(&LOCK_status); 08044 08045 /* We must update the global status before cleaning up the thread */ 08046 add_to_status(&global_status_var, &thd->status_var); 08047 bzero((char*) &thd->status_var, sizeof(thd->status_var)); 08048 08049 for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++) 08050 { 08051 /* Note that SHOW_LONG_NOFLUSH variables are not reset */ 08052 if (ptr->type == SHOW_LONG) 08053 *(ulong*) ptr->value= 0; 08054 } 08055 /* Reset the counters of all key caches (default and named). */ 08056 process_key_caches(reset_key_cache_counters); 08057 pthread_mutex_unlock(&LOCK_status); 08058 08059 /* 08060 Set max_used_connections to the number of currently open 08061 connections. Lock LOCK_thread_count out of LOCK_status to avoid 08062 deadlocks. Status reset becomes not atomic, but status data is 08063 not exact anyway. 08064 */ 08065 pthread_mutex_lock(&LOCK_thread_count); 08066 max_used_connections= thread_count-delayed_insert_threads; 08067 pthread_mutex_unlock(&LOCK_thread_count); 08068 }
Here is the call graph for this function:

| static void set_effective_user | ( | struct passwd * | user_info | ) | [static] |
Definition at line 1449 of file mysqld.cc.
References DBUG_ASSERT, sql_perror(), and unireg_abort().
Referenced by main().
01450 { 01451 #if !defined(__WIN__) && !defined(__NETWARE__) 01452 DBUG_ASSERT(user_info != 0); 01453 if (setregid((gid_t)-1, user_info->pw_gid) == -1) 01454 { 01455 sql_perror("setregid"); 01456 unireg_abort(1); 01457 } 01458 if (setreuid((uid_t)-1, user_info->pw_uid) == -1) 01459 { 01460 sql_perror("setreuid"); 01461 unireg_abort(1); 01462 } 01463 #endif 01464 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void set_ports | ( | ) | [static] |
Definition at line 1339 of file mysqld.cc.
References atoi(), getenv(), MYSQL_PORT, and MYSQL_UNIX_ADDR.
Referenced by network_init(), and usage().
01340 { 01341 char *env; 01342 if (!mysqld_port && !opt_disable_networking) 01343 { // Get port if not from commandline 01344 struct servent *serv_ptr; 01345 mysqld_port= MYSQL_PORT; 01346 if ((serv_ptr= getservbyname("mysql", "tcp"))) 01347 mysqld_port= ntohs((u_short) serv_ptr->s_port); /* purecov: inspected */ 01348 if ((env = getenv("MYSQL_TCP_PORT"))) 01349 mysqld_port= (uint) atoi(env); /* purecov: inspected */ 01350 } 01351 if (!mysqld_unix_port) 01352 { 01353 #ifdef __WIN__ 01354 mysqld_unix_port= (char*) MYSQL_NAMEDPIPE; 01355 #else 01356 mysqld_unix_port= (char*) MYSQL_UNIX_ADDR; 01357 #endif 01358 if ((env = getenv("MYSQL_UNIX_PORT"))) 01359 mysqld_unix_port= env; /* purecov: inspected */ 01360 } 01361 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void set_root | ( | const char * | path | ) | [static] |
Definition at line 1469 of file mysqld.cc.
References my_setwd(), MYF, sql_perror(), and unireg_abort().
Referenced by get_options().
01470 { 01471 #if !defined(__WIN__) && !defined(__NETWARE__) 01472 if (chroot(path) == -1) 01473 { 01474 sql_perror("chroot"); 01475 unireg_abort(1); 01476 } 01477 my_setwd("/", MYF(0)); 01478 #endif 01479 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void set_server_version | ( | void | ) | [static] |
Definition at line 7812 of file mysqld.cc.
References MYSQL_SERVER_SUFFIX_STR, MYSQL_SERVER_VERSION, NullS, strmov(), strstr(), and strxmov().
Referenced by init_common_variables(), and print_version().
07813 { 07814 char *end= strxmov(server_version, MYSQL_SERVER_VERSION, 07815 MYSQL_SERVER_SUFFIX_STR, NullS); 07816 #ifdef EMBEDDED_LIBRARY 07817 end= strmov(end, "-embedded"); 07818 #endif 07819 #ifndef DBUG_OFF 07820 if (!strstr(MYSQL_SERVER_SUFFIX_STR, "-debug")) 07821 end= strmov(end, "-debug"); 07822 #endif 07823 if (opt_log || opt_update_log || opt_slow_log || opt_bin_log) 07824 strmov(end, "-log"); // This may slow down system 07825 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void set_user | ( | const char * | user, | |
| struct passwd * | user_info | |||
| ) | [static] |
Definition at line 1420 of file mysqld.cc.
References DBUG_ASSERT, FALSE, sql_perror(), TRUE, and unireg_abort().
01421 { 01422 #if !defined(__WIN__) && !defined(__NETWARE__) 01423 DBUG_ASSERT(user_info != 0); 01424 #ifdef HAVE_INITGROUPS 01425 /* 01426 We can get a SIGSEGV when calling initgroups() on some systems when NSS 01427 is configured to use LDAP and the server is statically linked. We set 01428 calling_initgroups as a flag to the SIGSEGV handler that is then used to 01429 output a specific message to help the user resolve this problem. 01430 */ 01431 calling_initgroups= TRUE; 01432 initgroups((char*) user, user_info->pw_gid); 01433 calling_initgroups=

