mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Make possible to use clang on Windows (clang-cl)
-DWITH_ASAN can be used as well now, on x64 Fix many clang-cl warnings.
This commit is contained in:
@ -77,14 +77,14 @@ void dump_single_process(DWORD pid)
|
||||
process= OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
|
||||
if (!process)
|
||||
{
|
||||
fprintf(stderr, "safe_kill : cannot open process pid=%u to create dump, last error %u\n",
|
||||
fprintf(stderr, "safe_kill : cannot open process pid=%lu to create dump, last error %lu\n",
|
||||
pid, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (QueryFullProcessImageName(process, 0, path, &size) == 0)
|
||||
{
|
||||
fprintf(stderr, "safe_kill : cannot read process path for pid %u, last error %u\n",
|
||||
fprintf(stderr, "safe_kill : cannot read process path for pid %lu, last error %lu\n",
|
||||
pid, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
@ -116,17 +116,17 @@ void dump_single_process(DWORD pid)
|
||||
{
|
||||
if (!GetTempFileName(".", filename, 0, tmpname))
|
||||
{
|
||||
fprintf(stderr, "GetTempFileName failed, last error %u", GetLastError());
|
||||
fprintf(stderr, "GetTempFileName failed, last error %lu", GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
strncat(tmpname, ".dmp", sizeof(tmpname));
|
||||
strncat_s(tmpname, ".dmp", sizeof(tmpname));
|
||||
filename= tmpname;
|
||||
}
|
||||
|
||||
|
||||
if (!GetCurrentDirectory(MAX_PATH, working_dir))
|
||||
{
|
||||
fprintf(stderr, "GetCurrentDirectory failed, last error %u", GetLastError());
|
||||
fprintf(stderr, "GetCurrentDirectory failed, last error %lu", GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -135,14 +135,14 @@ void dump_single_process(DWORD pid)
|
||||
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
|
||||
fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %lu\n",
|
||||
filename, working_dir, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0, 0, 0))
|
||||
{
|
||||
fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
|
||||
fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %lu\n",
|
||||
filename, working_dir, GetLastError());
|
||||
goto exit;
|
||||
}
|
||||
@ -214,7 +214,7 @@ int main(int argc, const char** argv )
|
||||
|
||||
if (!GetExitCodeProcess(process,&exit_code))
|
||||
{
|
||||
fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n",
|
||||
fprintf(stderr, "GetExitCodeProcess failed, pid= %lu, err= %lu\n",
|
||||
pid, GetLastError());
|
||||
exit(1);
|
||||
}
|
||||
@ -232,7 +232,7 @@ int main(int argc, const char** argv )
|
||||
Sleep(100);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n",
|
||||
fprintf(stderr, "Failed to open shutdown_event '%s', error: %lu\n",
|
||||
safe_process_name, GetLastError());
|
||||
exit(3);
|
||||
}
|
||||
@ -240,7 +240,7 @@ int main(int argc, const char** argv )
|
||||
|
||||
if(SetEvent(shutdown_event) == 0)
|
||||
{
|
||||
fprintf(stderr, "Failed to signal shutdown_event '%s', error: %d\n",
|
||||
fprintf(stderr, "Failed to signal shutdown_event '%s', error: %lu\n",
|
||||
safe_process_name, GetLastError());
|
||||
CloseHandle(shutdown_event);
|
||||
exit(4);
|
||||
|
@ -75,7 +75,7 @@ static void message(const char* fmt, ...)
|
||||
|
||||
static void die(const char* fmt, ...)
|
||||
{
|
||||
DWORD last_err= GetLastError();
|
||||
int last_err= GetLastError();
|
||||
va_list args;
|
||||
fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
|
||||
va_start(args, fmt);
|
||||
@ -106,7 +106,7 @@ static void die(const char* fmt, ...)
|
||||
DWORD get_parent_pid(DWORD pid)
|
||||
{
|
||||
HANDLE snapshot;
|
||||
DWORD parent_pid= -1;
|
||||
DWORD parent_pid= 0;
|
||||
PROCESSENTRY32 pe32;
|
||||
pe32.dwSize= sizeof(PROCESSENTRY32);
|
||||
|
||||
@ -127,7 +127,7 @@ DWORD get_parent_pid(DWORD pid)
|
||||
} while(Process32Next( snapshot, &pe32));
|
||||
CloseHandle(snapshot);
|
||||
|
||||
if (parent_pid == -1)
|
||||
if (parent_pid == 0)
|
||||
die("Could not find parent pid");
|
||||
|
||||
return parent_pid;
|
||||
@ -163,7 +163,7 @@ int main(int argc, const char** argv )
|
||||
PROCESS_INFORMATION process_info= {0};
|
||||
BOOL nocore= FALSE;
|
||||
|
||||
sprintf(safe_process_name, "safe_process[%d]", pid);
|
||||
sprintf(safe_process_name, "safe_process[%lu]", pid);
|
||||
|
||||
/* Create an event for the signal handler */
|
||||
if ((shutdown_event=
|
||||
@ -298,7 +298,7 @@ int main(int argc, const char** argv )
|
||||
BOOL process_created= FALSE;
|
||||
BOOL jobobject_assigned= FALSE;
|
||||
|
||||
for (int i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
|
||||
for (size_t i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
|
||||
{
|
||||
process_created= CreateProcess(NULL, (LPSTR)child_args,
|
||||
NULL,
|
||||
|
Reference in New Issue
Block a user