From a5e8408d4774885c768caf030cfc1ec3314e8115 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Tue, 3 May 2005 09:13:17 +0000 Subject: [PATCH] Include to get memset() declared. (consume_some_stack_space): New function. (main): Call consume_some_stack_space() before establishing the rlimit. Otherwise, stack-expansion may bump into the address-space rlimit. (Logical change 1.290) --- tests/test-mem.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test-mem.c b/tests/test-mem.c index e1fcb2b6..4f7e58c5 100644 --- a/tests/test-mem.c +++ b/tests/test-mem.c @@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include +#include #include #include @@ -68,6 +69,18 @@ do_backtrace (void) while (ret > 0); } +int +consume_some_stack_space (void) +{ + unw_cursor_t cursor; + unw_context_t uc; + char string[1024]; + + memset (&cursor, 0, sizeof (cursor)); + memset (&uc, 0, sizeof (uc)); + return sprintf (string, "hello %p %p\n", &cursor, &uc); +} + int main (int argc, char **argv) { @@ -75,6 +88,9 @@ main (int argc, char **argv) verbose = argc > 1; + if (consume_some_stack_space () > 9999) + exit (-1); /* can't happen, but don't let the compiler know... */ + rlim.rlim_cur = 0; rlim.rlim_max = RLIM_INFINITY; setrlimit (RLIMIT_DATA, &rlim);