aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/alloca.h44
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