summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2002-03-25 18:10:36 +0200
committermonty@hundin.mysql.fi <>2002-03-25 18:10:36 +0200
commit93948645e75368ef501cfd85921d6048ffa56e13 (patch)
tree9029773913d45933f73eb828a2eb8b9750e3bd4e /sql
parent9a33ac709d9ae7ea6817b1c6f13e550ef0a3f14d (diff)
downloadmariadb-git-93948645e75368ef501cfd85921d6048ffa56e13.tar.gz
Fixes for --enable-named-pipe
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc50
1 files changed, 22 insertions, 28 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 16d6838007c..d0824b1ec53 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -155,6 +155,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;
@@ -220,9 +221,6 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
opt_myisam_log=0,
opt_large_files=sizeof(my_off_t) > 4;
-#ifdef __NT__
-static bool opt_enable_named_pipe = 0;
-#endif
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0,
opt_safe_user_create=0;
FILE *bootstrap_file=0;
@@ -472,7 +470,7 @@ static void close_connections(void)
}
}
#ifdef __NT__
-if ( hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe )
+if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{
HANDLE temp;
DBUG_PRINT( "quit", ("Closing named pipes") );
@@ -926,8 +924,8 @@ static void server_init(void)
#ifdef __NT__
/* create named pipe */
- if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap
- && opt_enable_named_pipe)
+ if (Service.IsNT() && mysql_unix_port[0] && !opt_bootstrap &&
+ opt_enable_named_pipe)
{
sprintf( szPipeName, "\\\\.\\pipe\\%s", mysql_unix_port );
ZeroMemory( &saPipeSecurity, sizeof(saPipeSecurity) );
@@ -2004,10 +2002,10 @@ The server will not act as a slave.");
fflush(stdout);
#ifdef __NT__
- if ((hPipe == INVALID_HANDLE_VALUE && !have_tcpip ) ||
- (hPipe == INVALID_HANDLE_VALUE && opt_disable_networking) )
+ if (hPipe == INVALID_HANDLE_VALUE &&
+ (!have_tcpip || opt_disable_networking)
{
- sql_print_error("TCP/IP or enable-named-pipe should be configured on NT OS");
+ sql_print_error("TCP/IP or --enable-named-pipe should be configured on NT OS");
unireg_abort(1);
}
else
@@ -2017,7 +2015,7 @@ The server will not act as a slave.");
{
pthread_t hThread;
handler_count=0;
- if ( hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe )
+ if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{
handler_count++;
if (pthread_create(&hThread,&connection_attrib,
@@ -2510,9 +2508,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,
@@ -2550,7 +2548,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 );
@@ -2634,9 +2632,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,
-#ifdef __NT__
- OPT_HAVE_NAMED_PIPE,
-#endif
+ OPT_HAVE_NAMED_PIPE,
OPT_SLAVE_SKIP_ERRORS, OPT_LOCAL_INFILE
};
@@ -2670,6 +2666,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
@@ -2766,9 +2763,6 @@ static struct option long_options[] = {
{"skip-host-cache", no_argument, 0, (int) OPT_SKIP_HOST_CACHE},
{"skip-name-resolve", no_argument, 0, (int) OPT_SKIP_RESOLVE},
{"skip-networking", no_argument, 0, (int) OPT_SKIP_NETWORKING},
-#ifdef __NT__
- {"enable-named-pipe", no_argument, 0, (int) OPT_HAVE_NAMED_PIPE},
-#endif
{"skip-new", no_argument, 0, (int) OPT_SKIP_NEW},
{"skip-safemalloc", no_argument, 0, (int) OPT_SKIP_SAFEMALLOC},
{"skip-show-database", no_argument, 0, (int) OPT_SKIP_SHOW_DB},
@@ -3043,6 +3037,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},
@@ -3059,9 +3056,6 @@ struct show_var_st init_vars[]= {
{"slave_net_timeout", (char*) &slave_net_timeout, SHOW_LONG},
{"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
-#ifdef __NT__
- {"enable_named_pipe", (char*) &opt_enable_named_pipe, SHOW_BOOL},
-#endif
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
{"slow_launch_time", (char*) &slow_launch_time, SHOW_LONG},
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
@@ -3437,7 +3431,7 @@ 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 );
#endif
@@ -3770,11 +3764,6 @@ static void get_options(int argc,char **argv)
opt_disable_networking=1;
mysql_port=0;
break;
-#ifdef __NT__
- case (int) OPT_HAVE_NAMED_PIPE:
- opt_enable_named_pipe=1;
- break;
-#endif
case (int) OPT_SKIP_SHOW_DB:
opt_skip_show_db=1;
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
@@ -3829,6 +3818,11 @@ static void get_options(int argc,char **argv)
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;