diff options
author | Zheng Da <zhengda1936@gmail.com> | 2010-05-28 13:12:54 +0200 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2010-05-28 13:12:54 +0200 |
commit | f23a1dec7638dad40438d8ca948b3276a22ca527 (patch) | |
tree | 3d73666bec034bb03f060a25503454d04bc6e1dd /libhurd-slab/slab.c | |
parent | f8046a15b31c4d40eaff5894586c14176acad9bb (diff) |
Use malloc/free by default in slab.
Diffstat (limited to 'libhurd-slab/slab.c')
-rw-r--r-- | libhurd-slab/slab.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libhurd-slab/slab.c b/libhurd-slab/slab.c index 7645b27b..375df6d9 100644 --- a/libhurd-slab/slab.c +++ b/libhurd-slab/slab.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <errno.h> -#include <sys/mman.h> #include <assert.h> #include <string.h> #include <unistd.h> @@ -77,9 +76,8 @@ allocate_buffer (struct hurd_slab_space *space, size_t size, void **ptr) return space->allocate_buffer (space->hook, size, ptr); else { - *ptr = mmap (NULL, size, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); - if (*ptr == MAP_FAILED) + *ptr = malloc (size); + if (*ptr == NULL) return errno; else return 0; @@ -95,10 +93,8 @@ deallocate_buffer (struct hurd_slab_space *space, void *buffer, size_t size) return space->deallocate_buffer (space->hook, buffer, size); else { - if (munmap (buffer, size) == -1) - return errno; - else - return 0; + free (buffer); + return 0; } } |