diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-02-15 14:16:49 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-02-15 14:16:49 +0300 |
commit | 6c32fa735717e91a1de369bc8fe7d73ef9ff224a (patch) | |
tree | 2c79edc43ff38be4c2de71e4fee4285523f5c08c /mysys | |
parent | 0ec868ca0e2d3ea60835d7c8fa7b951182b497b1 (diff) | |
parent | 2fa7509bf07761e041c5702f3b833b7fefb3ec61 (diff) | |
download | mariadb-git-6c32fa735717e91a1de369bc8fe7d73ef9ff224a.tar.gz |
Manual merge from mysql-next-mr.
Conflicts:
- sql/log_event.cc
- sql/sql_class.h
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_init.c | 35 | ||||
-rw-r--r-- | mysys/my_thr_init.c | 47 |
2 files changed, 42 insertions, 40 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index 31adc5ed99e..a3e53fdaae1 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -74,6 +74,8 @@ static MYSQL_FILE instrumented_stdin; */ my_bool my_basic_init(void) { + char * str; + if (my_basic_init_done) return 0; my_basic_init_done= 1; @@ -82,6 +84,19 @@ my_bool my_basic_init(void) my_umask= 0660; /* Default umask for new files */ my_umask_dir= 0700; /* Default umask for new directories */ +#ifndef VMS + /* Default creation of new files */ + if ((str= getenv("UMASK")) != 0) + my_umask= (int) (atoi_octal(str) | 0600); + /* Default creation of new dir's */ + if ((str= getenv("UMASK_DIR")) != 0) + my_umask_dir= (int) (atoi_octal(str) | 0700); +#endif + + /* $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); + init_glob_errs(); instrumented_stdin.m_file= stdin; @@ -124,7 +139,6 @@ my_bool my_basic_init(void) my_bool my_init(void) { - char * str; if (my_init_done) return 0; my_init_done= 1; @@ -142,24 +156,11 @@ my_bool my_init(void) { DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); - if (!home_dir) - { /* Don't initialize twice */ - my_win_init(); - if ((home_dir=getenv("HOME")) != 0) - home_dir=intern_filename(home_dir_buff,home_dir); -#ifndef VMS - /* Default creation of new files */ - if ((str=getenv("UMASK")) != 0) - my_umask=(int) (atoi_octal(str) | 0600); - /* Default creation of new dir's */ - if ((str=getenv("UMASK_DIR")) != 0) - my_umask_dir=(int) (atoi_octal(str) | 0700); -#endif + my_win_init(); #ifdef VMS - init_ctype(); /* Stupid linker don't link _ctype.c */ + init_ctype(); /* Stupid linker don't link _ctype.c */ #endif - DBUG_PRINT("exit",("home: '%s'",home_dir)); - } + DBUG_PRINT("exit", ("home: '%s'", home_dir)); #ifdef __WIN__ win32_init_tcp_ip(); #endif diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 83d35863eca..236b694726f 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -88,6 +88,30 @@ my_bool my_thread_basic_global_init(void) return 0; my_thread_basic_global_init_done= 1; +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + /* + Set mutex type to "fast" a.k.a "adaptive" + + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). + */ + pthread_mutexattr_init(&my_fast_mutexattr); + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); +#endif + +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + /* + Set mutex type to "errorcheck" + */ + pthread_mutexattr_init(&my_errorcheck_mutexattr); + pthread_mutexattr_settype(&my_errorcheck_mutexattr, + PTHREAD_MUTEX_ERRORCHECK); +#endif + mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST); @@ -190,29 +214,6 @@ my_bool my_thread_global_init(void) } #endif /* TARGET_OS_LINUX */ -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - /* - Set mutex type to "fast" a.k.a "adaptive" - - In this case the thread may steal the mutex from some other thread - that is waiting for the same mutex. This will save us some - context switches but may cause a thread to 'starve forever' while - waiting for the mutex (not likely if the code within the mutex is - short). - */ - pthread_mutexattr_init(&my_fast_mutexattr); - pthread_mutexattr_settype(&my_fast_mutexattr, - PTHREAD_MUTEX_ADAPTIVE_NP); -#endif -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - /* - Set mutex type to "errorcheck" - */ - pthread_mutexattr_init(&my_errorcheck_mutexattr); - pthread_mutexattr_settype(&my_errorcheck_mutexattr, - PTHREAD_MUTEX_ERRORCHECK); -#endif - mysql_mutex_init(key_THR_LOCK_lock, &THR_LOCK_lock, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW); mysql_mutex_init(key_THR_LOCK_myisam, &THR_LOCK_myisam, MY_MUTEX_INIT_SLOW); |