blob: 0b31c2716b1dde0e683a588e761650545741df69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
Description: implemetes malloc_usable_size() - GNU extension
Index: b/usr/src/head/malloc.h
===================================================================
--- a/usr/src/head/malloc.h
+++ b/usr/src/head/malloc.h
@@ -70,6 +70,8 @@ void free(void *);
void *realloc(void *, size_t);
void *calloc(size_t, size_t);
+size_t malloc_usable_size (void *);
+
#if __cplusplus >= 199711L
} /* end of namespace std */
@@ -77,6 +79,7 @@ using std::malloc;
using std::free;
using std::realloc;
using std::calloc;
+using std::malloc_usable_size;
#endif /* __cplusplus >= 199711L */
#endif /* (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || ... */
Index: b/usr/src/lib/libc/port/gen/malloc.c
===================================================================
--- a/usr/src/lib/libc/port/gen/malloc.c
+++ b/usr/src/lib/libc/port/gen/malloc.c
@@ -921,3 +921,8 @@ cleanfree(void *ptr)
freeidx = 0;
Lfree = NULL;
}
+
+size_t malloc_usable_size (void *ptr)
+{
+ return SIZE(BLOCK(ptr));
+}
Index: b/usr/src/lib/libc/port/mapfile-vers
===================================================================
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -279,6 +279,7 @@ SYMBOL_VERSION DYSON_1 {
get_current_dir_name;
getgrouplist;
gnu_strerror_r;
+ malloc_usable_size;
mempcpy;
memrchr;
mkostemp;
|