Skip to content

Commit db854c3

Browse files
committed
memory/patcher: do not hook madvise if the syscall doesn't exist
Fixes #1565 Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
1 parent 0d5a57d commit db854c3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ static void *intercept_mremap (void *start, size_t oldlen, size_t newlen, int fl
182182

183183
#endif
184184

185+
#if defined (SYS_madvise)
186+
185187
static int (*original_madvise) (void *, size_t, int);
186188

187189
static int intercept_madvise (void *start, size_t length, int advice)
@@ -208,6 +210,8 @@ static int intercept_madvise (void *start, size_t length, int advice)
208210
return result;
209211
}
210212

213+
#endif
214+
211215
#if defined SYS_brk
212216

213217
#if OPAL_MEMORY_PATCHER_HAVE___CURBRK
@@ -400,10 +404,12 @@ static int patcher_open (void)
400404
}
401405
#endif
402406

407+
#if defined (SYS_madvise)
403408
rc = opal_patcher->patch_symbol ("madvise", (uintptr_t)intercept_madvise, (uintptr_t *) &original_madvise);
404409
if (OPAL_SUCCESS != rc) {
405410
return rc;
406411
}
412+
#endif
407413

408414
#if defined(SYS_shmdt) && defined(__linux__)
409415
rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt);

0 commit comments

Comments
 (0)