libc: __system_property_set uses writev to write atomically
__system_property_set sometimes produces broken_pipe error
when trying to write a property.
This change improves error messages and uses writev() instead
of sequence of send() calls.
Bug: http://b/35381074
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I7a5b169c015db4e6b720370e58662de8206d1086
diff --git a/libc/private/libc_logging.h b/libc/private/libc_logging.h
index 49a5a3c..d3e4140 100644
--- a/libc/private/libc_logging.h
+++ b/libc/private/libc_logging.h
@@ -97,6 +97,14 @@
#endif
int __libc_write_log(int pri, const char* _Nonnull tag, const char* _Nonnull msg);
+#define CHECK(predicate) \
+ do { \
+ if (!(predicate)) { \
+ __libc_fatal("%s:%d: %s CHECK '" #predicate "' failed", \
+ __FILE__, __LINE__, __FUNCTION__); \
+ } \
+ } while(0)
+
__END_DECLS
#endif