mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
alot of formatting changes that came out of JimW's review
This commit is contained in:
@ -25,7 +25,6 @@ void IMService::Run()
|
||||
ReportStatus((DWORD)SERVICE_START_PENDING);
|
||||
|
||||
// init goes here
|
||||
|
||||
ReportStatus((DWORD)SERVICE_RUNNING);
|
||||
|
||||
// wait for main loop to terminate
|
||||
|
@ -4,8 +4,10 @@
|
||||
|
||||
static WindowsService *gService;
|
||||
|
||||
WindowsService::WindowsService(void)
|
||||
: statusCheckpoint(0), serviceName(NULL), inited(false),
|
||||
WindowsService::WindowsService(void) :
|
||||
statusCheckpoint(0),
|
||||
serviceName(NULL),
|
||||
inited(false),
|
||||
dwAcceptedControls(SERVICE_ACCEPT_STOP)
|
||||
{
|
||||
gService= this;
|
||||
@ -34,9 +36,10 @@ BOOL WindowsService::Install()
|
||||
return false;
|
||||
|
||||
newService= CreateService(scm, serviceName, displayName,
|
||||
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START,
|
||||
SERVICE_ERROR_NORMAL, szFilePath,
|
||||
NULL, NULL, NULL, username, password);
|
||||
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
|
||||
szFilePath, NULL, NULL, NULL, username,
|
||||
password);
|
||||
|
||||
if (newService)
|
||||
{
|
||||
@ -109,7 +112,8 @@ void WindowsService::SetAcceptedControls(DWORD acceptedControls)
|
||||
}
|
||||
|
||||
|
||||
BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint, DWORD dwError)
|
||||
BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint,
|
||||
DWORD dwError)
|
||||
{
|
||||
if(debugging) return TRUE;
|
||||
|
||||
@ -119,7 +123,8 @@ BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint, DWORD dwEr
|
||||
status.dwControlsAccepted= dwAcceptedControls;
|
||||
|
||||
status.dwCurrentState= currentState;
|
||||
status.dwWin32ExitCode = dwError != 0 ? ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR;
|
||||
status.dwWin32ExitCode= dwError != 0 ?
|
||||
ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR;
|
||||
status.dwWaitHint= waitHint;
|
||||
status.dwServiceSpecificExitCode= dwError;
|
||||
|
||||
|
@ -377,7 +377,8 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
|
||||
BOOL bSuccess= FALSE;
|
||||
|
||||
BOOL bDup= DuplicateHandle(GetCurrentProcess(),
|
||||
hProcess, GetCurrentProcess(), &hProcessDup, PROCESS_ALL_ACCESS, FALSE, 0);
|
||||
hProcess, GetCurrentProcess(), &hProcessDup,
|
||||
PROCESS_ALL_ACCESS, FALSE, 0);
|
||||
|
||||
// Detect the special case where the process is
|
||||
// already dead...
|
||||
@ -389,15 +390,14 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
|
||||
pfnExitProc= GetProcAddress(hKernel, "ExitProcess");
|
||||
|
||||
hRT= CreateRemoteThread((bDup) ? hProcessDup : hProcess, NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)pfnExitProc, (PVOID)uExitCode, 0, &dwTID);
|
||||
(LPTHREAD_START_ROUTINE)pfnExitProc,
|
||||
(PVOID)uExitCode, 0, &dwTID);
|
||||
|
||||
if (hRT == NULL)
|
||||
dwErr= GetLastError();
|
||||
}
|
||||
else
|
||||
{
|
||||
dwErr= ERROR_PROCESS_ABORTED;
|
||||
}
|
||||
|
||||
if (hRT)
|
||||
{
|
||||
|
@ -256,8 +256,8 @@ int Instance_map::load()
|
||||
else
|
||||
argv_options[1]= '\0';
|
||||
|
||||
if (my_search_option_files(Options::config_file, &argc, (char ***) &argv, &args_used,
|
||||
process_option, (void*) this) ||
|
||||
if (my_search_option_files(Options::config_file, &argc, (char ***) &argv,
|
||||
&args_used, process_option, (void*) this) ||
|
||||
complete_initialization())
|
||||
return 1;
|
||||
|
||||
|
@ -66,8 +66,8 @@ Listener_thread::Listener_thread(const Listener_thread_args &args) :
|
||||
args.instance_map)
|
||||
,total_connection_count(0)
|
||||
,thread_info(pthread_self())
|
||||
,num_sockets(0)
|
||||
{
|
||||
num_sockets= 0;
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ void Listener_thread::run()
|
||||
n= max(n, sockets[i]);
|
||||
n++;
|
||||
|
||||
while (thread_registry.is_shutdown() == false)
|
||||
while (!thread_registry.is_shutdown())
|
||||
{
|
||||
fd_set read_fds_arg= read_fds;
|
||||
|
||||
@ -149,8 +149,8 @@ void Listener_thread::run()
|
||||
/* accept may return -1 (failure or spurious wakeup) */
|
||||
if (client_fd >= 0) // connection established
|
||||
{
|
||||
Vio *vio = vio_new(client_fd, socket_index==0?VIO_TYPE_SOCKET:VIO_TYPE_TCPIP,
|
||||
socket_index==0?1:0);
|
||||
Vio *vio = vio_new(client_fd, socket_index==0?VIO_TYPE_SOCKET:
|
||||
VIO_TYPE_TCPIP, socket_index==0?1:0);
|
||||
if (vio != 0)
|
||||
handle_new_mysql_connection(vio);
|
||||
else
|
||||
@ -179,6 +179,10 @@ void Listener_thread::run()
|
||||
return;
|
||||
|
||||
err:
|
||||
// we have to close the ip sockets in case of error
|
||||
for (int i= 0; i < num_sockets; i++)
|
||||
close(sockets[i]);
|
||||
|
||||
thread_registry.unregister_thread(&thread_info);
|
||||
thread_registry.request_shutdown();
|
||||
my_thread_end();
|
||||
|
@ -252,14 +252,15 @@ int Options::load(int argc, char **argv)
|
||||
Options::first_option= argv[1];
|
||||
}
|
||||
|
||||
// we were not given a config file on the command line so we
|
||||
// set have to construct a new argv array
|
||||
/*
|
||||
we were not given a config file on the command line so we
|
||||
default to our compiled in default
|
||||
*/
|
||||
if (config_file == NULL)
|
||||
{
|
||||
#ifdef __WIN__
|
||||
::GetModuleFileName(NULL, default_config_file, sizeof(default_config_file));
|
||||
char *filename = strstr(default_config_file, "mysqlmanager.exe");
|
||||
strcpy(filename, "my.ini");
|
||||
::GetModuleFileName(NULL, default_config_file, sizeof(default_config_file)); char *filename= strrchr(default_config_file, "\\");
|
||||
strcpy(filename, "\\my.ini");
|
||||
#endif
|
||||
config_file= default_config_file;
|
||||
}
|
||||
@ -281,7 +282,6 @@ void Options::cleanup()
|
||||
{
|
||||
/* free_defaults returns nothing */
|
||||
free_defaults(Options::saved_argv);
|
||||
|
||||
#ifdef __WIN__
|
||||
free((char*)default_password_file_name);
|
||||
#endif
|
||||
@ -304,8 +304,10 @@ char* change_extension(const char *src, const char *newext)
|
||||
|
||||
void Options::setup_windows_defaults(const char *progname)
|
||||
{
|
||||
Options::password_file_name = default_password_file_name = change_extension(progname, "passwd");
|
||||
Options::log_file_name = default_log_file_name = change_extension(progname, "log");
|
||||
Options::password_file_name= default_password_file_name =
|
||||
change_extension(progname, "passwd");
|
||||
Options::log_file_name= default_log_file_name =
|
||||
change_extension(progname, "log");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user