Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e6c21389
Commit
e6c21389
authored
Mar 21, 2012
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
3920d978
c88e2679
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
233 deletions
+17
-233
include/my_global.h
include/my_global.h
+4
-0
include/my_stacktrace.h
include/my_stacktrace.h
+0
-44
mysys/stacktrace.c
mysys/stacktrace.c
+8
-186
sql/signal_handler.cc
sql/signal_handler.cc
+1
-1
sql/sql_show.cc
sql/sql_show.cc
+2
-0
storage/innobase/os/os0file.c
storage/innobase/os/os0file.c
+1
-1
storage/xtradb/os/os0file.c
storage/xtradb/os/os0file.c
+1
-1
No files found.
include/my_global.h
View file @
e6c21389
...
...
@@ -571,6 +571,10 @@ int __void__;
#endif
#endif
/* DONT_DEFINE_VOID */
#ifndef STDERR_FILENO
#define STDERR_FILENO 2
#endif
/*
Deprecated workaround for false-positive uninitialized variables
warnings. Those should be silenced using tool-specific heuristics.
...
...
include/my_stacktrace.h
View file @
e6c21389
...
...
@@ -61,50 +61,6 @@ void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
void
my_write_core
(
int
sig
);
#endif
/**
Async-signal-safe utility functions used by signal handler routines.
Declared here in order to unit-test them.
These are not general-purpose, but tailored to the signal handling routines.
*/
/**
Converts a longlong value to string.
@param base 10 for decimal, 16 for hex values (0..9a..f)
@param val The value to convert
@param buf Assumed to point to the *end* of the buffer.
@returns Pointer to the first character of the converted string.
Negative values:
for base-10 the return string will be prepended with '-'
for base-16 the return string will contain 16 characters
Implemented with simplicity, and async-signal-safety in mind.
*/
char
*
my_safe_itoa
(
int
base
,
longlong
val
,
char
*
buf
);
/**
Converts a ulonglong value to string.
@param base 10 for decimal, 16 for hex values (0..9a..f)
@param val The value to convert
@param buf Assumed to point to the *end* of the buffer.
@returns Pointer to the first character of the converted string.
Implemented with simplicity, and async-signal-safety in mind.
*/
char
*
my_safe_utoa
(
int
base
,
ulonglong
val
,
char
*
buf
);
/**
A (very) limited version of snprintf.
@param to Destination buffer.
@param n Size of destination buffer.
@param fmt printf() style format string.
@returns Number of bytes written, including terminating '\0'
Supports 'd' 'i' 'u' 'x' 'p' 's' conversion.
Supports 'l' and 'll' modifiers for integral types.
Does not support any width/precision.
Implemented with simplicity, and async-signal-safety in mind.
*/
size_t
my_safe_snprintf
(
char
*
to
,
size_t
n
,
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
3
,
4
);
/**
A (very) limited version of snprintf, which writes the result to STDERR.
@sa my_safe_snprintf
...
...
mysys/stacktrace.c
View file @
e6c21389
...
...
@@ -685,7 +685,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
&
(
package
.
sym
));
have_source
=
pSymGetLineFromAddr64
(
hProcess
,
addr
,
&
line_offset
,
&
line
);
fprintf
(
stderr
,
"%p "
,
addr
);
my_safe_printf_stderr
(
"%p "
,
addr
);
if
(
have_module
)
{
char
*
base_image_name
=
strrchr
(
module
.
ImageName
,
'\\'
);
...
...
@@ -693,12 +693,13 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
base_image_name
++
;
else
base_image_name
=
module
.
ImageName
;
fprintf
(
stderr
,
"%s!"
,
base_image_name
);
my_safe_printf_stderr
(
"%s!"
,
base_image_name
);
}
if
(
have_symbol
)
fprintf
(
stderr
,
"%s()"
,
package
.
sym
.
Name
);
my_safe_printf_stderr
(
"%s()"
,
package
.
sym
.
Name
);
else
if
(
have_module
)
fprintf
(
stderr
,
"%s"
,
"???"
);
my_safe_printf_stderr
(
"%s"
,
"???"
);
if
(
have_source
)
{
...
...
@@ -707,10 +708,10 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
base_file_name
++
;
else
base_file_name
=
line
.
FileName
;
fprintf
(
stderr
,
"[%s:%u]"
,
my_safe_printf_stderr
(
"[%s:%u]"
,
base_file_name
,
line
.
LineNumber
);
}
fprintf
(
stderr
,
"%s"
,
"
\n
"
);
my_safe_printf_stderr
(
"%s"
,
"
\n
"
);
}
}
...
...
@@ -781,189 +782,10 @@ void my_safe_print_str(const char *val, int len)
#endif
/*__WIN__*/
#ifdef __WIN__
size_t
my_write_stderr
(
const
void
*
buf
,
size_t
count
)
{
return
fwrite
(
buf
,
1
,
count
,
stderr
);
}
#else
size_t
my_write_stderr
(
const
void
*
buf
,
size_t
count
)
{
return
(
size_t
)
write
(
STDERR_FILENO
,
buf
,
count
);
}
#endif
static
const
char
digits
[]
=
"0123456789abcdef"
;
char
*
my_safe_utoa
(
int
base
,
ulonglong
val
,
char
*
buf
)
{
*
buf
--=
0
;
do
{
*
buf
--=
digits
[
val
%
base
];
}
while
((
val
/=
base
)
!=
0
);
return
buf
+
1
;
}
char
*
my_safe_itoa
(
int
base
,
longlong
val
,
char
*
buf
)
{
char
*
orig_buf
=
buf
;
const
my_bool
is_neg
=
(
val
<
0
);
*
buf
--=
0
;
if
(
is_neg
)
val
=
-
val
;
if
(
is_neg
&&
base
==
16
)
{
int
ix
;
val
-=
1
;
for
(
ix
=
0
;
ix
<
16
;
++
ix
)
buf
[
-
ix
]
=
'0'
;
}
do
{
*
buf
--=
digits
[
val
%
base
];
}
while
((
val
/=
base
)
!=
0
);
if
(
is_neg
&&
base
==
10
)
*
buf
--=
'-'
;
if
(
is_neg
&&
base
==
16
)
{
int
ix
;
buf
=
orig_buf
-
1
;
for
(
ix
=
0
;
ix
<
16
;
++
ix
,
--
buf
)
{
switch
(
*
buf
)
{
case
'0'
:
*
buf
=
'f'
;
break
;
case
'1'
:
*
buf
=
'e'
;
break
;
case
'2'
:
*
buf
=
'd'
;
break
;
case
'3'
:
*
buf
=
'c'
;
break
;
case
'4'
:
*
buf
=
'b'
;
break
;
case
'5'
:
*
buf
=
'a'
;
break
;
case
'6'
:
*
buf
=
'9'
;
break
;
case
'7'
:
*
buf
=
'8'
;
break
;
case
'8'
:
*
buf
=
'7'
;
break
;
case
'9'
:
*
buf
=
'6'
;
break
;
case
'a'
:
*
buf
=
'5'
;
break
;
case
'b'
:
*
buf
=
'4'
;
break
;
case
'c'
:
*
buf
=
'3'
;
break
;
case
'd'
:
*
buf
=
'2'
;
break
;
case
'e'
:
*
buf
=
'1'
;
break
;
case
'f'
:
*
buf
=
'0'
;
break
;
}
}
}
return
buf
+
1
;
}
static
const
char
*
check_longlong
(
const
char
*
fmt
,
my_bool
*
have_longlong
)
{
*
have_longlong
=
FALSE
;
if
(
*
fmt
==
'l'
)
{
fmt
++
;
if
(
*
fmt
!=
'l'
)
*
have_longlong
=
(
sizeof
(
long
)
==
sizeof
(
longlong
));
else
{
fmt
++
;
*
have_longlong
=
TRUE
;
}
}
return
fmt
;
}
static
size_t
my_safe_vsnprintf
(
char
*
to
,
size_t
size
,
const
char
*
format
,
va_list
ap
)
{
char
*
start
=
to
;
char
*
end
=
start
+
size
-
1
;
for
(;
*
format
;
++
format
)
{
my_bool
have_longlong
=
FALSE
;
if
(
*
format
!=
'%'
)
{
if
(
to
==
end
)
/* end of buffer */
break
;
*
to
++=
*
format
;
/* copy ordinary char */
continue
;
}
++
format
;
/* skip '%' */
format
=
check_longlong
(
format
,
&
have_longlong
);
switch
(
*
format
)
{
case
'd'
:
case
'i'
:
case
'u'
:
case
'x'
:
case
'p'
:
{
longlong
ival
=
0
;
ulonglong
uval
=
0
;
if
(
*
format
==
'p'
)
have_longlong
=
(
sizeof
(
void
*
)
==
sizeof
(
longlong
));
if
(
have_longlong
)
{
if
(
*
format
==
'u'
)
uval
=
va_arg
(
ap
,
ulonglong
);
else
ival
=
va_arg
(
ap
,
longlong
);
}
else
{
if
(
*
format
==
'u'
)
uval
=
va_arg
(
ap
,
unsigned
int
);
else
ival
=
va_arg
(
ap
,
int
);
}
{
char
buff
[
22
];
const
int
base
=
(
*
format
==
'x'
||
*
format
==
'p'
)
?
16
:
10
;
char
*
val_as_str
=
(
*
format
==
'u'
)
?
my_safe_utoa
(
base
,
uval
,
&
buff
[
sizeof
(
buff
)
-
1
])
:
my_safe_itoa
(
base
,
ival
,
&
buff
[
sizeof
(
buff
)
-
1
]);
/* Strip off "ffffffff" if we have 'x' format without 'll' */
if
(
*
format
==
'x'
&&
!
have_longlong
&&
ival
<
0
)
val_as_str
+=
8
;
while
(
*
val_as_str
&&
to
<
end
)
*
to
++=
*
val_as_str
++
;
continue
;
}
}
case
's'
:
{
const
char
*
val
=
va_arg
(
ap
,
char
*
);
if
(
!
val
)
val
=
"(null)"
;
while
(
*
val
&&
to
<
end
)
*
to
++=
*
val
++
;
continue
;
}
}
}
*
to
=
0
;
return
to
-
start
;
}
size_t
my_safe_snprintf
(
char
*
to
,
size_t
n
,
const
char
*
fmt
,
...)
{
size_t
result
;
va_list
args
;
va_start
(
args
,
fmt
);
result
=
my_safe_vsnprintf
(
to
,
n
,
fmt
,
args
);
va_end
(
args
);
return
result
;
}
size_t
my_safe_printf_stderr
(
const
char
*
fmt
,
...)
...
...
@@ -972,7 +794,7 @@ size_t my_safe_printf_stderr(const char* fmt, ...)
size_t
result
;
va_list
args
;
va_start
(
args
,
fmt
);
result
=
my_safe_
vsnprintf
(
to
,
sizeof
(
to
),
fmt
,
args
);
result
=
vsnprintf
(
to
,
sizeof
(
to
),
fmt
,
args
);
va_end
(
args
);
my_write_stderr
(
to
,
result
);
return
result
;
...
...
sql/signal_handler.cc
View file @
e6c21389
...
...
@@ -72,7 +72,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
curr_time
=
my_time
(
0
);
localtime_r
(
&
curr_time
,
&
tm
);
fprintf
(
stderr
,
"%02d%02d%02d %2d:%02d:%02d "
,
my_safe_printf_stderr
(
"%02d%02d%02d %2d:%02d:%02d "
,
tm
.
tm_year
%
100
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
if
(
opt_expect_abort
...
...
sql/sql_show.cc
View file @
e6c21389
...
...
@@ -6804,6 +6804,8 @@ bool get_schema_tables_result(JOIN *join,
join
->
error
=
1
;
tab
->
read_record
.
table
->
file
=
table_list
->
table
->
file
;
table_list
->
schema_table_state
=
executed_place
;
if
(
!
thd
->
is_error
())
my_error
(
ER_UNKNOWN_ERROR
,
MYF
(
0
));
break
;
}
tab
->
read_record
.
table
->
file
=
table_list
->
table
->
file
;
...
...
storage/innobase/os/os0file.c
View file @
e6c21389
...
...
@@ -2556,7 +2556,7 @@ retry:
"InnoDB: Check also that the disk is not full"
" or a disk quota exceeded.
\n
"
,
name
,
(
ulong
)
offset_high
,
(
ulong
)
offset
,
(
ulong
)
n
,
(
ulong
)
len
,
(
ulong
)
err
);
(
ulong
)
n
,
ret
?
len
:
0
,
(
ulong
)
err
);
if
(
strerror
((
int
)
err
)
!=
NULL
)
{
fprintf
(
stderr
,
...
...
storage/xtradb/os/os0file.c
View file @
e6c21389
...
...
@@ -2794,7 +2794,7 @@ retry:
"InnoDB: Check also that the disk is not full"
" or a disk quota exceeded.
\n
"
,
name
,
(
ulong
)
offset_high
,
(
ulong
)
offset
,
(
ulong
)
n
,
(
ulong
)
len
,
(
ulong
)
err
);
(
ulong
)
n
,
ret
?
len
:
0
,
(
ulong
)
err
);
if
(
strerror
((
int
)
err
)
!=
NULL
)
{
fprintf
(
stderr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment