Remove some globals from system_properties

pa_size should be static to prop_area, so make it so.

__system_property_area__ was reused for various purposes, but
realistically is a deprecated symbol and this finally separates us
from it.

Bug: 36001741
Test: boot bullhead, system property unit tests
Change-Id: I39663cc3b613093fa4c728b21d8ba58754f8e105
diff --git a/libc/system_properties/prop_area.h b/libc/system_properties/prop_area.h
index 6b74e10..10c1adb 100644
--- a/libc/system_properties/prop_area.h
+++ b/libc/system_properties/prop_area.h
@@ -29,6 +29,7 @@
 #include <stdatomic.h>
 #include <stdint.h>
 #include <string.h>
+#include <sys/mman.h>
 
 #include "private/bionic_macros.h"
 
@@ -94,6 +95,12 @@
   static prop_area* map_prop_area_rw(const char* filename, const char* context,
                                      bool* fsetxattr_failed);
   static prop_area* map_prop_area(const char* filename);
+  static void unmap_prop_area(prop_area** pa) {
+    if (*pa) {
+      munmap(*pa, pa_size_);
+      *pa = nullptr;
+    }
+  }
 
   prop_area(const uint32_t magic, const uint32_t version) : magic_(magic), version_(version) {
     atomic_init(&serial_, 0);
@@ -138,6 +145,13 @@
   bool foreach_property(prop_bt* const trie, void (*propfn)(const prop_info* pi, void* cookie),
                         void* cookie);
 
+  // The original design doesn't include pa_size or pa_data_size in the prop_area struct itself.
+  // Since we'll need to be backwards compatible with that design, we don't gain much by adding it
+  // now, especially since we don't have any plans to make different property areas different sizes,
+  // and thus we share these two variables among all instances.
+  static size_t pa_size_;
+  static size_t pa_data_size_;
+
   uint32_t bytes_used_;
   atomic_uint_least32_t serial_;
   uint32_t magic_;