1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Allow dynamic allocation of shared memory segments.

Patch by myself and Amit Kapila.  Design help from Noah Misch.  Review
by Andres Freund.
This commit is contained in:
Robert Haas
2013-10-09 21:05:02 -04:00
parent f566515192
commit 0ac5e5a7e1
18 changed files with 2470 additions and 29 deletions

View File

@@ -0,0 +1,40 @@
/*-------------------------------------------------------------------------
*
* mem.h
* portability definitions for various memory operations
*
* Copyright (c) 2001-2013, PostgreSQL Global Development Group
*
* src/include/portability/mem.h
*
*-------------------------------------------------------------------------
*/
#ifndef MEM_H
#define MEM_H
#define IPCProtection (0600) /* access/modify by user only */
#ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */
#define PG_SHMAT_FLAGS SHM_SHARE_MMU
#else
#define PG_SHMAT_FLAGS 0
#endif
/* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
/* BSD-derived systems have MAP_HASSEMAPHORE, but it's not present (or needed) on Linux. */
#ifndef MAP_HASSEMAPHORE
#define MAP_HASSEMAPHORE 0
#endif
#define PG_MMAP_FLAGS (MAP_SHARED|MAP_ANONYMOUS|MAP_HASSEMAPHORE)
/* Some really old systems don't define MAP_FAILED. */
#ifndef MAP_FAILED
#define MAP_FAILED ((void *) -1)
#endif
#endif /* MEM_H */