diff options
author | Magne Mahre <magne.mahre@oracle.com> | 2011-03-01 13:03:31 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@oracle.com> | 2011-03-01 13:03:31 +0100 |
commit | c4715a807690d68c5dfe3f8e36e2ac916d9f37a5 (patch) | |
tree | 4d9a20cb9667d0482370dd73a32cf5c74f73289e /mysys/my_init.c | |
parent | 901226b66a73c8d5a3d2de9dd12c0e810c316728 (diff) | |
download | mariadb-git-c4715a807690d68c5dfe3f8e36e2ac916d9f37a5.tar.gz |
Bug#11765237 - 58179: CANNOT START MYSQLD WITH APP VERIFIER
Bug#11763065 - 55730: KILL_SERVER() CALLS SETEVENT ON A NULL
HANDLE, SMEM_EVENT_CONNECT_REQUEST
Application Verifier is a Microsoft tool used for
detecting certain classes of programming errors.
In particular, MS Windows OS resource usage is
monitored for wrong usage (handles, thread local
storage, critical sections, ...)
In MySQL 5.5.x, an error was introduced where an
object on thread local storage was used before the
TLS and the object was created.
The fix has been to move the mysys initialization
to an earlier stage in the boot process when built for
Windows. For non-win builds, the init already happens
early.
Some un-tangling of calls to my_init(), my_basic_init()
and my_thread_global_init() was done. There is no
longer a need to do init in steps, so the full my_init()
is called instead of my_init_basic().
In addition, Bug#11763065 was fixed. The event handle
'smem_event_connect_request' is only created if
'opt_enable_shared_memory' is set. When killing the
server, an event was flagged on the handle
unconditionally. Added a test, so it will only be
flagged if created.
include/my_pthread.h:
my_thread_basic_global_init is no longer
necessary, and the my_thread_basic_global_reinit
function is renamed to reflect that it now
reinits mutexes and condvars originating from
my_thread_global_init
mysys/my_thr_init.c:
Reorganized code.
Diffstat (limited to 'mysys/my_init.c')
-rw-r--r-- | mysys/my_init.c | 64 |
1 files changed, 17 insertions, 47 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index 9a17d0d6916..5534dc07209 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,8 +37,6 @@ static my_bool win32_init_tcp_ip(); #define SCALE_USEC 10000 my_bool my_init_done= 0; -/** True if @c my_basic_init() has been called. */ -my_bool my_basic_init_done= 0; uint mysys_usage_id= 0; /* Incremented for each my_init() */ ulong my_thread_stack_size= 65536; @@ -56,23 +54,26 @@ static ulong atoi_octal(const char *str) MYSQL_FILE *mysql_stdin= NULL; static MYSQL_FILE instrumented_stdin; -/** - Perform a limited initialisation of mysys. - This initialisation is sufficient to: - - allocate memory, - - read configuration files, - - parse command lines arguments. - To complete the mysys initialisation, - call my_init(). - @return 0 on success + +/* + Init my_sys functions and my_sys variabels + + SYNOPSIS + my_init() + + RETURN + 0 ok + 1 Couldn't initialize environment */ -my_bool my_basic_init(void) + +my_bool my_init(void) { - char * str; + char *str; - if (my_basic_init_done) + if (my_init_done) return 0; - my_basic_init_done= 1; + + my_init_done= 1; mysys_usage_id++; my_umask= 0660; /* Default umask for new files */ @@ -105,41 +106,11 @@ my_bool my_basic_init(void) #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - if (my_thread_basic_global_init()) - return 1; /* $HOME is needed early to parse configuration files located in ~/ */ if ((home_dir= getenv("HOME")) != 0) home_dir= intern_filename(home_dir_buff, home_dir); - return 0; -} - - -/* - Init my_sys functions and my_sys variabels - - SYNOPSIS - my_init() - - RETURN - 0 ok - 1 Couldn't initialize environment -*/ - -my_bool my_init(void) -{ - if (my_init_done) - return 0; - - my_init_done= 1; - - if (my_basic_init()) - return 1; - - if (my_thread_global_init()) - return 1; - { DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); @@ -256,7 +227,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", #endif /* __WIN__ */ my_init_done=0; - my_basic_init_done= 0; } /* my_end */ |