From fd537e535fe9f4d2b0286cf7a7242ef1e6775e67 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 29 Jan 2009 00:17:57 +0000 Subject: [BZ #9750] * nscd/mem.c (gc): Use alloca_count to get the real stack usage. * include/alloca.h (alloca_account): Define. * sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Define. (stackinfo_sub_sp): Define. --- include/alloca.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/alloca.h') diff --git a/include/alloca.h b/include/alloca.h index 563d786..7d243fd 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -46,4 +46,17 @@ extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const)); __alloca (((len) = (newlen))) #endif +#if defined stackinfo_get_sp && defined stackinfo_sub_sp +# define alloca_account(size, avar) \ + ({ void *old__ = stackinfo_get_sp (); \ + void *m__ = __alloca (size); \ + avar += stackinfo_sub_sp (old__); \ + m__; }) +#else +# define alloca_account(size, avar) \ + ({ size_t s__ = (size); \ + avar += size__; \ + __alloca (size__); }) +#endif + #endif -- cgit v1.1