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.arm.map b/libc/libc.arm.map
index c22535d..6ccf37e 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -1271,6 +1271,11 @@
     tmpfile64;
 } LIBC;
 
+LIBC_O {
+  global:
+    pthread_getname_np;
+} LIBC_N;
+
 LIBC_PRIVATE {
   global:
     ___Unwind_Backtrace; # arm
@@ -1487,4 +1492,4 @@
     vfdprintf; # arm x86 mips nobrillo
     wait3; # arm x86 mips nobrillo
     wcswcs; # arm x86 mips nobrillo
-} LIBC_N;
+} LIBC_O;