/src/server/mysys/errors.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. |
2 | | Copyright (c) 2009, 2016, MariaDB |
3 | | |
4 | | This program is free software; you can redistribute it and/or modify |
5 | | it under the terms of the GNU General Public License as published by |
6 | | the Free Software Foundation; version 2 of the License. |
7 | | |
8 | | This program is distributed in the hope that it will be useful, |
9 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | | GNU General Public License for more details. |
12 | | |
13 | | You should have received a copy of the GNU General Public License |
14 | | along with this program; if not, write to the Free Software |
15 | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ |
16 | | |
17 | | #include "mysys_priv.h" |
18 | | #include "mysys_err.h" |
19 | | |
20 | | #ifndef SHARED_LIBRARY |
21 | | |
22 | | const char *globerrs[GLOBERRS+1]= |
23 | | { |
24 | | "Can't create/write to file '%s' (Errcode: %M)", |
25 | | "Error reading file '%s' (Errcode: %M)", |
26 | | "Error writing file '%s' (Errcode: %M)", |
27 | | "Error on close of '%s' (Errcode: %M)", |
28 | | "Out of memory (Needed %u bytes)", |
29 | | "Error on delete of '%s' (Errcode: %M)", |
30 | | "Error on rename of '%s' to '%s' (Errcode: %M)", |
31 | | "", |
32 | | "Unexpected end-of-file found when reading file '%s' (Errcode: %M)", |
33 | | "Can't lock file (Errcode: %M)", |
34 | | "Can't unlock file (Errcode: %M)", |
35 | | "Can't read dir of '%s' (Errcode: %M)", |
36 | | "Can't get stat of '%s' (Errcode: %M)", |
37 | | "Can't change size of file (Errcode: %M)", |
38 | | "Can't open stream from handle (Errcode: %M)", |
39 | | "Can't get working directory (Errcode: %M)", |
40 | | "Can't change dir to '%s' (Errcode: %M)", |
41 | | "Warning: '%s' had %d links", |
42 | | "Warning: %d files and %d streams is left open\n", |
43 | | "Disk is full writing '%s' (Errcode: %M). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)", |
44 | | "Can't create directory '%s' (Errcode: %M)", |
45 | | "Character set '%s' is not a compiled character set and is not specified in the '%s' file", |
46 | | "Out of resources when opening file '%s' (Errcode: %M)", |
47 | | "Can't read value for symlink '%s' (Errcode: %M)", |
48 | | "Can't create symlink '%s' pointing at '%s' (Errcode: %M)", |
49 | | "Error on realpath() on '%s' (Errcode: %M)", |
50 | | "Can't sync file '%s' to disk (Errcode: %M)", |
51 | | "Collation '%s' is not a compiled collation and is not specified in the '%s' file", |
52 | | "File '%s' not found (Errcode: %M)", |
53 | | "File '%s' (fileno: %d) was not closed", |
54 | | "Can't change ownership of the file '%s' (Errcode: %M)", |
55 | | "Can't change permissions of the file '%s' (Errcode: %M)", |
56 | | "Can't seek in file '%s' (Errcode: %M)", |
57 | | "Can't change mode for file '%s' to 0x%lx (Errcode: %M)", |
58 | | "Warning: Can't copy ownership for file '%s' (Errcode: %M)", |
59 | | "Failed to release memory pointer %p, %zu bytes (Errcode: %M)", |
60 | | "Lock Pages in memory access rights required", |
61 | | "Memcntl %s cmd %s error", |
62 | | "Warning: Charset id '%d' csname '%s' trying to replace existing csname '%s'", |
63 | | "Deprecated program name. It will be removed in a future release, use '%s' instead", |
64 | | "Local temporary space limit reached", |
65 | | "Global temporary space limit reached", |
66 | | "" |
67 | | }; |
68 | | |
69 | | void init_glob_errs(void) |
70 | 0 | { |
71 | | /* This is now done statically. */ |
72 | 0 | } |
73 | | |
74 | | #else |
75 | | |
76 | | void init_glob_errs() |
77 | | { |
78 | | EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %M)"; |
79 | | EE(EE_READ) = "Error reading file '%s' (Errcode: %M)"; |
80 | | EE(EE_WRITE) = "Error writing file '%s' (Errcode: %M)"; |
81 | | EE(EE_BADCLOSE) = "Error on close of '%'s (Errcode: %M)"; |
82 | | EE(EE_OUTOFMEMORY) = "Out of memory (Needed %u bytes)"; |
83 | | EE(EE_DELETE) = "Error on delete of '%s' (Errcode: %M)"; |
84 | | EE(EE_LINK) = "Error on rename of '%s' to '%s' (Errcode: %M)"; |
85 | | EE(EE_EOFERR) = "Unexpected eof found when reading file '%s' (Errcode: %M)"; |
86 | | EE(EE_CANTLOCK) = "Can't lock file (Errcode: %M)"; |
87 | | EE(EE_CANTUNLOCK) = "Can't unlock file (Errcode: %M)"; |
88 | | EE(EE_DIR) = "Can't read dir of '%s' (Errcode: %M)"; |
89 | | EE(EE_STAT) = "Can't get stat of '%s' (Errcode: %M)"; |
90 | | EE(EE_CANT_CHSIZE) = "Can't change size of file (Errcode: %M)"; |
91 | | EE(EE_CANT_OPEN_STREAM)= "Can't open stream from handle (Errcode: %M)"; |
92 | | EE(EE_GETWD) = "Can't get working directory (Errcode: %M)"; |
93 | | EE(EE_SETWD) = "Can't change dir to '%s' (Errcode: %M)"; |
94 | | EE(EE_LINK_WARNING) = "Warning: '%s' had %d links"; |
95 | | EE(EE_OPEN_WARNING) = "Warning: %d files and %d streams is left open\n"; |
96 | | EE(EE_DISK_FULL) = "Disk is full writing '%s' (Errcode: %M). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)", |
97 | | EE(EE_CANT_MKDIR) ="Can't create directory '%s' (Errcode: %M)"; |
98 | | EE(EE_UNKNOWN_CHARSET)= "Character set '%s' is not a compiled character set and is not specified in the %s file"; |
99 | | EE(EE_OUT_OF_FILERESOURCES)="Out of resources when opening file '%s' (Errcode: %M)"; |
100 | | EE(EE_CANT_READLINK)= "Can't read value for symlink '%s' (Errcode: %M)"; |
101 | | EE(EE_CANT_SYMLINK)= "Can't create symlink '%s' pointing at '%s' (Errcode: %M)"; |
102 | | EE(EE_REALPATH)= "Error on realpath() on '%s' (Errcode: %M)"; |
103 | | EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %M)"; |
104 | | EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; |
105 | | EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %M)"; |
106 | | EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed"; |
107 | | EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %M)"; |
108 | | EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %M)"; |
109 | | EE(EE_CANT_SEEK) = "Can't seek in file '%s' (Errcode: %M)"; |
110 | | EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Errcode: %M)"; |
111 | | EE(EE_CANT_COPY_OWNERSHIP)= "Warning: Can't copy ownership for file '%s' (Errcode: %M)"; |
112 | | EE(EE_BADMEMORYRELEASE)= "Failed to release memory pointer %p, %zu bytes (Errcode: %M)"; |
113 | | EE(EE_PERM_LOCK_MEMORY)= "Lock Pages in memory access rights required"; |
114 | | EE(EE_MEMCNTL) = "Memcntl %s cmd %s error"; |
115 | | EE(EE_DUPLICATE_CHARSET)= "Warning: Charset id %d trying to replace csname %s with %s"; |
116 | | EE(EE_NAME_DEPRECATED) = "Notice: %s is deprecated and will be removed in a future release, use command '%s'"; |
117 | | EE(EE_LOCAL_TMP_SPACE_FULL) = "Local temporary space limit reached"; |
118 | | EE(EE_GLOBAL_TMP_SPACE_FULL) = "Global temporary space limit reached"; |
119 | | } |
120 | | #endif |
121 | | |
122 | | static void my_space_sleep(uint seconds) |
123 | 0 | { |
124 | 0 | sleep(seconds); |
125 | 0 | } |
126 | | |
127 | | void (*my_sleep_for_space)(uint seconds)= my_space_sleep; |
128 | | |
129 | | void wait_for_free_space(const char *filename, int errors) |
130 | 0 | { |
131 | 0 | if (errors == 0) |
132 | 0 | my_error(EE_DISK_FULL,MYF(ME_BELL | ME_ERROR_LOG | ME_WARNING), |
133 | 0 | filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC); |
134 | 0 | if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE)) |
135 | 0 | my_printf_error(EE_DISK_FULL, |
136 | 0 | "Retry in %d secs. Message reprinted in %d secs", |
137 | 0 | MYF(ME_BELL | ME_ERROR_LOG | ME_WARNING), |
138 | 0 | MY_WAIT_FOR_USER_TO_FIX_PANIC, |
139 | 0 | MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC ); |
140 | 0 | my_sleep_for_space(MY_WAIT_FOR_USER_TO_FIX_PANIC); |
141 | 0 | } |
142 | | |
143 | | const char **get_global_errmsgs(int nr __attribute__((unused))) |
144 | 0 | { |
145 | 0 | return globerrs; |
146 | 0 | } |