termux-packages/packages/openmpi/opal-mca-memory-patcher-mem...

57 lines
1.9 KiB
Diff
Raw Normal View History

2021-01-14 22:10:42 +01:00
--- ./opal/mca/memory/patcher/memory_patcher_component.c.orig 2020-12-18 20:44:38.000000000 +0000
+++ ./opal/mca/memory/patcher/memory_patcher_component.c 2021-01-14 20:52:10.545290518 +0000
@@ -55,10 +55,17 @@
#include "memory_patcher.h"
#undef opal_memory_changed
2020-07-04 12:57:22 +02:00
-#define HAS_SHMDT (defined(SYS_shmdt) || \
- (defined(IPCOP_shmdt) && defined(SYS_ipc)))
-#define HAS_SHMAT (defined(SYS_shmat) || \
- (defined(IPCOP_shmat) && defined(SYS_ipc)))
+#if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc))
+# define HAS_SHMDT 1
+# else
+# define HAS_SHMDT 0
+#endif
+
+#if defined(SYS_shmat) || (defined(IPCOP_shmat) && defined(SYS_ipc))
+# define HAS_SHMAT 1
+# else
+# define HAS_SHMAT 0
+#endif
2021-01-14 22:10:42 +01:00
static int patcher_open(void);
static int patcher_close(void);
@@ -281,9 +288,9 @@
advice == MADV_FREE ||
#endif
#ifdef MADV_REMOVE
- advice == MADV_REMOVE ||
+ advice == MADV_REMOVE
#endif
- advice == POSIX_MADV_DONTNEED)
+ )
{
opal_mem_hooks_release_hook (start, length, false);
}
@@ -473,8 +480,8 @@
2019-10-25 21:16:53 +02:00
uintptr_t attach_addr = (uintptr_t)shmaddr;
2017-11-22 19:38:47 +01:00
2019-10-25 21:16:53 +02:00
if (shmflg & SHM_RND) {
- attach_addr -= ((uintptr_t)shmaddr) % SHMLBA;
- size += ((uintptr_t)shmaddr) % SHMLBA;
+ attach_addr -= ((uintptr_t)shmaddr) % sysconf(_SC_PAGESIZE);
+ size += ((uintptr_t)shmaddr) % sysconf(_SC_PAGESIZE);
}
opal_mem_hooks_release_hook ((void*)attach_addr, size, false);
}
2021-01-14 22:10:42 +01:00
@@ -486,7 +493,7 @@
2020-07-04 12:57:22 +02:00
unsigned long ret;
ret = memory_patcher_syscall(SYS_ipc, IPCOP_shmat,
shmid, shmflg, &shmaddr, shmaddr);
- result = (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)shmaddr;
+ result = (ret > -(unsigned long)sysconf(_SC_PAGESIZE)) ? (void *)ret : (void *)shmaddr;
#endif
} else {
result = original_shmat (shmid, shmaddr, shmflg);