MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mysys_priv.h
1 /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #include <my_global.h>
17 #include <my_sys.h>
18 
19 #ifdef USE_SYSTEM_WRAPPERS
20 #include "system_wrappers.h"
21 #endif
22 
23 #ifdef HAVE_GETRUSAGE
24 #include <sys/resource.h>
25 #endif
26 
27 #include <my_pthread.h>
28 
29 #ifdef HAVE_PSI_INTERFACE
30 
31 #if !defined(HAVE_PREAD) && !defined(_WIN32)
32 extern PSI_mutex_key key_my_file_info_mutex;
33 #endif /* !defined(HAVE_PREAD) && !defined(_WIN32) */
34 
35 #if !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R)
36 extern PSI_mutex_key key_LOCK_localtime_r;
37 #endif /* !defined(HAVE_LOCALTIME_R) || !defined(HAVE_GMTIME_R) */
38 
39 extern PSI_mutex_key key_BITMAP_mutex, key_IO_CACHE_append_buffer_lock,
40  key_IO_CACHE_SHARE_mutex, key_KEY_CACHE_cache_lock, key_LOCK_alarm,
41  key_my_thread_var_mutex, key_THR_LOCK_charset, key_THR_LOCK_heap,
42  key_THR_LOCK_lock, key_THR_LOCK_malloc,
43  key_THR_LOCK_mutex, key_THR_LOCK_myisam, key_THR_LOCK_net,
44  key_THR_LOCK_open, key_THR_LOCK_threads,
45  key_TMPDIR_mutex, key_THR_LOCK_myisam_mmap;
46 
47 extern PSI_cond_key key_COND_alarm, key_IO_CACHE_SHARE_cond,
48  key_IO_CACHE_SHARE_cond_writer, key_my_thread_var_suspend,
49  key_THR_COND_threads;
50 
51 #ifdef USE_ALARM_THREAD
52 extern PSI_thread_key key_thread_alarm;
53 #endif /* USE_ALARM_THREAD */
54 
55 #endif /* HAVE_PSI_INTERFACE */
56 
57 extern PSI_stage_info stage_waiting_for_table_level_lock;
58 
59 extern mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_keycache;
60 extern mysql_mutex_t THR_LOCK_lock, THR_LOCK_net;
61 extern mysql_mutex_t THR_LOCK_charset;
62 
63 #include <mysql/psi/mysql_file.h>
64 
65 #ifdef HAVE_PSI_INTERFACE
66 #ifdef HUGETLB_USE_PROC_MEMINFO
67 extern PSI_file_key key_file_proc_meminfo;
68 #endif /* HUGETLB_USE_PROC_MEMINFO */
69 extern PSI_file_key key_file_charset;
70 #endif /* HAVE_PSI_INTERFACE */
71 
72 /*
73  EDQUOT is used only in 3 C files only in mysys/. If it does not exist on
74  system, we set it to some value which can never happen.
75 */
76 #ifndef EDQUOT
77 #define EDQUOT (-1)
78 #endif
79 
80 void my_error_unregister_all(void);
81 
82 #ifdef _WIN32
83 #include <sys/stat.h>
84 /* my_winfile.c exports, should not be used outside mysys */
85 extern File my_win_open(const char *path, int oflag);
86 extern int my_win_close(File fd);
87 extern size_t my_win_read(File fd, uchar *buffer, size_t count);
88 extern size_t my_win_write(File fd, const uchar *buffer, size_t count);
89 extern size_t my_win_pread(File fd, uchar *buffer, size_t count,
90  my_off_t offset);
91 extern size_t my_win_pwrite(File fd, const uchar *buffer, size_t count,
92  my_off_t offset);
93 extern my_off_t my_win_lseek(File fd, my_off_t pos, int whence);
94 extern int my_win_chsize(File fd, my_off_t newlength);
95 extern FILE* my_win_fopen(const char *filename, const char *type);
96 extern File my_win_fclose(FILE *file);
97 extern File my_win_fileno(FILE *file);
98 extern FILE* my_win_fdopen(File Filedes, const char *type);
99 extern int my_win_stat(const char *path, struct _stati64 *buf);
100 extern int my_win_fstat(File fd, struct _stati64 *buf);
101 extern int my_win_fsync(File fd);
102 extern File my_win_dup(File fd);
103 extern File my_win_sopen(const char *path, int oflag, int shflag, int perm);
104 extern File my_open_osfhandle(HANDLE handle, int oflag);
105 #endif