perl/Test-Simple: update to 1.302205
[oi-userland.git] / components / database / postgresql-16 / patches / 01-dism.patch
blob4685e5cbd3359664d9cbbb89a987cc8e0a640af3
1 On Solaris/illumos 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/illumos 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.
9 --- postgresql-16.2/src/include/portability/mem.h.orig 2024-02-05 22:41:37.000000000 +0100
10 +++ postgresql-16.2/src/include/portability/mem.h 2024-03-02 16:06:23.000890754 +0100
11 @@ -14,11 +14,15 @@
13 #define IPCProtection (0600) /* access/modify by user only */
15 +#ifdef SHM_PAGEABLE /* use dynamic intimate shared memory on Solaris */
16 +#define PG_SHMAT_FLAGS SHM_PAGEABLE
17 +#else
18 #ifdef SHM_SHARE_MMU /* use intimate shared memory on Solaris */
19 #define PG_SHMAT_FLAGS SHM_SHARE_MMU
20 #else
21 #define PG_SHMAT_FLAGS 0
22 #endif
23 +#endif
25 /* Linux prefers MAP_ANONYMOUS, but the flag is called MAP_ANON on other systems. */
26 #ifndef MAP_ANONYMOUS
27 --- postgresql-16.2/src/include/storage/pg_shmem.h.orig 2024-02-05 22:41:37.000000000 +0100
28 +++ postgresql-16.2/src/include/storage/pg_shmem.h 2024-03-02 16:06:23.001219767 +0100
29 @@ -70,7 +70,9 @@
30 #endif
31 extern PGDLLIMPORT void *UsedShmemSegAddr;
33 -#if !defined(WIN32) && !defined(EXEC_BACKEND)
34 +#if defined(SHM_SHARE_MMU)
35 +#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV
36 +#elif !defined(WIN32) && !defined(EXEC_BACKEND)
37 #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP
38 #elif !defined(WIN32)
39 #define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_SYSV
40 --- postgresql-16.2/src/include/storage/dsm_impl.h.orig 2024-02-05 22:41:37.000000000 +0100
41 +++ postgresql-16.2/src/include/storage/dsm_impl.h 2024-03-02 16:06:23.001054296 +0100
42 @@ -19,6 +19,13 @@
43 #define DSM_IMPL_WINDOWS 3
44 #define DSM_IMPL_MMAP 4
46 +#ifdef HAVE_SYS_SHM_H
47 + /*
48 + * For SHM_SHARE_MMU.
49 + */
50 +#include <sys/shm.h>
51 +#endif
54 * Determine which dynamic shared memory implementations will be supported
55 * on this platform, and which one will be the default.
56 @@ -34,6 +41,11 @@
57 #define USE_DSM_SYSV
58 #ifndef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
59 #define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
60 +#else
61 +#ifdef SHM_SHARE_MMU
62 +#undef DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE
63 +#define DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE DSM_IMPL_SYSV
64 +#endif
65 #endif
66 #define USE_DSM_MMAP
67 #endif
68 --- postgresql-16.2/src/backend/utils/misc/postgresql.conf.sample.orig 2024-02-05 22:41:37.000000000 +0100
69 +++ postgresql-16.2/src/backend/utils/misc/postgresql.conf.sample 2024-03-02 16:06:23.000657525 +0100
70 @@ -144,16 +144,16 @@
71 #autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
72 #logical_decoding_work_mem = 64MB # min 64kB
73 #max_stack_depth = 2MB # min 100kB
74 -#shared_memory_type = mmap # the default is the first option
75 +#shared_memory_type = sysv # the default is the first option
76 # supported by the operating system:
77 - # mmap
78 # sysv
79 + # mmap
80 # windows
81 # (change requires restart)
82 -#dynamic_shared_memory_type = posix # the default is usually the first option
83 +#dynamic_shared_memory_type = sysv # the default is usually the first option
84 # supported by the operating system:
85 - # posix
86 # sysv
87 + # posix
88 # windows
89 # mmap
90 # (change requires restart)