diff options
author | jasone <jasone@FreeBSD.org> | 2006-03-28 22:16:04 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2006-03-28 22:16:04 +0000 |
commit | 1a854b0cf791f1081496d7fa2abb3db55adf618d (patch) | |
tree | 84a037e2c3045c857b69637dcac7955a8481ae0d /lib/libc/stdlib/malloc.c | |
parent | 91d320d3aa6099a2fd925118aa8bd0b06b763b8f (diff) | |
download | FreeBSD-src-1a854b0cf791f1081496d7fa2abb3db55adf618d.zip FreeBSD-src-1a854b0cf791f1081496d7fa2abb3db55adf618d.tar.gz |
Add malloc_usable_size(3).
Discussed with: arch@
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 91357a0..359c98a 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -3489,6 +3489,26 @@ free(void *ptr) */ /******************************************************************************/ /* + * Begin non-standard functions. + */ + +size_t +malloc_usable_size(const void *ptr) +{ + + assert(ptr != NULL); + + if (ptr == &nil) + return (0); + else + return (isalloc(ptr)); +} + +/* + * End non-standard functions. + */ +/******************************************************************************/ +/* * Begin library-private functions, used by threading libraries for protection * of malloc during fork(). These functions are only called if the program is * running in threaded mode, so there is no need to check whether the program |