summaryrefslogtreecommitdiffstats
path: root/src/strings.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2008-12-10 14:35:46 -0800
committerRoland McGrath <[email protected]>2008-12-10 14:35:46 -0800
commit5947852c0582c214be42a63fc32b3f1809282d6d (patch)
treedbf8d3cf87bf7098e58158097562f15431a25841 /src/strings.c
parent5d3bd4f85e36c733d25d5cee69938401bea64478 (diff)
Portability branch migrated from Monotone.
Diffstat (limited to 'src/strings.c')
-rw-r--r--src/strings.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/strings.c b/src/strings.c
index b2109961..1058103d 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -51,6 +51,10 @@
#include <system.h>
+#ifndef MAP_POPULATE
+# define MAP_POPULATE 0
+#endif
+
/* Prototypes of local functions. */
static int read_fd (int fd, const char *fname, off64_t fdlen);
@@ -491,8 +495,13 @@ map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
fd, start_off);
if (mem != MAP_FAILED)
{
+#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
+# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
+#endif
+#ifdef POSIX_MADV_SEQUENTIAL
/* We will go through the mapping sequentially. */
(void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
+#endif
break;
}
if (errno != EINVAL && errno != ENOMEM)