aboutsummaryrefslogtreecommitdiffstats
path: root/libcutils/mspace.c
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2010-02-14 19:01:31 -0800
committerCarl Shapiro <cshapiro@google.com>2010-02-16 14:37:43 -0800
commitb99a099cad7066274b25de9d603e7ced37d20e19 (patch)
tree88f8aa4374f279dd5f2016ac4eb3158d14f958b4 /libcutils/mspace.c
parent63b396d89c3a535675808282e2563ecabc04ef76 (diff)
downloadsystem_core-b99a099cad7066274b25de9d603e7ced37d20e19.tar.gz
system_core-b99a099cad7066274b25de9d603e7ced37d20e19.tar.bz2
system_core-b99a099cad7066274b25de9d603e7ced37d20e19.zip
Add a new method to export the extent of the break, akin to return
value of sbrk(0) in UNIX. In terms of dlmalloc and our proprietary contiguous mspace class, this is the highest address returned by its morecore method.
Diffstat (limited to 'libcutils/mspace.c')
-rw-r--r--libcutils/mspace.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libcutils/mspace.c b/libcutils/mspace.c
index 63b199d5..6d3b35c8 100644
--- a/libcutils/mspace.c
+++ b/libcutils/mspace.c
@@ -271,4 +271,16 @@ size_t destroy_contiguous_mspace(mspace msp) {
}
return 0;
}
+
+void *contiguous_mspace_sbrk0(mspace msp) {
+ struct mspace_contig_state *cs;
+ mstate ms;
+ const unsigned int pagesize = PAGESIZE;
+
+ ms = (mstate)msp;
+ cs = (struct mspace_contig_state *)((uintptr_t)ms & ~(pagesize-1));
+ assert(cs->magic == CONTIG_STATE_MAGIC);
+ assert(cs->m == ms);
+ return cs->brk;
+}
#endif