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.mips.brillo.map b/libc/libc.mips.brillo.map
index 8e5fdf4..3d11408 100644
--- a/libc/libc.mips.brillo.map
+++ b/libc/libc.mips.brillo.map
@@ -1255,6 +1255,11 @@
     tmpfile64;
 } LIBC;
 
+LIBC_O {
+  global:
+    pthread_getname_np;
+} LIBC_N;
+
 LIBC_PRIVATE {
   global:
     __accept4; # arm x86 mips
@@ -1289,4 +1294,4 @@
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-} LIBC_N;
+} LIBC_O;