Merge "Add the UMOUNT_NOFOLLOW flag to <sys/mount.h>."
diff --git a/libc/dns/resolv/res_send.c b/libc/dns/resolv/res_send.c
index 6439e31..a8da3ac 100644
--- a/libc/dns/resolv/res_send.c
+++ b/libc/dns/resolv/res_send.c
@@ -402,6 +402,10 @@
 	}
 
 	if (statp->nscount == 0) {
+		// We have no nameservers configured, so there's no point trying.
+		// Tell the cache the query failed, or any retries and anyone else asking the same
+		// question will block for PENDING_REQUEST_TIMEOUT seconds instead of failing fast.
+		_resolv_cache_query_failed(statp->netid, buf, buflen);
 		errno = ESRCH;
 		return (-1);
 	}
diff --git a/linker/Android.mk b/linker/Android.mk
index 54535fc..0ab0fda 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -6,7 +6,7 @@
     debugger.cpp \
     dlfcn.cpp \
     linker.cpp \
-    linker_allocator.cpp \
+    linker_block_allocator.cpp \
     linker_environ.cpp \
     linker_libc_support.c \
     linker_phdr.cpp \
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 593785b..ea7d637 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -50,7 +50,7 @@
 #include "private/UniquePtr.h"
 
 #include "linker.h"
-#include "linker_allocator.h"
+#include "linker_block_allocator.h"
 #include "linker_debug.h"
 #include "linker_environ.h"
 #include "linker_leb128.h"
@@ -92,8 +92,8 @@
 
 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
 
-static LinkerAllocator<soinfo> g_soinfo_allocator;
-static LinkerAllocator<LinkedListEntry<soinfo>> g_soinfo_links_allocator;
+static LinkerTypeAllocator<soinfo> g_soinfo_allocator;
+static LinkerTypeAllocator<LinkedListEntry<soinfo>> g_soinfo_links_allocator;
 
 static soinfo* solist;
 static soinfo* sonext;
diff --git a/linker/linker_allocator.cpp b/linker/linker_block_allocator.cpp
similarity index 81%
rename from linker/linker_allocator.cpp
rename to linker/linker_block_allocator.cpp
index ac11b97..fc9a75b 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "linker_allocator.h"
+#include "linker_block_allocator.h"
 #include <inttypes.h>
 #include <string.h>
 #include <sys/mman.h>
@@ -22,9 +22,9 @@
 
 #include "private/bionic_prctl.h"
 
-struct LinkerAllocatorPage {
-  LinkerAllocatorPage* next;
-  uint8_t bytes[PAGE_SIZE-sizeof(LinkerAllocatorPage*)];
+struct LinkerBlockAllocatorPage {
+  LinkerBlockAllocatorPage* next;
+  uint8_t bytes[PAGE_SIZE-sizeof(LinkerBlockAllocatorPage*)];
 };
 
 struct FreeBlockInfo {
@@ -64,7 +64,7 @@
     return;
   }
 
-  LinkerAllocatorPage* page = find_page(block);
+  LinkerBlockAllocatorPage* page = find_page(block);
 
   if (page == nullptr) {
     abort();
@@ -87,7 +87,7 @@
 }
 
 void LinkerBlockAllocator::protect_all(int prot) {
-  for (LinkerAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
+  for (LinkerBlockAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
     if (mprotect(page, PAGE_SIZE, prot) == -1) {
       abort();
     }
@@ -95,8 +95,9 @@
 }
 
 void LinkerBlockAllocator::create_new_page() {
-  LinkerAllocatorPage* page = reinterpret_cast<LinkerAllocatorPage*>(mmap(nullptr, PAGE_SIZE,
-      PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0));
+  LinkerBlockAllocatorPage* page = reinterpret_cast<LinkerBlockAllocatorPage*>(
+      mmap(nullptr, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0));
+
   if (page == MAP_FAILED) {
     abort(); // oom
   }
@@ -107,7 +108,7 @@
 
   FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
   first_block->next_block = free_block_list_;
-  first_block->num_free_blocks = (PAGE_SIZE - sizeof(LinkerAllocatorPage*))/block_size_;
+  first_block->num_free_blocks = (PAGE_SIZE - sizeof(LinkerBlockAllocatorPage*))/block_size_;
 
   free_block_list_ = first_block;
 
@@ -115,12 +116,12 @@
   page_list_ = page;
 }
 
-LinkerAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
+LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
   if (block == nullptr) {
     abort();
   }
 
-  LinkerAllocatorPage* page = page_list_;
+  LinkerBlockAllocatorPage* page = page_list_;
   while (page != nullptr) {
     const uint8_t* page_ptr = reinterpret_cast<const uint8_t*>(page);
     if (block >= (page_ptr + sizeof(page->next)) && block < (page_ptr + PAGE_SIZE)) {
diff --git a/linker/linker_allocator.h b/linker/linker_block_allocator.h
similarity index 87%
rename from linker/linker_allocator.h
rename to linker/linker_block_allocator.h
index 5d3563f..1d41806 100644
--- a/linker/linker_allocator.h
+++ b/linker/linker_block_allocator.h
@@ -21,7 +21,7 @@
 #include <limits.h>
 #include "private/bionic_macros.h"
 
-struct LinkerAllocatorPage;
+struct LinkerBlockAllocatorPage;
 
 /*
  * This class is a non-template version of the LinkerAllocator
@@ -40,10 +40,10 @@
 
  private:
   void create_new_page();
-  LinkerAllocatorPage* find_page(void* block);
+  LinkerBlockAllocatorPage* find_page(void* block);
 
   size_t block_size_;
-  LinkerAllocatorPage* page_list_;
+  LinkerBlockAllocatorPage* page_list_;
   void* free_block_list_;
 
   DISALLOW_COPY_AND_ASSIGN(LinkerBlockAllocator);
@@ -57,14 +57,15 @@
  * anonymous mmaps.
  */
 template<typename T>
-class LinkerAllocator {
+class LinkerTypeAllocator {
  public:
-  LinkerAllocator() : block_allocator_(sizeof(T)) {}
+  LinkerTypeAllocator() : block_allocator_(sizeof(T)) {}
   T* alloc() { return reinterpret_cast<T*>(block_allocator_.alloc()); }
   void free(T* t) { block_allocator_.free(t); }
   void protect_all(int prot) { block_allocator_.protect_all(prot); }
  private:
   LinkerBlockAllocator block_allocator_;
-  DISALLOW_COPY_AND_ASSIGN(LinkerAllocator);
+  DISALLOW_COPY_AND_ASSIGN(LinkerTypeAllocator);
 };
+
 #endif // __LINKER_ALLOCATOR_H
diff --git a/linker/tests/Android.mk b/linker/tests/Android.mk
index aa9491e..9a08bec 100644
--- a/linker/tests/Android.mk
+++ b/linker/tests/Android.mk
@@ -28,7 +28,7 @@
 
 LOCAL_SRC_FILES := \
   linked_list_test.cpp \
-  linker_allocator_test.cpp \
-  ../linker_allocator.cpp
+  linker_block_allocator_test.cpp \
+  ../linker_block_allocator.cpp
 
 include $(BUILD_NATIVE_TEST)
diff --git a/linker/tests/linker_allocator_test.cpp b/linker/tests/linker_block_allocator_test.cpp
similarity index 92%
rename from linker/tests/linker_allocator_test.cpp
rename to linker/tests/linker_block_allocator_test.cpp
index 9292a05..3ef0f36 100644
--- a/linker/tests/linker_allocator_test.cpp
+++ b/linker/tests/linker_block_allocator_test.cpp
@@ -20,7 +20,7 @@
 
 #include <gtest/gtest.h>
 
-#include "../linker_allocator.h"
+#include "../linker_block_allocator.h"
 
 #include <unistd.h>
 
@@ -49,7 +49,7 @@
 };
 
 TEST(linker_allocator, test_nominal) {
-  LinkerAllocator<test_struct_nominal> allocator;
+  LinkerTypeAllocator<test_struct_nominal> allocator;
 
   test_struct_nominal* ptr1 = allocator.alloc();
   ASSERT_TRUE(ptr1 != nullptr);
@@ -65,7 +65,7 @@
 }
 
 TEST(linker_allocator, test_small) {
-  LinkerAllocator<test_struct_small> allocator;
+  LinkerTypeAllocator<test_struct_small> allocator;
 
   char* ptr1 = reinterpret_cast<char*>(allocator.alloc());
   char* ptr2 = reinterpret_cast<char*>(allocator.alloc());
@@ -76,7 +76,7 @@
 }
 
 TEST(linker_allocator, test_larger) {
-  LinkerAllocator<test_struct_larger> allocator;
+  LinkerTypeAllocator<test_struct_larger> allocator;
 
   test_struct_larger* ptr1 = allocator.alloc();
   test_struct_larger* ptr2 = allocator.alloc();
@@ -99,7 +99,7 @@
 }
 
 static void protect_all() {
-  LinkerAllocator<test_struct_larger> allocator;
+  LinkerTypeAllocator<test_struct_larger> allocator;
 
   // number of allocs to reach the end of first page
   size_t n = kPageSize/sizeof(test_struct_larger) - 1;