Introduce api to track fd ownership in libc.

Add two functions to allow objects that own a file descriptor to
enforce that only they can close their file descriptor.

Use them in FILE* and DIR*.

Bug: http://b/110100358
Test: bionic_unit_tests
Test: aosp/master boots without errors
Test: treehugger
Change-Id: Iecd6e8b26c62217271e0822dc3d2d7888b091a45
diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h
index 747186c..5b6b77f 100644
--- a/libc/private/KernelArgumentBlock.h
+++ b/libc/private/KernelArgumentBlock.h
@@ -25,6 +25,7 @@
 #include "private/bionic_macros.h"
 
 struct abort_msg_t;
+struct libc_shared_globals;
 
 // When the kernel starts the dynamic linker, it passes a pointer to a block
 // of memory containing argc, the argv array, the environment variable array,
@@ -65,7 +66,9 @@
   char** envp;
   ElfW(auxv_t)* auxv;
 
+  // Other data that we want to pass from the dynamic linker to libc.so.
   abort_msg_t** abort_message_ptr;
+  libc_shared_globals* shared_globals;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(KernelArgumentBlock);