[RFC] how to get the size of a malloc(9) block ?

Luigi Rizzo rizzo at iet.unipi.it
Thu Nov 28 11:17:59 UTC 2013


in porting some linux kernel code to FreeBSD we
stumbled upon ksize(), which returns the
actual size of a kmalloc() block.

We could easily implement it as the first part
of realloc(9) -- see kern/kern_malloc.c

Would it make sense to add this to the malloc(9) API ?
The userspace equivalent seems to be
malloc_usable_size(3) which according to the
manpage appeared in FreeBSD 7.0

cheers
luigi


More information about the freebsd-current mailing list