summaryrefslogtreecommitdiff
path: root/ace/os_include/sys/mman.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/os_include/sys/mman.h')
-rw-r--r--ace/os_include/sys/mman.h66
1 files changed, 60 insertions, 6 deletions
diff --git a/ace/os_include/sys/mman.h b/ace/os_include/sys/mman.h
index 8bed6554ec9..886de74b0ab 100644
--- a/ace/os_include/sys/mman.h
+++ b/ace/os_include/sys/mman.h
@@ -2,19 +2,19 @@
//=============================================================================
/**
- * @file mman.h
+ * @file os_mman.h
*
* memory management declarations
*
* $Id$
*
- * @author Don Hinton <dhinton@ieee.org>
+ * @author Don Hinton <dhinton@dresystems.com>
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
-#ifndef ACE_OS_INCLUDE_SYS_MMAN_H
-#define ACE_OS_INCLUDE_SYS_MMAN_H
+#ifndef ACE_OS_INCLUDE_SYS_OS_MMAN_H
+#define ACE_OS_INCLUDE_SYS_OS_MMAN_H
#include "ace/pre.h"
@@ -26,9 +26,63 @@
#include "ace/os_include/sys/types.h"
+#if defined (ACE_LACKS_MMAP)
+# define ACE_LACKS_SYS_MMAN_H
+#endif /* ACE_LACKS_MMAP */
+
#if !defined (ACE_LACKS_SYS_MMAN_H)
-# include /**/ <sys/mman.h>
+ // Fixes a problem with HP/UX.
+# if defined (ACE_HAS_BROKEN_MMAP_H)
+ extern "C" {
+# endif /* ACE_HAS_BROKEN_MMAP_H */
+# include /**/ <sys/mman.h>
+# if defined (ACE_HAS_BROKEN_MMAP_H)
+ }
+# endif /* ACE_HAS_BROKEN_MMAP_H */
+#endif /* ACE_LACKS_SYS_MMAN_H */
+
+// Place all additions (especially function declarations) within extern "C" {}
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#if defined (ACE_LACKS_SYS_MMAN_H)
+# define PROT_READ 0
+# define PROT_WRITE 0
+# define PROT_EXEC 0
+# define PROT_NONE 0
+# define PROT_RDWR 0
+# define MAP_PRIVATE 0
+# define MAP_SHARED 0
+# define MAP_FIXED 0
+#elif defined (ACE_WIN32)
+ // These two may be used for internal flags soon:
+# define MAP_PRIVATE 1
+# define MAP_SHARED 2
+# define MAP_FIXED 4
+ // MMAP flags
+# define PROT_READ PAGE_READONLY
+# define PROT_WRITE PAGE_READWRITE
+# define PROT_RDWR PAGE_READWRITE
+/* If we can find suitable use for these flags, here they are:
+PAGE_WRITECOPY
+PAGE_EXECUTE
+PAGE_EXECUTE_READ
+PAGE_EXECUTE_READWRITE
+PAGE_EXECUTE_WRITECOPY
+PAGE_GUARD
+PAGE_NOACCESS
+PAGE_NOCACHE */
#endif /* !ACE_LACKS_SYS_MMAN_H */
+#if !defined (PROT_RDWR)
+# define PROT_RDWR (PROT_READ|PROT_WRITE)
+#endif /* PROT_RDWR */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#include "ace/post.h"
-#endif /* ACE_OS_INCLUDE_SYS_MMAN_H */
+#endif /* ACE_OS_INCLUDE_SYS_OS_MMAN_H */