1 On Solaris we want to use DISM or ISM e.g. Dynamic Intimate Shared Memory or Intimate Shared Memory
2 which is available via sysv SHM only. This patch changes the default shared memory system to be sysv
3 on Solaris based systems e.g. which have SHM_SHARE_MMU (which translates to ISM) and when SHM_PAGEABLE
4 is defined in sys/shm.h we set the default PG_SHMAT_FLAGS to SHM_PAGEABLE which will lead to DISM being
5 used. The patch to the postgresql.conf.sample is to show that sysv is the default for Solaris and the
6 ordering is changed as by default it used to be mmap and posix for the defaults and you could always
7 override things using the sysv setting.
10 diff -wpruN '--exclude=*.orig' a~/src/backend/utils/misc/postgresql.conf.sample a/src/backend/utils/misc/postgresql.conf.sample
11 --- a~/src/backend/utils/misc/postgresql.conf.sample 1970-01-01 00:00:00
12 +++ a/src/backend/utils/misc/postgresql.conf.sample 1970-01-01 00:00:00
14 #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
15 #logical_decoding_work_mem = 64MB # min 64kB
16 #max_stack_depth = 2MB # min 100kB
17 -#shared_memory_type = mmap # the default is the first option
18 +#shared_memory_type = sysv # the default is the first option
19 # supported by the operating system:
24 # (change requires restart)
25 -#dynamic_shared_memory_type = posix # the default is the first option
26 +#dynamic_shared_memory_type = sysv # the default is the first option
27 # supported by the operating system:
33 # (change requires restart)
34 diff -wpruN '--exclude=*.orig' a~/src/include/portability/mem.h a/src/include/portability/mem.h
35 --- a~/src/include/portability/mem.h 1970-01-01 00:00:00
36 +++ a/src/include/portability/mem.h 1970-01-01 00:00:00
39 #define IPCProtection (0600) /* access/modify by user only */
41 +#ifdef SHM_PAGEABLE /* use dynamic intimate shared memory on Solaris */
42 +#define PG_SHMAT_FLAGS SHM_PAGEABLE
44 #ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */
45 #define PG_SHMAT_FLAGS SHM_SHARE_MMU
47 #define PG_SHMAT_FLAGS 0
51 /* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */
53 diff -wpruN '--exclude=*.orig' a~/src/include/storage/dsm_impl.h a/src/include/storage/dsm_impl.h
54 --- a~/src/include/storage/dsm_impl.h 1970-01-01 00:00:00
55 +++ a/src/include/storage/dsm_impl.h 1970-01-01 00:00:00
57 #define DSM_IMPL_WINDOWS 3
58 #define DSM_IMPL_MMAP 4
60 +#ifdef HAVE_SYS_SHM_H
62 + * For SHM_SHARE_MMU.
68 * Determine which dynamic shared memory implementations will be supported
69 * on this platform, and which one will be the default.
73 #ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
74 #define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
77 +#undef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
78 +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
84 diff -wpruN '--exclude=*.orig' a~/src/include/storage/pg_shmem.h a/src/include/storage/pg_shmem.h
85 --- a~/src/include/storage/pg_shmem.h 1970-01-01 00:00:00
86 +++ a/src/include/storage/pg_shmem.h 1970-01-01 00:00:00
89 extern void *UsedShmemSegAddr;
91 -#if !defined(WIN32) && !defined(EXEC_BACKEND)
92 +#if defined(SHM_SHARE_MMU)
93 +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV
94 +#elif !defined(WIN32) && !defined(EXEC_BACKEND)
95 #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP
97 #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV