summaryrefslogtreecommitdiff
path: root/include/my_stacktrace.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-02-20 16:23:18 +0200
committerMichael Widenius <monty@askmonty.org>2012-02-20 16:23:18 +0200
commitae07ec6cbf08e311e538f5149f93385e5bcaa7a6 (patch)
tree4f2dee1467f3c3e3bd8feb6ffb7adf7684bdc653 /include/my_stacktrace.h
parent0c568a99dfe3e528ec5bd09dfe0f2f90acb52db4 (diff)
parentdacaaf22a3f132df5573fe8e58c0617c30c5e9fc (diff)
downloadmariadb-git-ae07ec6cbf08e311e538f5149f93385e5bcaa7a6.tar.gz
Merge with MYSQL 5.1.61
Fixed README with link to source Merged InnoDB change to XtraDB README: Added information of where to find MariaDB code storage/archive/ha_archive.cc: Removed memset() of rows, a MariaDB checksum's doesn't touch not used data.
Diffstat (limited to 'include/my_stacktrace.h')
-rw-r--r--include/my_stacktrace.h69
1 files changed, 65 insertions, 4 deletions
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index 5138ea98191..a2fd89852fc 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -1,5 +1,4 @@
-/*
- Copyright (c) 2001, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2001, 2011, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,8 +11,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _my_stacktrace_h_
#define _my_stacktrace_h_
@@ -63,6 +61,69 @@ 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
+ Implemented with simplicity, and async-signal-safety in mind.
+ @note Has an internal buffer capacity of 512 bytes,
+ which should suffice for our signal handling routines.
+*/
+size_t my_safe_printf_stderr(const char* fmt, ...)
+ ATTRIBUTE_FORMAT(printf, 1, 2);
+
+/**
+ Writes up to count bytes from buffer to STDERR.
+ Implemented with simplicity, and async-signal-safety in mind.
+ @param buf Buffer containing data to be written.
+ @param count Number of bytes to write.
+ @returns Number of bytes written.
+*/
+size_t my_write_stderr(const void *buf, size_t count);
+
C_MODE_END
#endif /* _my_stacktrace_h_ */