History log of /system/core/base/properties.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
af05f3b76162d264b997008b1e3747a7702f2ecd 15-Feb-2018 Andreas Gampe <agampe@google.com> Base: Add an NDK-compiled version of libbase

To support building libraries for CTS.

Bug: 73206894
Bug: 73659009
Test: mmma system/core/base
Change-Id: I630be88f44cf5cefcb13be7959fc1a710686e29b
/system/core/base/properties.cpp
d3b94042418ed7561efca31d2a460588ab1fc161 14-Feb-2018 yusukes <yusukes@google.com> Prevent WaitForProperty() from using ~100% of CPU time on 32bit builds

Since 'struct timespec' members (time_t and long) are both 32bit on
32bit systems, and std::chrono::{seconds,nanoseconds}::rep are both
>32bit, timespec members assigned in DurationToTimeSpec() can have a
negative value, especially when WaitForProperty() is called with the
default timeout value which is std::chrono::milliseconds::max().

Regarding functionality, passing a negative value to
__system_property_wait() is okay because WaitForProperty() still
waits for the property value (so unit tests are passing), but while
WaitForProperty() does that, the function, to be more exact,
SystemProperties::Wait() in bionic/, consumes ~100% of CPU time. This
happens because SystemProperties::Wait() which implements
__system_property_wait() has a tight while-loop with a __futex_wait()
call, and the futex call immediately returns EINVAL when the timespec
passed in has a negative value.

With this CL, WaitForProperty() will never pass a negative timespec
to __system_property_wait(), and therefore the __futex_wait() call
in bionic works as expected without consuming too much CPU time even
on 32bit systems.

Bug: None
Test: libbase_test32 still passes
Test: strace no longer shows repeated EINVALs from __futex_wait
Change-Id: Id1834fac8cd2876b02dbe4479bf3d3eda2fa7da1
/system/core/base/properties.cpp
31121cafecefdd8153563632fc717a930598bd7c 10-Oct-2017 Tom Cherry <tomcherry@google.com> Move some properties users to __system_property_read_callback()

This is needed if they will ever handle ro. properties that have
values longer than 92 characters.

Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
/system/core/base/properties.cpp
3d5729402ed14093cfc5385aa4cc67ce90b9b780 25-Mar-2017 Tom Cherry <tomcherry@google.com> Fix timeouts for android::base::WaitForProperty*

std::chrono doesn't handle integer overflow, so using
std::chrono::milliseconds::max() to indicate an infinite timeout is
not handled well in the current code. It causes an 'absolute_timeout'
earlier in time than 'now' and causes the associated WaitForProperty*
functions to return immediately.

Also, any duration_cast from relative_timeout to nanoseconds would
cause the same issue, as it would overflow in the conversion and
result in an invalid results.

This change prevents any duration_casts of relative_timeout to
nanoseconds and replaces the logic to wait on an absolute timeout with
logic that compares the time elapsed to the provided relative timeout.

This change also includes a test that std::chrono::milliseconds::max()
does not return immediately and that negative values do return immediately.

Test: Boot bullhead + libbase_test

Change-Id: I335bfa7ba71e86c20119a0ed46014cad44361162
/system/core/base/properties.cpp
e2d986daa644672dabe5f594701028dc04fcc5ce 27-Feb-2017 Keun-young Park <keunyoung@google.com> add base::WaitForPropertyCreation

- unlike base::WaitForProperty, which waits for specific value to
be set, this one only waits until the property is created.

bug: 35178781
Test: added unit test
Change-Id: Idbf98c2152fe768357302f6b69310c55305f5d54
/system/core/base/properties.cpp
03edc9f7647b3ac9db8a4743acc98b0238b846fb 17-Feb-2017 Elliott Hughes <enh@google.com> Add timeout support to android::base::WaitForProperty.

Bug: http://b/35201172
Test: ran tests
Change-Id: I025aa0217dc94fabf0eb076b285a84866b00e741
/system/core/base/properties.cpp
b30769a87acc15fc7f628d8541cdf97aba22e2e2 11-Feb-2017 Elliott Hughes <enh@google.com> Implement android::base::WaitForProperty.

Also adapt libcutils to the bionic change that was necessary for this.

Bug: http://b/35201172
Test: ran tests
Change-Id: I72a98b70b03d23e958b46778b505fbd5c86c32ae
/system/core/base/properties.cpp
da46b392f10d2809b5696632f67485f272ec5698 12-Oct-2016 Elliott Hughes <enh@google.com> Move off std::sto* function which abort on failure.

Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
/system/core/base/properties.cpp
1e88c8c0ac31a4b07da4228ed9ac41e50ae56886 22-Sep-2016 Elliott Hughes <enh@google.com> Add std::string system property functions.

Makes it easier to write correct code in a world where the maximum
property key/value lengths change.

Bug: http://b/23102347
Test: libbase_test64
Change-Id: I100f00904221bbcef9e8786a4e6e30428039bb49
/system/core/base/properties.cpp