Add posix_memalign(), fix minor bug in nmalloc.
commit11e45f670654c8b84541cb74fbde240db9359143
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 28 Apr 2009 16:30:10 +0000 (28 09:30 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 28 Apr 2009 16:30:10 +0000 (28 09:30 -0700)
treea8ab26c33fbbd7fb6acee94f639701cbd4072f8f
parent2fca187cbe114a66387ef08096dd41355a9c73d0
Add posix_memalign(), fix minor bug in nmalloc.

Add the posix_memalign() function in all of its glory.  Our new slab
allocator already does most of the job perfectly, particularly when
alignment < size (for things like cache-line aligned allocations).

Correct a bug in _vmem_alloc() for the case where (size) is much larger
then (alignment).  The hack to get mmap() to return an aligned address
was not properly unmapping temporarily-mapped space.

Reformulate how errno is set to support posix_memalign(), which is defined
by the standard to return the error rather then set errno.

Requested-by: Hasso Tepper <hasso@estpak.ee>
include/stdlib.h
lib/libc/stdlib/nmalloc.c