summaryrefslogtreecommitdiff
path: root/nscd/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/mem.c')
-rw-r--r--nscd/mem.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/nscd/mem.c b/nscd/mem.c
index c3a0f96702..823eda1019 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -1,5 +1,5 @@
/* Cache memory handling.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
@@ -21,6 +21,7 @@
#include <assert.h>
#include <errno.h>
#include <error.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <libintl.h>
#include <limits.h>
@@ -34,12 +35,6 @@
#include "nscd.h"
-/* Maximum alignment requirement we will encounter. */
-#define BLOCK_ALIGN_LOG 3
-#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG)
-#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1)
-
-
static int
sort_he (const void *p1, const void *p2)
{
@@ -194,7 +189,7 @@ gc (struct database_dyn *db)
highref -= BLOCK_ALIGN;
}
- /* No we can iterate over the MARK array and find bits which are not
+ /* Now we can iterate over the MARK array and find bits which are not
set. These represent memory which can be recovered. */
size_t byte = 0;
/* Find the first gap. */
@@ -494,7 +489,8 @@ mempool_alloc (struct database_dyn *db, size_t len)
+ db->head->module * sizeof (ref_t)
+ new_data_size);
- if ((!db->mmap_used || ftruncate (db->wr_fd, newtotal) != 0)
+ if ((!db->mmap_used
+ || posix_fallocate (db->wr_fd, oldtotal, newtotal) != 0)
/* Try to resize the mapping. Note: no MREMAP_MAYMOVE. */
&& mremap (db->head, oldtotal, newtotal, 0) == 0)
{