mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
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
|
/* Read the global serial number of the system properties
|
||||||
**
|
**
|
||||||
** Called to predict if a series of cached __system_property_find2
|
** Called to predict if a series of cached __system_property_find
|
||||||
** objects will have seen __system_property_serial2 values change.
|
** objects will have seen __system_property_serial values change.
|
||||||
** But also aids the converse, as changes in the global serial can
|
** 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
|
** 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
|
** 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
|
** changes have occurred since last. If there is, one may check each individual
|
||||||
** __system_property_serial2 to confirm dirty, or __system_property_find2
|
** __system_property_serial to confirm dirty, or __system_property_find
|
||||||
** to check if the property now exists. If a call to __system_property_add2
|
** to check if the property now exists. If a call to __system_property_add
|
||||||
** or __system_property_update2 has completed between two calls to
|
** or __system_property_update has completed between two calls to
|
||||||
** __system_property_area_serial2 then the second call will return a larger
|
** __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
|
** 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
|
** 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.
|
** a property now exists.
|
||||||
**
|
**
|
||||||
** Returns the serial number on success, -1 on error.
|
** 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);
|
int __system_property_del(const char *name);
|
||||||
|
|
||||||
/* Update the value of a system property returned by
|
/* 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
|
** that has write access to the property area, and that process
|
||||||
** must handle sequencing to ensure that only one property is
|
** must handle sequencing to ensure that only one property is
|
||||||
** updated at a time.
|
** 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);
|
int __system_property_update2(prop_info *pi, const char *value, unsigned int len);
|
||||||
|
|
||||||
/* Read the serial number of a system property returned by
|
/* 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.
|
** 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();
|
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);
|
uint32_t __system_property_wait_any2(uint32_t old_serial);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#ifndef _BIONIC_MACROS_H_
|
#ifndef _BIONIC_MACROS_H_
|
||||||
#define _BIONIC_MACROS_H_
|
#define _BIONIC_MACROS_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// Frameworks OpenGL code currently leaks this header and allows
|
// Frameworks OpenGL code currently leaks this header and allows
|
||||||
// collisions with other declarations, e.g., from libnativehelper.
|
// collisions with other declarations, e.g., from libnativehelper.
|
||||||
// TODO: Remove once cleaned up. b/18334516
|
// TODO: Remove once cleaned up. b/18334516
|
||||||
@ -46,4 +48,22 @@
|
|||||||
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
|
? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
|
||||||
: (1UL << (32 - __builtin_clz(static_cast<unsigned int>(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_
|
#endif // _BIONIC_MACROS_H_
|
||||||
|
@ -1205,7 +1205,7 @@ uint32_t __system_property_area_serial2() {
|
|||||||
if (!pa) {
|
if (!pa) {
|
||||||
return -1;
|
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);
|
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);
|
memcpy(value_buf, pi->value, len);
|
||||||
value_buf[len] = '\0';
|
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);
|
atomic_thread_fence(memory_order_acquire);
|
||||||
if (serial == load_const_atomic(&(pi->serial), memory_order_relaxed)) {
|
if (serial == load_const_atomic(&(pi->serial), memory_order_relaxed)) {
|
||||||
callback(cookie, pi->name, value_buf, serial);
|
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.
|
* 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.
|
* 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
|
* 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.
|
* 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. */
|
/* Deprecated. In Android O and above, there's no limit on property name length. */
|
||||||
#define PROP_NAME_MAX 32
|
#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);
|
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);
|
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);
|
const prop_info* __system_property_find_nth2(unsigned n);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
Loading…
Reference in New Issue
Block a user