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