Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 3288e06

Browse files
authored
Merge pull request #18 from arthurprs/update-to-4.5.0
CherryPick: Use openat syscall if available
2 parents 9986533 + a241afc commit 3288e06

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/jemalloc/internal/jemalloc_internal_decls.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
# if !defined(SYS_write) && defined(__NR_write)
1515
# define SYS_write __NR_write
1616
# endif
17+
# if defined(SYS_open) && defined(__aarch64__)
18+
/* Android headers may define SYS_open to __NR_open even though
19+
* __NR_open may not exist on AArch64 (superseded by __NR_openat). */
20+
# undef SYS_open
21+
# endif
1722
# include <sys/uio.h>
1823
# endif
1924
# include <pthread.h>

src/pages.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ os_overcommits_proc(void)
250250

251251
#if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_open)
252252
fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY);
253+
#elif defined(JEMALLOC_USE_SYSCALL) && defined(SYS_openat)
254+
fd = (int)syscall(SYS_openat,
255+
AT_FDCWD, "/proc/sys/vm/overcommit_memory", O_RDONLY);
253256
#else
254257
fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY);
255258
#endif

0 commit comments

Comments
 (0)