summaryrefslogtreecommitdiffstats
path: root/base
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused logging symbols.Tomasz Wasilczyk2018-07-312-14/+0
| | | | | | Bug: 35361699 Test: flash sailfish, it boots Change-Id: Ie545145789faa299e1228b6c91566e0767f7ea79
* Merge "Revert "Revert "base: add support for tagged fd closure to unique_fd."""Treehugger Robot2018-07-203-14/+129
|\
| * Revert "Revert "base: add support for tagged fd closure to unique_fd.""Josh Gao2018-07-203-14/+129
| | | | | | | | | | | | | | | | | | | | | | | | Use __attribute__((weak)) to check for fdsan availability at runtime, to support being used when built with the NDK while targeting older platform versions. This reverts commit af798acaea49b8d9150b94eb9f5f11450a6b8893. Bug: http://b/110100358 Test: m libjnitest Change-Id: Ie59d041d69cc3d4b6c59412d706f702dd1d2dab2
* | ParseInt/ParseUint: allow validation only.Steven Moreland2018-07-202-2/+14
|/ | | | | | | | | Removes segfault if T* out != nullptr and just returns validation result. Bug: 110758329 Test: libbase_test Change-Id: I0f304533a7076bba977fbd1a715b9cc0d9e58e75
* Revert "base: add support for tagged fd closure to unique_fd."Josh Gao2018-07-193-123/+14
| | | | | | | | | This reverts commit fcf2c01b5599a96b968afb1528c996d9486937b0. Commit broke full-eng, because libbase is being compiled against the NDK. Test: treehugger Change-Id: I8447b6a7fc33e6aa34cec0f037727322fa824446
* debuggerd_handler: use syscall(__NR_close) instead of close.Josh Gao2018-07-181-3/+7
| | | | | | | | Avoid bionic's file descriptor ownership checks by calling the close syscall manually. Test: debuggerd_test Change-Id: I10af6aca0e66fe030fd7a53506ae61c87695641d
* base: add support for tagged fd closure to unique_fd.Josh Gao2018-07-183-14/+123
| | | | | Test: libbase_test Change-Id: Ibba5e60d7007265a566eb8f76021d5dbeb734532
* libbase: return different result depend on the errnoliwugang2018-07-122-4/+48
| | | | | | | | | | | | | | | In the RemoveFileIfExists it always return true even if error appeared when using stat function. It should distinguish different error. Such as ENOENT and ENOTDIR we exactly know the file does not exist. But EACCES(current user has not all search permission in the file path) and other errors appeared we can't know whether file exits. So we should return false indicate there are some error appeared. Test: ran unit tests Change-Id: I75788bf0621040812413d52596b5effb628fd0b1 Signed-off-by: liwugang <liwugang@xiaomi.com>
* Move libbacktrace off cutils.Elliott Hughes2018-07-112-0/+11
| | | | | | | | | | | There's still <cutils/atomic.h> in a test, but I don't understand why that isn't just std::atomic. Also add a shared tgkill wrapper to libbase. Bug: N/A Test: ran tests Change-Id: Idd4baa1e1670a84b3a8f35803cc5ffe5aae008a6
* libbase: assume clang.Elliott Hughes2018-07-025-31/+2
| | | | | | Bug: N/A Test: builds Change-Id: Ic3d3bee26496025324a3d070e3fcbf6d7b917709
* Fix misleading commentsInseob Kim2018-06-291-5/+5
| | | | | | Bug: N/A Test: N/A Change-Id: I714a0f523eb803cb619acaddff4f769622cfc8b6
* libbase: switch to #pragma once.Elliott Hughes2018-06-2619-76/+19
| | | | | | Bug: N/A Test: builds Change-Id: I125498ac4257ac4e901c6f2a5f1bfac1432d859d
* Simplify __attribute__((__printf__)) use.Elliott Hughes2018-06-261-7/+3
| | | | | | | | We don't need this now everyone's using clang... Bug: http://b/69933068 Test: ran tests Change-Id: I88f0cf03981ade47e210387fd6f3a2706dfeb9b8
* Do not customize __format__ for Windows/MinGW to gnu_printfPirama Arumuga Nainar2018-06-251-10/+1
| | | | | | | | | | | | | Bug: http://b/69933090 Bug: http://b/69933068 MinGW uses gnu_printf to force C99 printf analysis with GCC, but clang does not support gnu_printf. So just use the default that's used for other platforms. This also mirrors upstream commit https://sourceforge.net/p/mingw-w64/mingw-w64/ci/015e637b4b24d9915162ab877ed539ad0e657951/. Test: m native-host-cross with Clang. Change-Id: I3deb266d70e25296c4ae1d58637afbabc3d949c1
* Adapt to switch to Clang for Windows host buildsPirama Arumuga Nainar2018-06-251-1/+1
| | | | | | | | | | | Bug: http://b/69933068 Bug: http://b/91353691: std::chrono_utils is not available in the libstdc++ in the mingw/gcc prebuilts. They can be used once we switch to using libc++ for Windows host. Test: m native-host-cross with Clang Change-Id: If9f0f1f201d5e4e445890075ad64c2d6086b0491
* libbase: fix libbase_test.logging.StdioLogger.Elliott Hughes2018-06-061-26/+25
| | | | | | | | | | | I don't think the StdioLogger test ever passed. Move GetFileBasename to where we can use it from StdioLogger, and undo the mix of anonymous namespace vs static to consistently use static (which is the majority) while we're touching those lines. Bug: N/A Test: ran tests Change-Id: I95b3966cdb8af642bed71752bd7d4e3a86ac84ca
* Merge "libbase: add host properties support."Elliott Hughes2018-05-294-29/+72
|\
| * libbase: add host properties support.Elliott Hughes2018-05-244-29/+72
| | | | | | | | | | | | | | | | Move init and libprocessgroup away from their existing hacks. Bug: N/A Test: ran tests Change-Id: Ifabdd38e0cc4ab2582f1ea59d32159d386f48eb6
* | Build adbd for recoveryJiyong Park2018-05-241-0/+1
|/ | | | | | | | | | | | | adbd (and its dependencies) are marked as recovery_available:true so that recovery version of the binary is built separately from the one for system partition. This allows us to stop copying the system version to the recovery partition and also opens up the way to enable shared libraries in the recovery partition. Then we can also build adbd as a dynamic executable. Bug: 79146551 Test: m -j adbd.recovery Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
* Add StdioLogger for command-line tools.Elliott Hughes2018-05-235-25/+83
| | | | | | Bug: N/A Test: ran tests Change-Id: If366a4ea25aea1becdd3e443eba225e9bd52ebba
* Mark as recovery_available: trueJiyong Park2018-05-141-0/+1
| | | | | | | | | | | | Libraries that are direct or indirect dependencies of modules installed to recovery partition (e.g. toybox) are marked as recovery_available: true. This allows a recovery variant of the lib is created when it is depended by other recovery or recovery_available modules. Bug: 67916654 Bug: 64960723 Test: m -j Change-Id: Ie59155c08890e96ce1893fa3687afcf763d7aea3
* Add test_suites lines.Elliott Hughes2018-04-271-0/+1
| | | | | | Bug: N/A Test: builds Change-Id: Ic5e2b9206bcfcb53c774989013b5db6aab462e42
* Add android::base::ParseByteCount.Elliott Hughes2018-04-192-7/+66
| | | | | | Bug: N/A Test: ran tests Change-Id: Ib2adcf0a5b9494fcf8259b29974303e8516a9ad9
* Add SIZEOF_MEMBER.Elliott Hughes2018-04-113-0/+35
| | | | | | Bug: N/A Test: ran tests Change-Id: Icb7e8ae83d242c867b71a990b08eb1a62ed1482c
* base: kernel logging get pre-opened /dev/kmsg from environmentMark Salyzyn2018-04-091-1/+19
| | | | | | | | | | | | | | | If the environment has an instance of /dev/kmsg pre-opened, pick up. This happens when an init script has 'file w /dev/kmsg' in the daemon's recipe. libcutils android_get_control_file operations are open-coded to prevent a dependency on libcutils itself. Also check that /dev/kmsg file descriptor is valid and open'd for write only. Test: check to make sure init() kernel logging still works Bug: 77541952 Bug: 77661605 Change-Id: I007553acd594ef0815d23f32f8aa2867518570ba
* Merge "Allow android::base::ScopeGuard in STL containers"Treehugger Robot2018-03-262-5/+28
|\
| * Allow android::base::ScopeGuard in STL containersLuis Hector Chavez2018-03-262-5/+28
| | | | | | | | | | | | | | | | | | | | | | This change lets android::base::ScopeGuard be useful in STL containers (e.g. std::vector<android::base::ScopeGuard<std::function<void()>>>). It also provides perfect forwarding for android::base::make_scope_guard. Bug: 34764308 Test: libbase_test Change-Id: I7d1e5494b0f0695763cff0700efdb9ec18ae85c8
* | base: export GetThreadId.Josh Gao2018-03-164-37/+81
|/ | | | | | | and stop using the incorrect (on Mac) version in adb.. Test: mma Change-Id: If28f6c8d73b03db863be13ed88df81422c3aef87
* base: Add TemporaryFile::DoNotRemove().Yabin Cui2018-03-082-1/+7
| | | | | | Bug: http://b/73127105 Test: none. Change-Id: I563c12bfb629ddd630568dda4817fb10cc9940a8
* Base: Add default tag manipulationAndreas Gampe2018-03-063-10/+60
| | | | | | | | | | Allow the default tag (the program name) to be overwritten. Bug: 34867873 Test: m Test: logging_test Test: manual Change-Id: I4ef32bad413a7cc82e46ce16a2f26212925964b1
* EndsWith *suffix*Erik Kline2018-02-271-2/+2
| | | | | | | Possibly an old copy and paste error. Test: built Change-Id: Ie86203d65b4021ed4b787d2330729ab0b1d73e9d
* Base: Add an NDK-compiled version of libbaseAndreas Gampe2018-02-203-19/+29
| | | | | | | | | To support building libraries for CTS. Bug: 73206894 Bug: 73659009 Test: mmma system/core/base Change-Id: I630be88f44cf5cefcb13be7959fc1a710686e29b
* bpfmt.Elliott Hughes2018-02-161-1/+5
| | | | | | Bug: N/A Test: builds Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
* Prevent WaitForProperty() from using ~100% of CPU time on 32bit buildsyusukes2018-02-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* base: adb.exe build errorMark Salyzyn2018-02-053-3/+4
| | | | | | | | | | Windows build of adb is broken because of the lack of std::chrono_literals and for an implementation of android::boot_clock::now(). Test: make -j vts Bug: 72941624 Change-Id: Ie65fed098633eb45a94ea553de6903f8d55fc5b2
* Adding per-method clang thread safety annotationsVasily Tarasov2018-01-101-0/+6
| | | | Change-Id: Ic92702a06570f48bf3616e0ee959a49e1eec393c
* Add __attribute__((__format__)) to fastboot's die().Elliott Hughes2018-01-091-7/+7
| | | | | | | | Also make the <android-base/stringprintf.h> macro less likely to collide. Bug: N/A Test: builds Change-Id: I868a0a0002c9c53c1ec0670153df2af5f48fd969
* Merge "Use LOG_TAG instead of binary name as a tag."Tomasz Wasilczyk2017-12-202-46/+82
|\
| * Use LOG_TAG instead of binary name as a tag.Tomasz Wasilczyk2017-12-202-46/+82
| | | | | | | | | | | | | | | | | | If LOG_TAG was not defined, falling back to a default behaviour (using binary name). Bug: 35361699 Test: manual Change-Id: I209a6ebaf0df882f98642f6d1831766cb296c951
* | Merge "Add std::string StartsWith*/EndsWith* overloads."Elliott Hughes2017-12-203-4/+46
|\ \
| * | Add std::string StartsWith*/EndsWith* overloads.Elliott Hughes2017-12-203-4/+46
| |/ | | | | | | | | | | | | | | | | We should have done this from the beginning. Thanks to Windows, we're not going to be able to switch libbase over to std::string_view any time soon. Bug: N/A Test: ran tests Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
* / base: extract {ASSERT,EXPECT}_MATCH helpers from debuggerd_test.Josh Gao2017-12-193-0/+76
|/ | | | | | | | Add some helper macros that perform regex string matching to <android-base/test_utils.h>. Test: libbase_test32/64 on host Change-Id: I1b0f03dc73f8b4fdfb8ac6c75d59ef421e0e9640
* Merge "Add OWNERS."Elliott Hughes2017-12-071-0/+3
|\
| * Add OWNERS.Elliott Hughes2017-12-071-0/+3
| | | | | | | | | | | | Bug: N/A Test: N/A Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
* | base: allow creating tempfile in a custom temporary dir.Yabin Cui2017-12-062-0/+5
|/ | | | | | Bug: http://b/70232908 Test: none. Change-Id: I24b894793f6725186b3582a91db083427e51aa5a
* Fix / suppress new unused warnings for mingw+clangDan Willemsen2017-11-293-1/+4
| | | | | | Bug: 69933068 Test: mmma system/core Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
* Use -Werror in system/coreChih-Hung Hsieh2017-11-011-7/+6
| | | | | | | | | * Move -Wall -Werror from cppflags to cflags. * Fix/suppress warning on unused variables. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I1e05e96a1d0bcb2ccef1ce456504b3af57167cc5
* Add test for android::base::Split with a trailing empty part.Tom Cherry2017-10-261-0/+8
| | | | | Test: this new unit test Change-Id: Ia14ba878f2866e333a69f1e6f7f56b66a7e657a5
* libcutils: Fix thread ID on macOSChristopher N. Hesse2017-10-221-1/+3
| | | | | | | macOS 10.12 / Xcode 8 actively prohibit the syscall(2) usage. Change-Id: I91ff16600a76e97d0b9b5db7e8905b969fb3482f
* Use target.linux for all linux kernel based targetsDan Willemsen2017-10-161-17/+6
| | | | | | | | | | Now in Android.bp files, target.linux applies to all targets running a linux kernel (android, linux_glibc, linux_bionic). So common flags/sources/etc can be combined instead of copying them to each target. Test: m Change-Id: If7ad138ea1c540c160731f86b6ccc0daa5c69b83