Initialize my_sys functions, resources and variables @return Initialization result @retval 0 Success @retval 1 Error. Couldn't initialize environment */
| 63 | @retval 1 Error. Couldn't initialize environment |
| 64 | */ |
| 65 | my_bool my_init(void) |
| 66 | { |
| 67 | char *str; |
| 68 | |
| 69 | if (my_init_done) |
| 70 | return 0; |
| 71 | |
| 72 | my_init_done= 1; |
| 73 | |
| 74 | my_umask= 0660; /* Default umask for new files */ |
| 75 | my_umask_dir= 0700; /* Default umask for new directories */ |
| 76 | |
| 77 | /* Default creation of new files */ |
| 78 | if ((str= getenv("UMASK")) != 0) |
| 79 | my_umask= (int) (atoi_octal(str) | 0600); |
| 80 | /* Default creation of new dir's */ |
| 81 | if ((str= getenv("UMASK_DIR")) != 0) |
| 82 | my_umask_dir= (int) (atoi_octal(str) | 0700); |
| 83 | |
| 84 | init_glob_errs(); |
| 85 | |
| 86 | instrumented_stdin.m_file= stdin; |
| 87 | instrumented_stdin.m_psi= NULL; /* not yet instrumented */ |
| 88 | mysql_stdin= & instrumented_stdin; |
| 89 | |
| 90 | if (my_thread_global_init()) |
| 91 | return 1; |
| 92 | |
| 93 | #if defined(SAFE_MUTEX) |
| 94 | safe_mutex_global_init(); /* Must be called early */ |
| 95 | #endif |
| 96 | |
| 97 | #if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) |
| 98 | fastmutex_global_init(); /* Must be called early */ |
| 99 | #endif |
| 100 | |
| 101 | /* $HOME is needed early to parse configuration files located in ~/ */ |
| 102 | if ((home_dir= getenv("HOME")) != 0) |
| 103 | home_dir= intern_filename(home_dir_buff, home_dir); |
| 104 | |
| 105 | { |
| 106 | DBUG_ENTER("my_init"); |
| 107 | DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); |
| 108 | my_win_init(); |
| 109 | DBUG_PRINT("exit", ("home: '%s'", home_dir)); |
| 110 | #ifdef __WIN__ |
| 111 | win32_init_tcp_ip(); |
| 112 | #endif |
| 113 | DBUG_RETURN(0); |
| 114 | } |
| 115 | } /* my_init */ |
| 116 | |
| 117 | |
| 118 | /* End my_sys */ |