diff --git a/include/asterisk/file.h b/include/asterisk/file.h
index 5b795d430d8fbf1584a171b37bb75674add5a359..0f33b53405394da31ab28e77b6db3d03a481de25 100644
--- a/include/asterisk/file.h
+++ b/include/asterisk/file.h
@@ -29,6 +29,10 @@
 #include <fcntl.h>
 #endif
 
+#ifdef HAVE_MMAP
+#include <sys/mman.h>
+#endif
+
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif