Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
024f2e33
Commit
024f2e33
authored
Nov 17, 2001
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing registry service parameter code
parent
d493b2df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
428 deletions
+0
-428
sql/mysqld.cc
sql/mysqld.cc
+0
-428
No files found.
sql/mysqld.cc
View file @
024f2e33
...
...
@@ -389,9 +389,6 @@ static bool read_init_file(char *file_name);
#ifdef __NT__
static
pthread_handler_decl
(
handle_connections_namedpipes
,
arg
);
#endif
#ifdef __WIN__
static
int
get_service_parameters
();
#endif
extern
pthread_handler_decl
(
handle_slave
,
arg
);
#ifdef SET_RLIMIT_NOFILE
static
uint
set_maximum_open_files
(
uint
max_file_limit
);
...
...
@@ -1677,14 +1674,6 @@ int main(int argc, char **argv)
mysql_tmpdir
=
(
char
*
)
P_tmpdir
;
/* purecov: inspected */
set_options
();
#ifdef __WIN__
/* service parameters can be overwritten by options */
if
(
get_service_parameters
())
{
my_message
(
0
,
"Can't read MySQL service parameters"
,
MYF
(
0
)
);
exit
(
1
);
}
#endif
get_options
(
argc
,
argv
);
if
(
opt_log
||
opt_update_log
||
opt_slow_log
||
opt_bin_log
)
strcat
(
server_version
,
"-log"
);
...
...
@@ -4068,423 +4057,6 @@ static void get_options(int argc,char **argv)
}
#ifdef __WIN__
#ifndef KEY_SERVICE_PARAMETERS
#define KEY_SERVICE_PARAMETERS "SYSTEM\\CurrentControlSet\\Services\\MySql\\Parameters"
#endif
#define COPY_KEY_VALUE(value) if (copy_key_value(hParametersKey,&(value),lpszValue)) return 1
#define CHECK_KEY_TYPE(type,name) if ( type != dwKeyValueType ) { key_type_error(hParametersKey,name); return 1; }
#define SET_CHANGEABLE_VARVAL(varname) if (set_varval(hParametersKey,varname,szKeyValueName,dwKeyValueType,lpdwValue)) return 1;
static
void
key_type_error
(
HKEY
hParametersKey
,
const
char
*
szKeyValueName
)
{
TCHAR
szErrorMsg
[
512
];
RegCloseKey
(
hParametersKey
);
strxmov
(
szErrorMsg
,
TEXT
(
"Value
\"
"
),
szKeyValueName
,
TEXT
(
"
\"
of registry key
\"
"
KEY_SERVICE_PARAMETERS
"
\"
has wrong type
\n
"
),
NullS
);
fprintf
(
stderr
,
szErrorMsg
);
/* not unicode compatible */
}
static
bool
copy_key_value
(
HKEY
hParametersKey
,
char
**
var
,
const
char
*
value
)
{
if
(
!
(
*
var
=
my_strdup
(
value
,
MYF
(
MY_WME
))))
{
RegCloseKey
(
hParametersKey
);
fprintf
(
stderr
,
"Couldn't allocate memory for registry key value
\n
"
);
return
1
;
}
return
0
;
}
static
bool
set_varval
(
HKEY
hParametersKey
,
const
char
*
var
,
const
char
*
szKeyValueName
,
DWORD
dwKeyValueType
,
LPDWORD
lpdwValue
)
{
CHECK_KEY_TYPE
(
dwKeyValueType
,
szKeyValueName
);
if
(
set_changeable_varval
(
var
,
*
lpdwValue
,
changeable_vars
))
{
TCHAR
szErrorMsg
[
512
];
RegCloseKey
(
hParametersKey
);
strxmov
(
szErrorMsg
,
TEXT
(
"Value
\"
"
),
szKeyValueName
,
TEXT
(
"
\"
of registry key
\"
"
KEY_SERVICE_PARAMETERS
"
\"
is invalid
\n
"
),
NullS
);
fprintf
(
stderr
,
szErrorMsg
);
/* not unicode compatible */
return
1
;
}
return
0
;
}
static
int
get_service_parameters
()
{
DWORD
dwLastError
;
HKEY
hParametersKey
;
DWORD
dwIndex
;
TCHAR
szKeyValueName
[
256
];
DWORD
dwKeyValueName
;
DWORD
dwKeyValueType
;
BYTE
bKeyValueBuffer
[
512
];
DWORD
dwKeyValueBuffer
;
LPDWORD
lpdwValue
=
(
LPDWORD
)
&
bKeyValueBuffer
[
0
];
LPCTSTR
lpszValue
=
(
LPCTSTR
)
&
bKeyValueBuffer
[
0
];
/* open parameters of service */
dwLastError
=
(
DWORD
)
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
TEXT
(
KEY_SERVICE_PARAMETERS
),
0
,
KEY_READ
,
&
hParametersKey
);
if
(
dwLastError
==
ERROR_FILE_NOT_FOUND
)
/* no parameters available */
return
0
;
if
(
dwLastError
!=
ERROR_SUCCESS
)
{
fprintf
(
stderr
,
"Can't open registry key
\"
"
KEY_SERVICE_PARAMETERS
"
\"
for reading
\n
"
);
return
1
;
}
/* enumerate all values of key */
dwIndex
=
0
;
dwKeyValueName
=
sizeof
(
szKeyValueName
)
/
sizeof
(
TCHAR
);
dwKeyValueBuffer
=
sizeof
(
bKeyValueBuffer
);
while
(
(
dwLastError
=
(
DWORD
)
RegEnumValue
(
hParametersKey
,
dwIndex
,
szKeyValueName
,
&
dwKeyValueName
,
NULL
,
&
dwKeyValueType
,
&
bKeyValueBuffer
[
0
],
&
dwKeyValueBuffer
))
!=
ERROR_NO_MORE_ITEMS
)
{
/* check if error occured */
if
(
dwLastError
!=
ERROR_SUCCESS
)
{
RegCloseKey
(
hParametersKey
);
fprintf
(
stderr
,
"Can't enumerate values of registry key
\"
"
KEY_SERVICE_PARAMETERS
"
\"\n
"
);
return
1
;
}
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BaseDir"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
strmov
(
mysql_home
,
lpszValue
);
/* not unicode compatible */
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BindAddress"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
my_bind_addr
=
(
ulong
)
inet_addr
(
lpszValue
);
if
(
my_bind_addr
==
(
ulong
)
INADDR_NONE
)
{
struct
hostent
*
ent
;
if
(
!
(
*
lpszValue
)
)
{
char
szHostName
[
256
];
if
(
gethostname
(
szHostName
,
sizeof
(
szHostName
))
==
SOCKET_ERROR
)
{
RegCloseKey
(
hParametersKey
);
fprintf
(
stderr
,
"Can't get my own hostname
\n
"
);
return
1
;
}
ent
=
gethostbyname
(
szHostName
);
}
else
ent
=
gethostbyname
(
lpszValue
);
if
(
!
ent
)
{
RegCloseKey
(
hParametersKey
);
fprintf
(
stderr
,
"Can't resolve hostname!
\n
"
);
return
1
;
}
my_bind_addr
=
(
ulong
)
((
in_addr
*
)
ent
->
h_addr_list
[
0
])
->
s_addr
;
}
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BigTables"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
*
lpdwValue
)
thd_startup_options
|=
OPTION_BIG_TABLES
;
else
thd_startup_options
&=
~
((
ulong
)
OPTION_BIG_TABLES
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"DataDir"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
strmov
(
mysql_real_data_home
,
lpszValue
);
/* not unicode compatible */
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"Locking"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
my_disable_locking
=
!
(
*
lpdwValue
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LogFile"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
opt_log
=
1
;
COPY_KEY_VALUE
(
opt_logname
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"UpdateLogFile"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
opt_update_log
=
1
;
COPY_KEY_VALUE
(
opt_update_logname
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BinaryLogFile"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
opt_bin_log
=
1
;
COPY_KEY_VALUE
(
opt_bin_logname
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BinaryLogIndexFile"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
opt_bin_log
=
1
;
COPY_KEY_VALUE
(
opt_binlog_index_name
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ISAMLogFile"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
COPY_KEY_VALUE
(
myisam_log_filename
);
opt_myisam_log
=
1
;
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LongLogFormat"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
*
lpdwValue
)
opt_specialflag
|=
SPECIAL_LONG_LOG_FORMAT
;
else
opt_specialflag
&=
~
((
ulong
)
SPECIAL_LONG_LOG_FORMAT
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LowPriorityUpdates"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
*
lpdwValue
)
{
thd_startup_options
|=
OPTION_LOW_PRIORITY_UPDATES
;
low_priority_updates
=
1
;
}
else
{
thd_startup_options
&=
~
((
ulong
)
OPTION_LOW_PRIORITY_UPDATES
);
low_priority_updates
=
0
;
}
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"Port"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
mysql_port
=
(
unsigned
int
)
*
lpdwValue
;
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"OldProtocol"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
protocol_version
=
*
lpdwValue
?
PROTOCOL_VERSION
-
1
:
PROTOCOL_VERSION
;
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"HostnameResolving"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
!*
lpdwValue
)
opt_specialflag
|=
SPECIAL_NO_RESOLVE
;
else
opt_specialflag
&=
~
((
ulong
)
SPECIAL_NO_RESOLVE
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"Networking"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
opt_disable_networking
=
!
(
*
lpdwValue
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ShowDatabase"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
opt_skip_show_db
=
!
(
*
lpdwValue
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"HostnameCaching"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
!*
lpdwValue
)
opt_specialflag
|=
SPECIAL_NO_HOST_CACHE
;
else
opt_specialflag
&=
~
((
ulong
)
SPECIAL_NO_HOST_CACHE
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ThreadPriority"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
if
(
!
(
*
lpdwValue
)
)
opt_specialflag
|=
SPECIAL_NO_PRIOR
;
else
opt_specialflag
&=
~
((
ulong
)
SPECIAL_NO_PRIOR
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"NamedPipe"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
COPY_KEY_VALUE
(
mysql_unix_port
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"TempDir"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_SZ
,
szKeyValueName
);
COPY_KEY_VALUE
(
mysql_tmpdir
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"FlushTables"
))
==
0
)
{
CHECK_KEY_TYPE
(
REG_DWORD
,
szKeyValueName
);
#ifdef HAVE_NISAM
nisam_flush
=
1
;
#endif
myisam_flush
=
*
lpdwValue
?
1
:
0
;
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"BackLog"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"back_log"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ConnectTimeout"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"connect_timeout"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"JoinBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"join_buffer"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"KeyBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"key_buffer"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LongQueryTime"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"long_query_time"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxAllowedPacket"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_allowed_packet"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxConnections"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_connections"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxUserConnections"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_user_connections"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxConnectErrors"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_connect_errors"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxInsertDelayedThreads"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_delayed_threads"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxJoinSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_join_size"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxSortLength"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_sort_length"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"NetBufferLength"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"net_buffer_length"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"RecordBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"record_buffer"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"SortBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"sort_buffer"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"TableCacheSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"table_cache"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"TmpTableSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"tmp_table_size"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ThreadStackSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"thread_stack"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"WaitTimeout"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"wait_timeout"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"DelayedInsertTimeout"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"delayed_insert_timeout"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"DelayedInsertLimit"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"delayed_insert_limit"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"DelayedQueueSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"delayed_queue_size"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"FlushTime"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"flush_time"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"InteractiveTimeout"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"interactive_timeout"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LowerCaseTableNames"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"lower_case_table_names"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxHeapTableSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_heap_table_size"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxTmpTables"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_tmp_tables"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"MaxWriteLockCount"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"max_write_lock_count"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"NetRetryCount"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"net_retry_count"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"QueryBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"query_buffer_size"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"ThreadConcurrency"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"thread_concurrency"
);
}
else
{
TCHAR
szErrorMsg
[
512
];
RegCloseKey
(
hParametersKey
);
lstrcpy
(
szErrorMsg
,
TEXT
(
"Value
\"
"
)
);
lstrcat
(
szErrorMsg
,
szKeyValueName
);
lstrcat
(
szErrorMsg
,
TEXT
(
"
\"
of registry key
\"
"
KEY_SERVICE_PARAMETERS
"
\"
is not defined by MySQL
\n
"
)
);
fprintf
(
stderr
,
szErrorMsg
);
/* not unicode compatible */
return
1
;
}
dwIndex
++
;
dwKeyValueName
=
sizeof
(
szKeyValueName
)
/
sizeof
(
TCHAR
);
dwKeyValueBuffer
=
sizeof
(
bKeyValueBuffer
);
}
RegCloseKey
(
hParametersKey
);
/* paths are fixed by method get_options() */
return
0
;
}
#endif
static
char
*
get_relative_path
(
const
char
*
path
)
{
if
(
test_if_hard_path
(
path
)
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment