diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-01-29 00:17:57 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-01-29 00:17:57 +0000 |
commit | fd537e535fe9f4d2b0286cf7a7242ef1e6775e67 (patch) | |
tree | 2eed5f293901fe55fc170dd02dd120f92acf1ece /include/alloca.h | |
parent | 31d322a214386b20bb82c06d0c436bd0f0e80236 (diff) | |
download | glibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.zip glibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.tar.gz glibc-fd537e535fe9f4d2b0286cf7a7242ef1e6775e67.tar.bz2 |
[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/alloca.h')
-rw-r--r-- | include/alloca.h | 13 |
1 files changed, 13 insertions, 0 deletions
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 |