Fix for systems that do not have the MAP_FILE macro defined.
authorTim King <taking@cs.nyu.edu>
Wed, 24 Oct 2012 21:28:52 +0000 (21:28 +0000)
committerTim King <taking@cs.nyu.edu>
Wed, 24 Oct 2012 21:28:52 +0000 (21:28 +0000)
src/parser/memory_mapped_input_buffer.cpp

index 5c2523aabf83c3c48033535fbdec4899d71e65a8..ff3f8b27d55587c0d9de1151960e2b0ee886db25 100644 (file)
@@ -95,8 +95,14 @@ static ANTLR3_UINT32 MemoryMapFile(pANTLR3_INPUT_STREAM input,
     return ANTLR3_ERR_NOFILE;
   }
 
-  input->data = mmap(0, input->sizeBuf, PROT_READ, MAP_FILE | MAP_PRIVATE, fd,
-                     0);
+
+#ifndef MAP_FILE
+  //Tim: This is required for SunOS
+  input->data = mmap(0, input->sizeBuf, PROT_READ, MAP_PRIVATE, fd, 0);
+#else
+  input->data = mmap(0, input->sizeBuf, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0);
+#endif
+
   errno = 0;
   if(intptr_t(input->data) == -1) {
     return ANTLR3_ERR_NOMEM;