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.map.txt b/libc/libc.map.txt
index c000fb1..1f523d7 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1297,6 +1297,11 @@
     tmpfile64;
 } LIBC;
 
+LIBC_O {
+  global:
+    pthread_getname_np;
+} LIBC_N;
+
 LIBC_PRIVATE {
   global:
     ___Unwind_Backtrace; # arm
@@ -1514,4 +1519,4 @@
     vfdprintf; # arm x86 mips nobrillo
     wait3; # arm x86 mips nobrillo
     wcswcs; # arm x86 mips nobrillo
-} LIBC_N;
+} LIBC_O;