#include "mysys_priv.h"#include "my_static.h"#include "mysys_err.h"#include <m_string.h>#include <m_ctype.h>#include <signal.h>Include dependency graph for my_init.c:

Go to the source code of this file.
Defines | |
| #define | my_win_init() |
| #define | netware_init() |
Functions | |
| static ulong | atoi_octal (const char *str) |
| my_bool | my_init (void) |
| void | my_end (int infoflag) |
Variables | |
| my_bool | my_init_done = 0 |
| uint | mysys_usage_id = 0 |
| static ulong atoi_octal | ( | const char * | str | ) | [static] |
Definition at line 48 of file my_init.c.
References my_charset_latin1, my_isspace, and str2int().
Referenced by my_init().
00049 { 00050 long int tmp; 00051 while (*str && my_isspace(&my_charset_latin1, *str)) 00052 str++; 00053 str2int(str, 00054 (*str == '0' ? 8 : 10), /* Octalt or decimalt */ 00055 0, INT_MAX, &tmp); 00056 return (ulong) tmp; 00057 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void my_end | ( | int | infoflag | ) |
Definition at line 125 of file my_init.c.
References bzero, DBUG_END, DBUG_FILE, DBUG_PRINT, EE, EE_OPEN_WARNING, errbuff, free_charsets(), ME_BELL, MY_CHECK_ERROR, MY_DONT_FREE_DBUG, my_file_opened, MY_GIVE_INFO, my_init_done, my_message_no_curses(), my_once_free(), my_print_open_files, my_stream_opened, my_thread_end(), my_thread_global_end(), print_info(), safe_mutex_end(), SCALE_SEC, SCALE_USEC, and TERMINATE.
00126 { 00127 /* 00128 this code is suboptimal to workaround a bug in 00129 Sun CC: Sun C++ 5.6 2004/06/02 for x86, and should not be 00130 optimized until this compiler is not in use anymore 00131 */ 00132 FILE *info_file= DBUG_FILE; 00133 my_bool print_info= (info_file != stderr); 00134 /* We do not use DBUG_ENTER here, as after cleanup DBUG is no longer 00135 operational, so we cannot use DBUG_RETURN. 00136 */ 00137 DBUG_PRINT("info",("Shutting down")); 00138 if (!info_file) 00139 { 00140 info_file= stderr; 00141 print_info= 0; 00142 } 00143 00144 DBUG_PRINT("info",("Shutting down: print_info: %d", print_info)); 00145 if ((infoflag & MY_CHECK_ERROR) || print_info) 00146 00147 { /* Test if some file is left open */ 00148 if (my_file_opened | my_stream_opened) 00149 { 00150 sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened); 00151 (void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL); 00152 DBUG_PRINT("error",("%s",errbuff[0])); 00153 my_print_open_files(); 00154 } 00155 } 00156 free_charsets(); 00157 my_once_free(); 00158 00159 if ((infoflag & MY_GIVE_INFO) || print_info) 00160 { 00161 #ifdef HAVE_GETRUSAGE 00162 struct rusage rus; 00163 #ifdef HAVE_purify 00164 /* Purify assumes that rus is uninitialized after getrusage call */ 00165 bzero((char*) &rus, sizeof(rus)); 00166 #endif 00167 if (!getrusage(RUSAGE_SELF, &rus)) 00168 fprintf(info_file,"\n\ 00169 User time %.2f, System time %.2f\n\ 00170 Maximum resident set size %ld, Integral resident set size %ld\n\ 00171 Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\ 00172 Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\ 00173 Voluntary context switches %ld, Involuntary context switches %ld\n", 00174 (rus.ru_utime.tv_sec * SCALE_SEC + 00175 rus.ru_utime.tv_usec / SCALE_USEC) / 100.0, 00176 (rus.ru_stime.tv_sec * SCALE_SEC + 00177 rus.ru_stime.tv_usec / SCALE_USEC) / 100.0, 00178 rus.ru_maxrss, rus.ru_idrss, 00179 rus.ru_minflt, rus.ru_majflt, 00180 rus.ru_nswap, rus.ru_inblock, rus.ru_oublock, 00181 rus.ru_msgsnd, rus.ru_msgrcv, rus.ru_nsignals, 00182 rus.ru_nvcsw, rus.ru_nivcsw); 00183 #endif 00184 #if defined(__NETWARE__) && !defined(__WIN__) 00185 fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC); 00186 #endif 00187 #if defined(SAFEMALLOC) 00188 TERMINATE(stderr); /* Give statistic on screen */ 00189 #elif defined(__WIN__) && defined(_MSC_VER) 00190 _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); 00191 _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR ); 00192 _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); 00193 _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR ); 00194 _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); 00195 _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); 00196 _CrtCheckMemory(); 00197 _CrtDumpMemoryLeaks(); 00198 #endif 00199 } 00200 00201 if (!(infoflag & MY_DONT_FREE_DBUG)) 00202 DBUG_END(); /* Must be done before my_thread_end */ 00203 #ifdef THREAD 00204 my_thread_end(); 00205 my_thread_global_end(); 00206 #if defined(SAFE_MUTEX) 00207 /* 00208 Check on destroying of mutexes. A few may be left that will get cleaned 00209 up by C++ destructors 00210 */ 00211 safe_mutex_end(infoflag & MY_GIVE_INFO ? stderr : (FILE *) 0); 00212 #endif /* defined(SAFE_MUTEX) */ 00213 #endif /* THREAD */ 00214 00215 #ifdef __WIN__ 00216 if (have_tcpip) 00217 WSACleanup(); 00218 #endif /* __WIN__ */ 00219 my_init_done=0; 00220 } /* my_end */
Here is the call graph for this function:

| my_bool my_init | ( | void | ) |
Definition at line 71 of file my_init.c.
References atoi_octal(), DBUG_ENTER, DBUG_PRINT, DBUG_PROCESS, DBUG_RETURN, getenv(), home_dir, home_dir_buff, int(), intern_filename(), my_init_done, my_progname, my_thread_global_init(), my_umask, my_umask_dir, my_win_init, mysys_usage_id, netware_init, and safe_mutex_global_init().
00072 { 00073 my_string str; 00074 if (my_init_done) 00075 return 0; 00076 my_init_done=1; 00077 mysys_usage_id++; 00078 my_umask= 0660; /* Default umask for new files */ 00079 my_umask_dir= 0700; /* Default umask for new directories */ 00080 #if defined(THREAD) && defined(SAFE_MUTEX) 00081 safe_mutex_global_init(); /* Must be called early */ 00082 #endif 00083 netware_init(); 00084 #ifdef THREAD 00085 #if defined(HAVE_PTHREAD_INIT) 00086 pthread_init(); /* Must be called before DBUG_ENTER */ 00087 #endif 00088 if (my_thread_global_init()) 00089 return 1; 00090 #if !defined( __WIN__) && !defined(__NETWARE__) 00091 sigfillset(&my_signals); /* signals blocked by mf_brkhant */ 00092 #endif 00093 #endif /* THREAD */ 00094 { 00095 DBUG_ENTER("my_init"); 00096 DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); 00097 if (!home_dir) 00098 { /* Don't initialize twice */ 00099 my_win_init(); 00100 if ((home_dir=getenv("HOME")) != 0) 00101 home_dir=intern_filename(home_dir_buff,home_dir); 00102 #ifndef VMS 00103 /* Default creation of new files */ 00104 if ((str=getenv("UMASK")) != 0) 00105 my_umask=(int) (atoi_octal(str) | 0600); 00106 /* Default creation of new dir's */ 00107 if ((str=getenv("UMASK_DIR")) != 0) 00108 my_umask_dir=(int) (atoi_octal(str) | 0700); 00109 #endif 00110 #ifdef VMS 00111 init_ctype(); /* Stupid linker don't link _ctype.c */ 00112 #endif 00113 DBUG_PRINT("exit",("home: '%s'",home_dir)); 00114 } 00115 #ifdef __WIN__ 00116 win32_init_tcp_ip(); 00117 #endif 00118 DBUG_RETURN(0); 00119 } 00120 } /* my_init */
Here is the call graph for this function:

| my_bool my_init_done = 0 |
| uint mysys_usage_id = 0 |
1.4.7

