Revert "[sanitizer] Intercept sched_getaffinity."

This reverts commit r187788.

The test case is unreliable (as the test may be run in a situation in
which it has no affinity with cpu0). This can be recommitted with a more
reliable test - possibly using CPU_COUNT != 0 instead (I wasn't entirely
sure that a process was guaranteed to have at least one affinity, though
it seems reasonable, or I'd have made the change myself).

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187841 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/msan/tests/msan_test.cc b/lib/msan/tests/msan_test.cc
index 4d6ad7d..479b1f1 100644
--- a/lib/msan/tests/msan_test.cc
+++ b/lib/msan/tests/msan_test.cc
@@ -2054,13 +2054,6 @@
 
 #endif // MSAN_TEST_DISABLE_DLOPEN
 
-TEST(MemorySanitizer, sched_getaffinity) {
-  cpu_set_t mask;
-  int res = sched_getaffinity(getpid(), sizeof(mask), &mask);
-  ASSERT_EQ(0, res);
-  ASSERT_TRUE(CPU_ISSET(0, &mask));
-}
-
 TEST(MemorySanitizer, scanf) {
   const char *input = "42 hello";
   int* d = new int;
diff --git a/lib/sanitizer_common/sanitizer_common_interceptors.inc b/lib/sanitizer_common/sanitizer_common_interceptors.inc
index bf99141..4ac17e8 100644
--- a/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -1762,20 +1762,6 @@
 #define INIT_CONFSTR
 #endif
 
-#if SANITIZER_INTERCEPT_SCHED_GETAFFINITY
-INTERCEPTOR(int, sched_getaffinity, int pid, SIZE_T cpusetsize, void *mask) {
-  void *ctx;
-  COMMON_INTERCEPTOR_ENTER(ctx, sched_getaffinity, pid, cpusetsize, mask);
-  int res = REAL(sched_getaffinity)(pid, cpusetsize, mask);
-  if (mask && !res)
-    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, mask, cpusetsize);
-  return res;
-}
-#define INIT_SCHED_GETAFFINITY INTERCEPT_FUNCTION(sched_getaffinity);
-#else
-#define INIT_SCHED_GETAFFINITY
-#endif
-
 #define SANITIZER_COMMON_INTERCEPTORS_INIT \
   INIT_STRCMP;                             \
   INIT_STRNCMP;                            \
@@ -1835,5 +1821,4 @@
   INIT_TCGETATTR;                          \
   INIT_REALPATH;                           \
   INIT_CANONICALIZE_FILE_NAME;             \
-  INIT_CONFSTR;                            \
-  INIT_SCHED_GETAFFINITY;
+  INIT_CONFSTR;
diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h
index e3aaf21..a601c7f 100644
--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -110,6 +110,5 @@
 # define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS
 # define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_CONFSTR SI_MAC || SI_LINUX_NOT_ANDROID
-# define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
 
 #endif  // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
diff --git a/lib/tsan/rtl/tsan_stat.cc b/lib/tsan/rtl/tsan_stat.cc
index dacc498..fe0c09c 100644
--- a/lib/tsan/rtl/tsan_stat.cc
+++ b/lib/tsan/rtl/tsan_stat.cc
@@ -353,7 +353,6 @@
   name[StatInt_realpath]                 = "  realpath                        ";
   name[StatInt_canonicalize_file_name]   = "  canonicalize_file_name          ";
   name[StatInt_confstr]                  = "  confstr                         ";
-  name[StatInt_sched_getaffinity]        = "  sched_getaffinity               ";
 
   name[StatAnnotation]                   = "Dynamic annotations               ";
   name[StatAnnotateHappensBefore]        = "  HappensBefore                   ";
diff --git a/lib/tsan/rtl/tsan_stat.h b/lib/tsan/rtl/tsan_stat.h
index b3a850a..606ee66 100644
--- a/lib/tsan/rtl/tsan_stat.h
+++ b/lib/tsan/rtl/tsan_stat.h
@@ -348,7 +348,6 @@
   StatInt_realpath,
   StatInt_canonicalize_file_name,
   StatInt_confstr,
-  StatInt_sched_getaffinity,
 
   // Dynamic annotations.
   StatAnnotation,