summaryrefslogtreecommitdiff
path: root/libhurd-slab/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhurd-slab/slab.c')
-rw-r--r--libhurd-slab/slab.c12
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;
}
}