Match resetprop files with AOSP
This commit is contained in:
parent
f3b68e6543
commit
9679492c28
@ -73,22 +73,22 @@ int __system_property_area_init2();
|
||||
|
||||
/* Read the global serial number of the system properties
|
||||
**
|
||||
** Called to predict if a series of cached __system_property_find2
|
||||
** objects will have seen __system_property_serial2 values change.
|
||||
** Called to predict if a series of cached __system_property_find
|
||||
** objects will have seen __system_property_serial values change.
|
||||
** But also aids the converse, as changes in the global serial can
|
||||
** also be used to predict if a failed __system_property_find2
|
||||
** also be used to predict if a failed __system_property_find
|
||||
** could in-turn now find a new object; thus preventing the
|
||||
** cycles of effort to poll __system_property_find2.
|
||||
** cycles of effort to poll __system_property_find.
|
||||
**
|
||||
** Typically called at beginning of a cache cycle to signal if _any_ possible
|
||||
** changes have occurred since last. If there is, one may check each individual
|
||||
** __system_property_serial2 to confirm dirty, or __system_property_find2
|
||||
** to check if the property now exists. If a call to __system_property_add2
|
||||
** or __system_property_update2 has completed between two calls to
|
||||
** __system_property_area_serial2 then the second call will return a larger
|
||||
** __system_property_serial to confirm dirty, or __system_property_find
|
||||
** to check if the property now exists. If a call to __system_property_add
|
||||
** or __system_property_update has completed between two calls to
|
||||
** __system_property_area_serial then the second call will return a larger
|
||||
** value than the first call. Beware of race conditions as changes to the
|
||||
** properties are not atomic, the main value of this call is to determine
|
||||
** whether the expensive __system_property_find2 is worth retrying to see if
|
||||
** whether the expensive __system_property_find is worth retrying to see if
|
||||
** a property now exists.
|
||||
**
|
||||
** Returns the serial number on success, -1 on error.
|
||||
@ -112,7 +112,7 @@ int __system_property_add2(const char *name, unsigned int namelen, const char *v
|
||||
int __system_property_del(const char *name);
|
||||
|
||||
/* Update the value of a system property returned by
|
||||
** __system_property_find2. Can only be done by a single process
|
||||
** __system_property_find. Can only be done by a single process
|
||||
** that has write access to the property area, and that process
|
||||
** must handle sequencing to ensure that only one property is
|
||||
** updated at a time.
|
||||
@ -122,7 +122,7 @@ int __system_property_del(const char *name);
|
||||
int __system_property_update2(prop_info *pi, const char *value, unsigned int len);
|
||||
|
||||
/* Read the serial number of a system property returned by
|
||||
** __system_property_find2.
|
||||
** __system_property_find.
|
||||
**
|
||||
** Returns the serial number on success, -1 on error.
|
||||
*/
|
||||
@ -136,7 +136,7 @@ uint32_t __system_property_serial2(const prop_info* pi);
|
||||
*/
|
||||
int __system_properties_init2();
|
||||
|
||||
/* Deprecated: use __system_property_wait2 instead. */
|
||||
/* Deprecated: use __system_property_wait instead. */
|
||||
uint32_t __system_property_wait_any2(uint32_t old_serial);
|
||||
|
||||
__END_DECLS
|
||||
|
@ -17,6 +17,8 @@
|
||||
#ifndef _BIONIC_MACROS_H_
|
||||
#define _BIONIC_MACROS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Frameworks OpenGL code currently leaks this header and allows
|
||||
// collisions with other declarations, e.g., from libnativehelper.
|
||||
// TODO: Remove once cleaned up. b/18334516
|
||||
@ -46,4 +48,22 @@
|
||||
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
|
||||
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
|
||||
|
||||
static constexpr uintptr_t align_down(uintptr_t p, size_t align) {
|
||||
return p & ~(align - 1);
|
||||
}
|
||||
|
||||
static constexpr uintptr_t align_up(uintptr_t p, size_t align) {
|
||||
return (p + align - 1) & ~(align - 1);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline T* align_down(T* p, size_t align) {
|
||||
return reinterpret_cast<T*>(align_down(reinterpret_cast<uintptr_t>(p), align));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline T* align_up(T* p, size_t align) {
|
||||
return reinterpret_cast<T*>(align_up(reinterpret_cast<uintptr_t>(p), align));
|
||||
}
|
||||
|
||||
#endif // _BIONIC_MACROS_H_
|
||||
|
@ -1205,7 +1205,7 @@ uint32_t __system_property_area_serial2() {
|
||||
if (!pa) {
|
||||
return -1;
|
||||
}
|
||||
// Make sure this read fulfilled before __system_property_serial2
|
||||
// Make sure this read fulfilled before __system_property_serial
|
||||
return atomic_load_explicit(pa->serial(), memory_order_acquire);
|
||||
}
|
||||
|
||||
@ -1296,7 +1296,7 @@ void __system_property_read_callback2(const prop_info* pi,
|
||||
memcpy(value_buf, pi->value, len);
|
||||
value_buf[len] = '\0';
|
||||
|
||||
// TODO: see todo in __system_property_read2 function
|
||||
// TODO: see todo in __system_property_read function
|
||||
atomic_thread_fence(memory_order_acquire);
|
||||
if (serial == load_const_atomic(&(pi->serial), memory_order_relaxed)) {
|
||||
callback(cookie, pi->name, value_buf, serial);
|
||||
|
@ -47,7 +47,7 @@ int __system_property_set2(const char* key, const char* value) __INTRODUCED_IN(1
|
||||
|
||||
/*
|
||||
* Returns a `prop_info` corresponding system property `name`, or nullptr if it doesn't exist.
|
||||
* Use __system_property_read_callback2 to query the current value.
|
||||
* Use __system_property_read_callback to query the current value.
|
||||
*
|
||||
* Property lookup is expensive, so it can be useful to cache the result of this function.
|
||||
*/
|
||||
@ -62,7 +62,7 @@ void __system_property_read_callback2(const prop_info *pi,
|
||||
|
||||
/*
|
||||
* Passes a `prop_info` for each system property to the provided
|
||||
* callback. Use __system_property_read_callback2() to read the value.
|
||||
* callback. Use __system_property_read_callback() to read the value.
|
||||
*
|
||||
* This method is for inspecting and debugging the property system, and not generally useful.
|
||||
*/
|
||||
@ -90,11 +90,11 @@ bool __system_property_wait2(const prop_info* pi,
|
||||
|
||||
/* Deprecated. In Android O and above, there's no limit on property name length. */
|
||||
#define PROP_NAME_MAX 32
|
||||
/* Deprecated. Use __system_property_read_callback2 instead. */
|
||||
/* Deprecated. Use __system_property_read_callback instead. */
|
||||
int __system_property_read2(const prop_info* pi, char* name, char* value);
|
||||
/* Deprecated. Use __system_property_read_callback2 instead. */
|
||||
/* Deprecated. Use __system_property_read_callback instead. */
|
||||
int __system_property_get2(const char* name, char* value);
|
||||
/* Deprecated. Use __system_property_foreach2 instead. */
|
||||
/* Deprecated. Use __system_property_foreach instead. */
|
||||
const prop_info* __system_property_find_nth2(unsigned n);
|
||||
|
||||
__END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user