diff options
author | Vedant Kumar <vsk@apple.com> | 2016-11-23 22:23:42 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-11-23 22:23:42 +0000 |
commit | 311e7441fece63269ce3850133e2315a24a3b47d (patch) | |
tree | a5263bf823f13af9a25aaf2b2a455534dec958cf | |
parent | 7fd4a452d78a570068b44b01cfa80886017daa92 (diff) |
[test] Use a helper macro to refer to MAP_ANON (NFC)
Some of our internal bots use old SDK's which don't define MAP_ANON.
Use a helper macro to pass the right flag into mmap().
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287833 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/tsan/ignore_lib5.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/tsan/ignore_lib5.cc b/test/tsan/ignore_lib5.cc index 330f11034..d7cd28500 100644 --- a/test/tsan/ignore_lib5.cc +++ b/test/tsan/ignore_lib5.cc @@ -27,14 +27,20 @@ # define MAP_32BIT 0 #endif +#ifdef __APPLE__ +# define TSAN_MAP_ANON MAP_ANON +#else +# define TSAN_MAP_ANON MAP_ANONYMOUS +#endif + void *thr(void *arg) { // This thread creates lots of separate mappings in /proc/self/maps before // the ignored library. for (int i = 0; i < 10000; i++) { if (i == 5000) barrier_wait(&barrier); - mmap(0, 4096, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0); - mmap(0, 4096, PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0); + mmap(0, 4096, PROT_READ, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0); + mmap(0, 4096, PROT_WRITE, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0); } return 0; } |