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/net/sethostent.c b/libc/dns/net/sethostent.c
index b2b0132..483105a 100644
--- a/libc/dns/net/sethostent.c
+++ b/libc/dns/net/sethostent.c
@@ -65,14 +65,14 @@
 /*ARGSUSED*/
 sethostent(int stayopen)
 {
-	res_static rs = __res_get_static();
+	struct res_static* rs = __res_get_static();
 	if (rs) sethostent_r(&rs->hostf);
 }
 
 void
 endhostent(void)
 {
-	res_static rs = __res_get_static();
+	struct res_static* rs = __res_get_static();
 	if (rs) endhostent_r(&rs->hostf);
 }