aboutsummaryrefslogtreecommitdiff
path: root/malloc/memusage.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-16 15:26:36 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-12-28 14:57:57 -0300
commit83b8d5027d2f80c4603cd706da95d6c9a09a4e16 (patch)
treeaba99da0933916d4a1685d7fb3a48e503e5797cd /malloc/memusage.c
parenta75b1e35c542342f3f3bc5c8ecc9c9c9c7a48c49 (diff)
downloadglibc-83b8d5027d2f80c4603cd706da95d6c9a09a4e16.zip
glibc-83b8d5027d2f80c4603cd706da95d6c9a09a4e16.tar.gz
glibc-83b8d5027d2f80c4603cd706da95d6c9a09a4e16.tar.bz2
malloc: Remove memusage.h
And use machine-sp.h instead. The Linux implementation is based on already provided CURRENT_STACK_FRAME (used on nptl code) and STACK_GROWS_UPWARD is replaced with _STACK_GROWS_UP.
Diffstat (limited to 'malloc/memusage.c')
-rw-r--r--malloc/memusage.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/malloc/memusage.c b/malloc/memusage.c
index eaf4965..6391d88 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -33,8 +33,9 @@
#include <sys/mman.h>
#include <sys/time.h>
-#include <memusage.h>
#include <hp-timing.h>
+#include <machine-sp.h>
+#include <stackinfo.h> /* For _STACK_GROWS_UP */
/* Pointer to the real functions. These are determined used `dlsym'
when really needed. */
@@ -155,10 +156,10 @@ update_data (struct header *result, size_t len, size_t old_len)
the main thread and it is the first call to any of these
functions. */
if (__glibc_unlikely (!start_sp))
- start_sp = GETSP ();
+ start_sp = __thread_stack_pointer ();
- uintptr_t sp = GETSP ();
-#ifdef STACK_GROWS_UPWARD
+ uintptr_t sp = __thread_stack_pointer ();
+#ifdef _STACK_GROWS_UP
/* This can happen in threads where we didn't catch the thread's
stack early enough. */
if (__glibc_unlikely (sp < start_sp))
@@ -268,7 +269,7 @@ me (void)
const char *outname;
if (!start_sp)
- start_sp = GETSP ();
+ start_sp = __thread_stack_pointer ();
outname = getenv ("MEMUSAGE_OUTPUT");
if (outname != NULL && outname[0] != '\0'
@@ -334,7 +335,7 @@ static void
__attribute__ ((constructor))
init (void)
{
- start_sp = GETSP ();
+ start_sp = __thread_stack_pointer ();
if (!initialized)
me ();
}