Apply local modifications to permit running the test suite in CTS.

Test: None. No build file yet.

Bug: 32616302
Change-Id: I3140c8861063f9750b9e70c2cee7ae563322bf5b
diff --git a/README.google b/README.google
index 134f759..1f0ac50 100644
--- a/README.google
+++ b/README.google
@@ -6,4 +6,7 @@
 See README.md for information on how to update this repository.
 
 Local Modifications:
-None.
+- Remove usage of pthread_cancel()
+- Use __android_log_print() instead of fprintf()
+- Rename main() to seccomp_test_main()
+- Add get_seccomp_test_list()
diff --git a/linux/seccomp_bpf.c b/linux/seccomp_bpf.c
index c5abe7f..6b3f424 100644
--- a/linux/seccomp_bpf.c
+++ b/linux/seccomp_bpf.c
@@ -1613,7 +1613,7 @@
 		if (!s->tid)
 			continue;
 		if (pthread_kill(s->tid, 0)) {
-			pthread_cancel(s->tid);
+			//pthread_cancel(s->tid);  // ANDROID
 			pthread_join(s->tid, &status);
 		}
 	}
@@ -2106,4 +2106,10 @@
  * - ...
  */
 
+// ANDROID:begin
+struct __test_metadata* get_seccomp_test_list() {
+  return __test_list;
+}
+// ANDROID:end
+
 TEST_HARNESS_MAIN
diff --git a/linux/test_harness.h b/linux/test_harness.h
index 977a6af..01e534e 100644
--- a/linux/test_harness.h
+++ b/linux/test_harness.h
@@ -49,6 +49,8 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#include <android/log.h>  // ANDROID
+
 /* All exported functionality should be declared through this macro. */
 #define TEST_API(x) _##x
 
@@ -206,9 +208,11 @@
 } while (0)
 
 /* Unconditional logger for internal use. */
+// ANDROID:begin
 #define __TH_LOG(fmt, ...) \
-		fprintf(TH_LOG_STREAM, "%s:%d:%s:" fmt "\n", \
+		__android_log_print(ANDROID_LOG_ERROR, "SeccompBpfTest-KernelUnit", "%s:%d:%s:" fmt "\n", \
 			__FILE__, __LINE__, _metadata->name, ##__VA_ARGS__)
+// ANDROID:end
 
 /* Defines the test function and creates the registration stub. */
 #define _TEST(test_name) __TEST_IMPL(test_name, -1)
@@ -301,7 +305,7 @@
 		if (!__constructor_order) \
 			__constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; \
 	} \
-	int main(int argc, char **argv) { \
+	int seccomp_test_main(int argc, char **argv) { /* ANDROID */ \
 		return test_harness_run(argc, argv); \
 	}