Use the common interception machinery for mlock/munlock/mlockall/munlockall.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161938 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc
index 59903f7..fa77c89 100644
--- a/lib/asan/asan_interceptors.cc
+++ b/lib/asan/asan_interceptors.cc
@@ -131,6 +131,12 @@
 long long strtoll(const char *nptr, char **endptr, int base);  // NOLINT
 # endif
 
+// mlock/munlock
+int mlock(const void *addr, size_t len);
+int munlock(const void *addr, size_t len);
+int mlockall(int flags);
+int munlockall(void);
+
 // Windows threads.
 # if defined(_WIN32)
 __declspec(dllimport)
@@ -294,26 +300,22 @@
 }
 
 extern "C" {
-INTERCEPTOR_ATTRIBUTE
-int mlock(const void *addr, uptr len) {
+INTERCEPTOR(int, mlock, const void *addr, uptr len) {
   MlockIsUnsupported();
   return 0;
 }
 
-INTERCEPTOR_ATTRIBUTE
-int munlock(const void *addr, uptr len) {
+INTERCEPTOR(int, munlock, const void *addr, uptr len) {
   MlockIsUnsupported();
   return 0;
 }
 
-INTERCEPTOR_ATTRIBUTE
-int mlockall(int flags) {
+INTERCEPTOR(int, mlockall, int flags) {
   MlockIsUnsupported();
   return 0;
 }
 
-INTERCEPTOR_ATTRIBUTE
-int munlockall(void) {
+INTERCEPTOR(int, munlockall, void) {
   MlockIsUnsupported();
   return 0;
 }
@@ -749,6 +751,12 @@
   ASAN_INTERCEPT_FUNC(strtoll);
 #endif
 
+  // Intercept mlock/munlock.
+  ASAN_INTERCEPT_FUNC(mlock);
+  ASAN_INTERCEPT_FUNC(munlock);
+  ASAN_INTERCEPT_FUNC(mlockall);
+  ASAN_INTERCEPT_FUNC(munlockall);
+
   // Intecept signal- and jump-related functions.
   ASAN_INTERCEPT_FUNC(longjmp);
 #if ASAN_INTERCEPT_SIGNAL_AND_SIGACTION