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.brillo.map b/libc/libc.arm.brillo.map
index 2c0ab15..aca1e50 100644
--- a/libc/libc.arm.brillo.map
+++ b/libc/libc.arm.brillo.map
@@ -1271,6 +1271,11 @@
     tmpfile64;
 } LIBC;
 
+LIBC_O {
+  global:
+    pthread_getname_np;
+} LIBC_N;
+
 LIBC_PRIVATE {
   global:
     ___Unwind_Backtrace; # arm
@@ -1448,4 +1453,4 @@
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-} LIBC_N;
+} LIBC_O;