Add pthread_getname_np.

Also guard both these GNU extensions with _GNU_SOURCE.

Also improve the tests to test each case on both the current thread and
another thread, since the code paths are totally different.

Bug: http://b/27810459
Change-Id: I72b05bca5c5b6ca8ba4585b8edfb716a1c252f92
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 63c82e5..4622c7f 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -1193,6 +1193,11 @@
     tmpfile64;
 } LIBC;
 
+LIBC_O {
+  global:
+    pthread_getname_np;
+} LIBC_N;
+
 LIBC_PRIVATE {
   global:
     android_getaddrinfofornet;
@@ -1202,4 +1207,4 @@
     free_malloc_leak_info;
     get_malloc_leak_info;
     gMallocLeakZygoteChild;
-} LIBC_N;
+} LIBC_O;