diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-20 17:35:04 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-20 17:35:04 +0100 |
commit | 0d4b2f2670b9d90c694a8d5340611481066ea5e6 (patch) | |
tree | 347089cafd293e525f910c775bcb6af9cfa6c241 /include/alloca.h | |
parent | m (diff) | |
download | slibc-0d4b2f2670b9d90c694a8d5340611481066ea5e6.tar.gz slibc-0d4b2f2670b9d90c694a8d5340611481066ea5e6.tar.bz2 slibc-0d4b2f2670b9d90c694a8d5340611481066ea5e6.tar.xz |
add needstack
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'include/alloca.h')
-rw-r--r-- | include/alloca.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/alloca.h b/include/alloca.h index d54d18d..49d8879 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -53,6 +53,50 @@ void* alloca(size_t); #endif +#if defined(__PLAN9_SOURCE) +/** + * Check for execution stack overflow. If the stack of + * overflow, or will overflow, the program shall abort. + * + * It is possible that the process is killed by SIGSEGV + * instead of aborting. + * + * This is a Plan 9 from Bell Labs extension. + * + * @etymology I (need) addition (stack) space. + * + * @param n The number of bytes the stack will grow by. + * 0 can be used to check for a current stack + * overflow. Must be non-negative. + * + * @since Always. + */ +void (needstack)(int); +# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define needstack(n) __needstack(n, __FILE__, __LINE__, __func__) +# else +# define needstack(n) __needstack(n, __FILE__, __LINE__, NULL) +# endif +#endif + + +/** + * This function is called if the `needstack` macro is called. + * It enhances the `needstack` function with detail on where + * the program failed. + * + * You should not use this function directly. + * + * @param n The number of bytes the stack will grow by. 0 can be used + * to check for a current stack overflow. Must be non-negative. + * @param file The filename of the source cose whence the check was made. + * @param line The line in the source code whence the check was made. + * @param func The function in the source code whence the check was made, + * `NULL` if unknown (C99 is required.) + */ +void __needstack(int, const char*, int, const char*) + + #endif #endif |