On Solaris we want to use DISM or ISM e.g. Dynamic Intimate Shared Memory or Intimate Shared Memory which is available via sysv SHM only. This patch changes the default shared memory system to be sysv on Solaris based systems e.g. which have SHM_SHARE_MMU (which translates to ISM) and when SHM_PAGEABLE is defined in sys/shm.h we set the default PG_SHMAT_FLAGS to SHM_PAGEABLE which will lead to DISM being used. The patch to the postgresql.conf.sample is to show that sysv is the default for Solaris and the ordering is changed as by default it used to be mmap and posix for the defaults and you could always override things using the sysv setting. -- diff -wpruN '--exclude=*.orig' a~/src/backend/utils/misc/postgresql.conf.sample a/src/backend/utils/misc/postgresql.conf.sample --- a~/src/backend/utils/misc/postgresql.conf.sample 1970-01-01 00:00:00 +++ a/src/backend/utils/misc/postgresql.conf.sample 1970-01-01 00:00:00 @@ -141,16 +141,16 @@ #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem #logical_decoding_work_mem = 64MB # min 64kB #max_stack_depth = 2MB # min 100kB -#shared_memory_type = mmap # the default is the first option +#shared_memory_type = sysv # the default is the first option # supported by the operating system: - # mmap # sysv + # mmap # windows # (change requires restart) -#dynamic_shared_memory_type = posix # the default is the first option +#dynamic_shared_memory_type = sysv # the default is the first option # supported by the operating system: - # posix # sysv + # posix # windows # mmap # (change requires restart) diff -wpruN '--exclude=*.orig' a~/src/include/portability/mem.h a/src/include/portability/mem.h --- a~/src/include/portability/mem.h 1970-01-01 00:00:00 +++ a/src/include/portability/mem.h 1970-01-01 00:00:00 @@ -14,11 +14,15 @@ #define IPCProtection (0600) /* access/modify by user only */ +#ifdef SHM_PAGEABLE /* use dynamic intimate shared memory on Solaris */ +#define PG_SHMAT_FLAGS SHM_PAGEABLE +#else #ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */ #define PG_SHMAT_FLAGS SHM_SHARE_MMU #else #define PG_SHMAT_FLAGS 0 #endif +#endif /* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */ #ifndef MAP_ANONYMOUS diff -wpruN '--exclude=*.orig' a~/src/include/storage/dsm_impl.h a/src/include/storage/dsm_impl.h --- a~/src/include/storage/dsm_impl.h 1970-01-01 00:00:00 +++ a/src/include/storage/dsm_impl.h 1970-01-01 00:00:00 @@ -19,7 +19,14 @@ #define DSM_IMPL_WINDOWS 3 #define DSM_IMPL_MMAP 4 +#ifdef HAVE_SYS_SHM_H /* + * For SHM_SHARE_MMU. + */ +#include +#endif + +/* * Determine which dynamic shared memory implementations will be supported * on this platform, and which one will be the default. */ @@ -34,7 +41,12 @@ #define USE_DSM_SYSV #ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE #define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV +#else +#ifdef SHM_SHARE_MMU +#undef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV #endif +#endif #define USE_DSM_MMAP #endif diff -wpruN '--exclude=*.orig' a~/src/include/storage/pg_shmem.h a/src/include/storage/pg_shmem.h --- a~/src/include/storage/pg_shmem.h 1970-01-01 00:00:00 +++ a/src/include/storage/pg_shmem.h 1970-01-01 00:00:00 @@ -70,7 +70,9 @@ #endif extern void *UsedShmemSegAddr; -#if !defined(WIN32) && !defined(EXEC_BACKEND) +#if defined(SHM_SHARE_MMU) +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV +#elif !defined(WIN32) && !defined(EXEC_BACKEND) #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP #elif !defined(WIN32) #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV