Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
9679492c
Commit
9679492c
authored
Jul 07, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match resetprop files with AOSP
parent
f3b68e65
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
19 deletions
+39
-19
_system_properties.h
jni/resetprop/_system_properties.h
+12
-12
bionic_macros.h
jni/resetprop/bionic_macros.h
+20
-0
system_properties.cpp
jni/resetprop/system_properties.cpp
+2
-2
system_properties.h
jni/resetprop/system_properties.h
+5
-5
No files found.
jni/resetprop/_system_properties.h
View file @
9679492c
...
...
@@ -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_find
2
** objects will have seen __system_property_serial
2
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_find
2
** 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_find
2
.
** 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_serial
2 to confirm dirty, or __system_property_find2
** to check if the property now exists. If a call to __system_property_add
2
** or __system_property_update
2
has completed between two calls to
** __system_property_area_serial
2
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_find
2
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_find
2
. 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_find
2
.
** __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_wait
2
instead. */
/* Deprecated: use __system_property_wait instead. */
uint32_t
__system_property_wait_any2
(
uint32_t
old_serial
);
__END_DECLS
...
...
jni/resetprop/bionic_macros.h
View file @
9679492c
...
...
@@ -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_
jni/resetprop/system_properties.cpp
View file @
9679492c
...
...
@@ -1205,7 +1205,7 @@ uint32_t __system_property_area_serial2() {
if
(
!
pa
)
{
return
-
1
;
}
// Make sure this read fulfilled before __system_property_serial
2
// 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_read
2
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
);
...
...
jni/resetprop/system_properties.h
View file @
9679492c
...
...
@@ -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_callback
2
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_callback
2
() 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_callback
2
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_callback
2
instead. */
/* Deprecated. Use __system_property_read_callback instead. */
int
__system_property_get2
(
const
char
*
name
,
char
*
value
);
/* Deprecated. Use __system_property_foreach
2
instead. */
/* Deprecated. Use __system_property_foreach instead. */
const
prop_info
*
__system_property_find_nth2
(
unsigned
n
);
__END_DECLS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment