about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-29 00:17:57 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-29 00:17:57 +0000
commitfd537e535fe9f4d2b0286cf7a7242ef1e6775e67 (patch)
tree2eed5f293901fe55fc170dd02dd120f92acf1ece /include
parent31d322a214386b20bb82c06d0c436bd0f0e80236 (diff)
downloadglibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.tar.gz
glibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.tar.xz
glibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.zip
[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.
Diffstat (limited to 'include')
-rw-r--r--include/alloca.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/alloca.h b/include/alloca.h
index 563d7868bd..7d243fd4ac 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