Use mmap/munmap only is _POSIX_MAPPED_FILES is defined.
[kopensolaris-gnu/glibc.git] / malloc / malloc.c
index 9c99c67..3d932db 100644 (file)
@@ -493,6 +493,10 @@ do {                                                                          \
 #endif
 
 
+#ifndef LACKS_UNISTD_H
+#  include <unistd.h>
+#endif
+
 /*
   Define HAVE_MMAP to optionally make malloc() use mmap() to
   allocate very large blocks.  These will be returned to the
@@ -500,7 +504,9 @@ do {                                                                          \
 */
 
 #ifndef HAVE_MMAP
-#define HAVE_MMAP 1
+# ifdef _POSIX_MAPPED_FILES
+#  define HAVE_MMAP 1
+# endif
 #endif
 
 /*
@@ -541,10 +547,6 @@ do {                                                                          \
   bsd/gnu getpagesize.h
 */
 
-#ifndef LACKS_UNISTD_H
-#  include <unistd.h>
-#endif
-
 #ifndef malloc_getpagesize
 #  ifdef _SC_PAGESIZE         /* some SVR4 systems omit an underscore */
 #    ifndef _SC_PAGE_SIZE