Merge "'make bionic-unit-tests' now builds all the required binaries"
diff --git a/libc/Android.bp b/libc/Android.bp
index 688dd61..c7f52b1 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1849,6 +1849,7 @@
cc_defaults {
name: "crt_defaults",
defaults: ["linux_bionic_supported"],
+ vendor_available: true,
no_default_compiler_flags: true,
@@ -1878,6 +1879,7 @@
cc_defaults {
name: "crt_so_defaults",
+ vendor_available: true,
arch: {
mips: {
cflags: ["-fPIC"],
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index a4faf85..2a42390 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -54,6 +54,7 @@
#include <sys/_system_properties.h>
#include <sys/system_properties.h>
+#include "private/ErrnoRestorer.h"
#include "private/bionic_futex.h"
#include "private/bionic_lock.h"
#include "private/bionic_macros.h"
@@ -1096,6 +1097,9 @@
}
int __system_properties_init() {
+ // This is called from __libc_init_common, and should leave errno at 0 (http://b/37248982).
+ ErrnoRestorer errno_restorer;
+
if (initialized) {
list_foreach(contexts, [](context_node* l) { l->reset_access(); });
return 0;
diff --git a/libc/private/CachedProperty.h b/libc/private/CachedProperty.h
index 0a41abf..f0c81c9 100644
--- a/libc/private/CachedProperty.h
+++ b/libc/private/CachedProperty.h
@@ -33,10 +33,11 @@
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
-#include "private/bionic_lock.h"
-
+// Cached system property lookup. For code that needs to read the same property multiple times,
+// this class helps optimize those lookups.
class CachedProperty {
public:
+ // The lifetime of `property_name` must be greater than that of this CachedProperty.
CachedProperty(const char* property_name)
: property_name_(property_name),
prop_info_(nullptr),
@@ -45,9 +46,10 @@
cached_value_[0] = '\0';
}
+ // Returns the current value of the underlying system property as cheaply as possible.
+ // The returned pointer is valid until the next call to Get. It is the caller's responsibility
+ // to provide a lock for thread-safety.
const char* Get() {
- lock_.lock();
-
// Do we have a `struct prop_info` yet?
if (prop_info_ == nullptr) {
// `__system_property_find` is expensive, so only retry if a property
@@ -67,12 +69,10 @@
}
}
- lock_.unlock();
return cached_value_;
}
private:
- Lock lock_;
const char* property_name_;
const prop_info* prop_info_;
uint32_t cached_area_serial_;
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index fa35984..ab7c247 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -511,7 +511,7 @@
def parse_file(self, file_path):
logging.debug("parse_file: %s" % file_path)
with open(file_path) as fp:
- parse_open_file(fp)
+ self.parse_open_file(fp)
class State: