Make res_init() work again.

Change 75830fb836621ebbcf68155e466983eb231f9ca1 to fix _nres
initialization to be thread safe accidentally introduced a behavior
change whereby res_init() became a no-op. It also failed to remove all
direct accesses to _nres.

Move the file over to C++ so we can let RAII ensure we're always holding
a lock while using the global state, make all callers access the global
state via this class, and restore the previous behavior of res_init().

Test: atest DnsResolverTest
Bug: 166235340
Change-Id: Ib390a7eac063bc0ff5eeba755e8c74ef1383004e
diff --git a/libc/dns/resolv/res_debug.c b/libc/dns/resolv/res_debug.c
index 5f889cb..4fe7553 100644
--- a/libc/dns/resolv/res_debug.c
+++ b/libc/dns/resolv/res_debug.c
@@ -126,9 +126,27 @@
 #include <strings.h>
 #include <time.h>
 
-extern const char * const _res_opcodes[];
 extern const char * const _res_sectioncodes[];
 
+__LIBC_HIDDEN__ const char* const _res_opcodes[] = {
+  "QUERY",
+  "IQUERY",
+  "CQUERYM",
+  "CQUERYU",  /* experimental */
+  "NOTIFY",  /* experimental */
+  "UPDATE",
+  "6",
+  "7",
+  "8",
+  "9",
+  "10",
+  "11",
+  "12",
+  "13",
+  "ZONEINIT",
+  "ZONEREF",
+};
+
 #ifndef _LIBC
 /*
  * Print the current options.