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

Commit

Permalink
Merge pull request #18 from arthurprs/update-to-4.5.0
Browse files Browse the repository at this point in the history
CherryPick: Use openat syscall if available
  • Loading branch information
alexcrichton committed May 10, 2017
2 parents 9986533 + a241afc commit 3288e06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/jemalloc/internal/jemalloc_internal_decls.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# if !defined(SYS_write) && defined(__NR_write)
# define SYS_write __NR_write
# endif
# if defined(SYS_open) && defined(__aarch64__)
/* Android headers may define SYS_open to __NR_open even though
* __NR_open may not exist on AArch64 (superseded by __NR_openat). */
# undef SYS_open
# endif
# include <sys/uio.h>
# endif
# include <pthread.h>
Expand Down
3 changes: 3 additions & 0 deletions src/pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,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
Expand Down

0 comments on commit 3288e06

Please sign in to comment.