python/hypothesis: update to 6.122.3
[oi-userland.git] / components / database / postgresql-14 / patches / dism.patch
blob65e176cddb8bddf1519a64a6b0e71835bdff3871
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.
8 --
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
13 @@ -141,16 +141,16 @@
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:
20 - # mmap
21 # sysv
22 + # mmap
23 # windows
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:
28 - # posix
29 # sysv
30 + # posix
31 # windows
32 # mmap
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
37 @@ -14,11 +14,15 @@
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
43 +#else
44 #ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */
45 #define PG_SHMAT_FLAGS SHM_SHARE_MMU
46 #else
47 #define PG_SHMAT_FLAGS 0
48 #endif
49 +#endif
51 /* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */
52 #ifndef MAP_ANONYMOUS
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
56 @@ -19,7 +19,14 @@
57 #define DSM_IMPL_WINDOWS 3
58 #define DSM_IMPL_MMAP 4
60 +#ifdef HAVE_SYS_SHM_H
62 + * For SHM_SHARE_MMU.
63 + */
64 +#include <sys/shm.h>
65 +#endif
67 +/*
68 * Determine which dynamic shared memory implementations will be supported
69 * on this platform, and which one will be the default.
71 @@ -34,7 +41,12 @@
72 #define USE_DSM_SYSV
73 #ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
74 #define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
75 +#else
76 +#ifdef SHM_SHARE_MMU
77 +#undef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
78 +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
79 #endif
80 +#endif
81 #define USE_DSM_MMAP
82 #endif
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
87 @@ -70,7 +70,9 @@
88 #endif
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
96 #elif !defined(WIN32)
97 #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV