diff options
author | Jim Chen <nchen@mozilla.com> | 2017-04-19 19:22:10 (GMT) |
---|---|---|
committer | David Goldblatt <davidtgoldblatt@gmail.com> | 2017-04-21 17:58:42 (GMT) |
commit | ae248a216098add2d91358a49758b181bcbb4d35 (patch) | |
tree | 725c117a2958e66b13ccb1745122528f71370391 /src | |
parent | 4403c9ab441eabb6c55d93b99836f7126e46be75 (diff) | |
download | jemalloc-ae248a216098add2d91358a49758b181bcbb4d35.zip jemalloc-ae248a216098add2d91358a49758b181bcbb4d35.tar.gz jemalloc-ae248a216098add2d91358a49758b181bcbb4d35.tar.bz2 |
Use openat syscall if available
Some architectures like AArch64 may not have the open syscall because it
was superseded by the openat syscall, so check and use SYS_openat if
SYS_open is not available.
Additionally, Android headers for AArch64 define SYS_open to __NR_open,
even though __NR_open is undefined. Undefine SYS_open in that case so
SYS_openat is used.
Diffstat (limited to 'src')
-rw-r--r-- | src/pages.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pages.c b/src/pages.c index 46c307b..86907aa 100644 --- a/src/pages.c +++ b/src/pages.c @@ -351,6 +351,9 @@ os_overcommits_proc(void) { #if defined(JEMALLOC_USE_SYSCALL) && defined(SYS_open) fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY); +#elif defined(JEMALLOC_USE_SYSCALL) && defined(SYS_openat) + fd = (int)syscall(SYS_openat, + AT_FDCWD, "/proc/sys/vm/overcommit_memory", O_RDONLY); #else fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY); #endif |