diff options
author | unknown <serg@serg.mysql.com> | 2002-04-02 14:59:40 +0000 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2002-04-02 14:59:40 +0000 |
commit | d2771b82a48ae4a0548daffba5961c5b345f019c (patch) | |
tree | ffe29ba0f45879ed83f8af080165d5ef573d7534 /sql/mysqld.cc | |
parent | 8bf63614de3e2f09559a952f9f2ad9b7af4ef794 (diff) | |
parent | b344dbc2da2811e6c31274c3aa3b3df56fa0bdf6 (diff) | |
download | mariadb-git-d2771b82a48ae4a0548daffba5961c5b345f019c.tar.gz |
Merge work:/home/bk/mysql into serg.mysql.com:/usr/home/serg/Abk/mysql
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6011ad210f0..1d108b3f4c2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -160,6 +160,7 @@ static SECURITY_DESCRIPTOR sdPipeDescriptor; static HANDLE hPipe = INVALID_HANDLE_VALUE; static pthread_cond_t COND_handler_count; static uint handler_count; +static bool opt_enable_named_pipe = 0; #endif #ifdef __WIN__ static bool opt_console=0,start_mode=0; @@ -474,7 +475,7 @@ static void close_connections(void) } } #ifdef __NT__ -if ( hPipe != INVALID_HANDLE_VALUE ) +if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe) { HANDLE temp; DBUG_PRINT( "quit", ("Closing named pipes") ); @@ -928,7 +929,8 @@ static void server_init(void) #ifdef __NT__ /* create named pipe */ - if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap) + if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap && + opt_enable_named_pipe) { sprintf( szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port ); ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) ); @@ -1662,7 +1664,7 @@ int main(int argc, char **argv) if (gethostname(glob_hostname,sizeof(glob_hostname)-4) < 0) strmov(glob_hostname,"mysql"); - strmov(pidfile_name,glob_hostname); + strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmov(strcend(pidfile_name,'.'),".pid"); // Add extension #ifndef DBUG_OFF strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS); @@ -2005,9 +2007,11 @@ The server will not act as a slave."); fflush(stdout); #ifdef __NT__ - if (hPipe == INVALID_HANDLE_VALUE && !have_tcpip) + if (hPipe == INVALID_HANDLE_VALUE && + (!have_tcpip || opt_disable_networking)) { - sql_print_error("TCP/IP or Named Pipes should be installed on NT OS"); + sql_print_error("TCP/IP or --enable-named-pipe should be configured on NT OS"); + unireg_abort(1); } else { @@ -2016,7 +2020,7 @@ The server will not act as a slave."); { pthread_t hThread; handler_count=0; - if ( hPipe != INVALID_HANDLE_VALUE ) + if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe) { handler_count++; if (pthread_create(&hThread,&connection_attrib, @@ -2509,9 +2513,9 @@ pthread_handler_decl(handle_connections_namedpipes,arg) fConnected = ConnectNamedPipe( hPipe, NULL ); if (abort_loop) break; - if ( !fConnected ) + if (!fConnected) fConnected = GetLastError() == ERROR_PIPE_CONNECTED; - if ( !fConnected ) + if (!fConnected) { CloseHandle( hPipe ); if ((hPipe = CreateNamedPipe(szPipeName, @@ -2549,7 +2553,7 @@ pthread_handler_decl(handle_connections_namedpipes,arg) continue; // We have to try again } - if ( !(thd = new THD)) + if (!(thd = new THD)) { DisconnectNamedPipe( hConnectedPipe ); CloseHandle( hConnectedPipe ); @@ -2633,6 +2637,7 @@ enum options { OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_SAFE_USER_CREATE, OPT_SQL_MODE, + OPT_HAVE_NAMED_PIPE, OPT_SLAVE_SKIP_ERRORS, OPT_LOCAL_INFILE }; @@ -2666,6 +2671,7 @@ static struct option long_options[] = { {"delay-key-write-for-all-tables", no_argument, 0, (int) OPT_DELAY_KEY_WRITE}, {"enable-locking", no_argument, 0, (int) OPT_ENABLE_LOCK}, + {"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE}, {"exit-info", optional_argument, 0, 'T'}, {"flush", no_argument, 0, (int) OPT_FLUSH}, #ifdef HAVE_GEMINI_DB @@ -3036,6 +3042,9 @@ struct show_var_st init_vars[]= { {"myisam_max_sort_file_size",(char*) &myisam_max_sort_file_size, SHOW_LONG}, {"myisam_recover_options", (char*) &myisam_recover_options, SHOW_LONG}, {"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size, SHOW_LONG}, +#ifdef __NT__ + {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_BOOL}, +#endif {"net_buffer_length", (char*) &net_buffer_length, SHOW_LONG}, {"net_read_timeout", (char*) &net_read_timeout, SHOW_LONG}, {"net_retry_count", (char*) &mysqld_net_retry_count, SHOW_LONG}, @@ -3248,6 +3257,7 @@ Starts the MySQL server\n"); --init-file=file Read SQL commands from this file at startup\n\ -L, --language=... Client error messages in given language. May be\n\ given as a full path\n\ + --local-infile=[1|0] Enable/disable LOAD DATA LOCAL INFILE\n\ -l, --log[=file] Log connections and queries to file\n\ --log-bin[=file] Log queries in new binary format (for replication)\n\ --log-bin-index=file File that holds the names for last binary log files\n\ @@ -3311,10 +3321,12 @@ Starts the MySQL server\n"); -W, --warnings Log some not critical warnings to the log file\n"); #ifdef __WIN__ puts("NT and Win32 specific options:\n\ - --console Don't remove the console window\n\ - --install Install mysqld as a service (NT)\n\ - --remove Remove mysqld from the service list (NT)\n\ - --standalone Dummy option to start as a standalone program (NT)\ + --console Don't remove the console window\n\ + --install Install the default service (NT)\n\ + --install-manual Install the default service started manually (NT)\n\ + --remove Remove the default service from the service list (NT)\n\ + --enable-named-pipe Enable the named pipe (NT)\n\ + --standalone Dummy option to start as a standalone program (NT)\ "); #ifdef USE_SYMDIR puts("--use-symbolic-links Enable symbolic link support"); @@ -3411,9 +3423,10 @@ static void set_options(void) opt_specialflag |= SPECIAL_NO_PRIOR; #endif - (void) strmov( default_charset, MYSQL_CHARSET); - (void) strmov( language, LANGUAGE); - (void) strmov( mysql_real_data_home, get_relative_path(DATADIR)); + (void) strmake(default_charset, MYSQL_CHARSET, sizeof(default_charset)-1); + (void) strmake(language, LANGUAGE, sizeof(language)-1); + (void) strmake(mysql_real_data_home, get_relative_path(DATADIR), + sizeof(mysql_real_data_home-1)); #ifdef __WIN__ /* Allow Win32 users to move MySQL anywhere */ { @@ -3424,9 +3437,9 @@ static void set_options(void) } #else const char *tmpenv; - if ( !(tmpenv = getenv("MY_BASEDIR_VERSION"))) + if (!(tmpenv = getenv("MY_BASEDIR_VERSION"))) tmpenv = DEFAULT_MYSQL_HOME; - (void) strmov( mysql_home, tmpenv ); + (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1); #endif #if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS ) @@ -3462,17 +3475,17 @@ static void get_options(int argc,char **argv) default_tx_isolation= ISO_SERIALIZABLE; break; case 'b': - strmov(mysql_home,optarg); + strmake(mysql_home,optarg,sizeof(mysql_home)-1); break; case 'l': opt_log=1; opt_logname=optarg; // Use hostname.log if null break; case 'h': - strmov(mysql_real_data_home,optarg); + strmake(mysql_real_data_home,optarg, sizeof(mysql_real_data_home)-1); break; case 'L': - strmov(language,optarg); + strmake(language, optarg, sizeof(language)-1); break; case 'n': opt_specialflag|= SPECIAL_NEW_FUNC; @@ -3806,11 +3819,16 @@ static void get_options(int argc,char **argv) } break; case (int) OPT_PID_FILE: - strmov(pidfile_name,optarg); + strmake(pidfile_name, optarg, sizeof(pidfile_name)-1); break; case (int) OPT_INIT_FILE: opt_init_file=optarg; break; + case (int) OPT_HAVE_NAMED_PIPE: +#if __NT__ + opt_enable_named_pipe=1; +#endif + break; #ifdef __WIN__ case (int) OPT_STANDALONE: /* Dummy option for NT */ break; @@ -3853,10 +3871,10 @@ static void get_options(int argc,char **argv) myisam_delay_key_write=0; break; case 'C': - strmov(default_charset,optarg); + strmake(default_charset, optarg, sizeof(default_charset)-1); break; case OPT_CHARSETS_DIR: - strmov(mysql_charsets_dir, optarg); + strmake(mysql_charsets_dir, optarg, sizeof(mysql_charsets_dir)-1); charsets_dir = mysql_charsets_dir; break; #include "sslopt-case.h" @@ -4086,16 +4104,17 @@ static void fix_paths(void) char buff[FN_REFLEN],*sharedir=get_relative_path(SHAREDIR); if (test_if_hard_path(sharedir)) - strmov(buff,sharedir); /* purecov: tested */ + strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */ else - strxmov(buff,mysql_home,sharedir,NullS); + strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS); convert_dirname(buff); (void) my_load_path(language,language,buff); /* If --character-sets-dir isn't given, use shared library dir */ if (charsets_dir != mysql_charsets_dir) { - strmov(strmov(mysql_charsets_dir,buff),CHARSET_DIR); + strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff, + CHARSET_DIR, NullS); charsets_dir=mysql_charsets_dir; } @@ -4103,7 +4122,7 @@ static void fix_paths(void) char *tmp= (char*) my_malloc(FN_REFLEN,MYF(MY_FAE)); if (tmp) { - strmov(tmp,mysql_tmpdir); + strmake(tmp, mysql_tmpdir, FN_REFLEN-1); mysql_tmpdir=tmp; convert_dirname(mysql_tmpdir); mysql_tmpdir=(char*) my_realloc(mysql_tmpdir,(uint) strlen(mysql_tmpdir)+1, |