summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused logging symbols.Tomasz Wasilczyk2018-07-311-5/+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-201-14/+74
|\
| * Revert "Revert "base: add support for tagged fd closure to unique_fd.""Josh Gao2018-07-201-14/+74
| | | | | | | | | | | | | | | | | | | | | | | | 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-201-2/+6
|/ | | | | | | | | 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-191-68/+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-181-14/+68
| | | | | Test: libbase_test Change-Id: Ibba5e60d7007265a566eb8f76021d5dbeb734532
* Move libbacktrace off cutils.Elliott Hughes2018-07-111-0/+5
| | | | | | | | | | | 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: add host properties support.Elliott Hughes2018-05-241-4/+4
| | | | | | | | Move init and libprocessgroup away from their existing hacks. Bug: N/A Test: ran tests Change-Id: Ifabdd38e0cc4ab2582f1ea59d32159d386f48eb6
* Add StdioLogger for command-line tools.Elliott Hughes2018-05-232-7/+28
| | | | | | Bug: N/A Test: ran tests Change-Id: If366a4ea25aea1becdd3e443eba225e9bd52ebba
* Add android::base::ParseByteCount.Elliott Hughes2018-04-191-7/+25
| | | | | | Bug: N/A Test: ran tests Change-Id: Ib2adcf0a5b9494fcf8259b29974303e8516a9ad9
* Add SIZEOF_MEMBER.Elliott Hughes2018-04-111-0/+4
| | | | | | Bug: N/A Test: ran tests Change-Id: Icb7e8ae83d242c867b71a990b08eb1a62ed1482c
* Merge "Allow android::base::ScopeGuard in STL containers"Treehugger Robot2018-03-261-5/+15
|\
| * Allow android::base::ScopeGuard in STL containersLuis Hector Chavez2018-03-261-5/+15
| | | | | | | | | | | | | | | | | | | | | | 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-161-0/+28
|/ | | | | | | and stop using the incorrect (on Mac) version in adb.. Test: mma Change-Id: If28f6c8d73b03db863be13ed88df81422c3aef87
* base: Add TemporaryFile::DoNotRemove().Yabin Cui2018-03-081-0/+4
| | | | | | Bug: http://b/73127105 Test: none. Change-Id: I563c12bfb629ddd630568dda4817fb10cc9940a8
* Base: Add default tag manipulationAndreas Gampe2018-03-061-0/+3
| | | | | | | | | | 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: adb.exe build errorMark Salyzyn2018-02-051-0/+2
| | | | | | | | | | 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-201-27/+52
|\
| * Use LOG_TAG instead of binary name as a tag.Tomasz Wasilczyk2017-12-201-27/+52
| | | | | | | | | | | | | | | | | | 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-201-0/+6
|\ \
| * | Add std::string StartsWith*/EndsWith* overloads.Elliott Hughes2017-12-201-0/+6
| |/ | | | | | | | | | | | | | | | | 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-191-0/+29
|/ | | | | | | | Add some helper macros that perform regex string matching to <android-base/test_utils.h>. Test: libbase_test32/64 on host Change-Id: I1b0f03dc73f8b4fdfb8ac6c75d59ef421e0e9640
* base: allow creating tempfile in a custom temporary dir.Yabin Cui2017-12-061-0/+1
| | | | | | Bug: http://b/70232908 Test: none. Change-Id: I24b894793f6725186b3582a91db083427e51aa5a
* Base: Warn on using ostream<< with std::string*Andreas Gampe2017-09-221-0/+32
| | | | | | | In most reasonable cases, this is actually a bug. So add a diagnostic. Test: m Change-Id: Ib506b45dbdbafcb1893486b08ef13ec8f11d0357
* Revert "Base: Delete ostream<< with std::string*"Andreas Gampe2017-09-211-10/+0
| | | | | | | | | This reverts commit 4ef5011a7b3b20703c58a1af0589e72b20812026. Reason for revert: Breaks an internal mocking case that cannot be changed. Test: m Change-Id: I83f9338bde02eb2b45b3e52b66ef78490ddbeeda
* Base: Delete ostream<< with std::string*Andreas Gampe2017-09-201-0/+10
| | | | | | | | In most reasonable cases, this is actually a bug. So delete the operator overload and let the compiler complain. Test: m Change-Id: I7d66ec2f33cc46588b6f549876241871f19ce995
* Add the Release function for TemporaryFilesTianjie Xu2017-09-111-0/+4
| | | | | | | | | | Some tests may create a File* by calling fdopen() on the temp file's fd. We should release the ownership of fd in this case to avoid the double close. Bug: 65430057 Test: libbase unit tests pass Change-Id: I54fcce2029f9a574f53afdbdda737ee58620c73a
* base: hopefully fix the mac build.Josh Gao2017-08-291-0/+14
| | | | | Test: none Change-Id: Idd4f353a158a0c096d16ecf87e239c50aba79cf7
* base: add Pipe and Socketpair wrappers.Josh Gao2017-08-281-0/+36
| | | | | | | Also, switch debuggerd_handler over to using android::base::unique_fd. Test: treehugger Change-Id: I97b2ce22f1795ce1c4370f95d00d769846cc54b8
* Define current ABI string in android-base/macros.hdimitry2017-08-231-0/+15
| | | | | Test: make Change-Id: I8200d7b3232edba43a583c5ff1e1b0f78c768f69
* Merge "Revert "base: work around thread safety analysis bug.""Josh Gao2017-08-021-3/+2
|\
| * Revert "base: work around thread safety analysis bug."Josh Gao2017-08-021-3/+2
| | | | | | | | | | | | | | | | This reverts commit e4509da961057b94bc42e71d8dcd948cae261ba8. Reason for revert: probably breaks checkbuild? Change-Id: I04a6284dee82761c90fa355da0472855a228b849
* | Merge "base: work around thread safety analysis bug."Josh Gao2017-08-021-2/+3
|\|
| * base: work around thread safety analysis bug.Josh Gao2017-08-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | Clang's assert_capability and assert_shared_capability annotations are nonfunctional until https://reviews.llvm.org/rL309725 is relanded and makes its way into our toolchain. Work around this by using the equivalent assert_lock and assert_shared_lock. Bug: http://b/64226736 Test: manual Change-Id: I40711f162ea1d492f1e0b3eff88bf6ae6d995e2f
* | Add definition of off64_t for mac os buildsAdam Lesinski2017-07-251-0/+6
| | | | | | | | | | | | | | Mac OS does not define off64_t, since off_t is always 64 bit. Test: manual Change-Id: Ib02a912a2eaf38143e124f2b6aaf294ecf84ff88
* | Merge "libziparchive: Use ReadAtOffset exclusively"Adam Lesinski2017-07-251-0/+11
|\ \ | |/ |/|
| * libziparchive: Use ReadAtOffset exclusivelyAdam Lesinski2017-07-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of ReadAtOffset is meant to allow concurrent access to the zip archive once it has been loaded. There were places where this was the case, and some places that did a seek + read combination, which could lead to data races. NOTE: On Windows, we are not using pread as the implementation of ReadAtOffset, therefore the guarantees on Windows are weaker. On Linux, pread allows the file descriptor to be read at a specific offset without changing the read pointer. This allows inherited fd's and duped fds to be read concurrently. On Windows, we use the ReadFile API, which allows for an atomic seek + read operation, but modifies the read pointer. This means that any mix use of ReadAtOffset and Read will have races. Just using ReadAtOffset is safe. For the Windows case, this is fine as the libziparchive code now only uses ReadAtOffset. Bug: 62184114 Bug: 62101783 Test: make ziparchive-tests (existing tests pass) Change-Id: Ia7f9a30af2216682cdd9d578d26e84bc46773bb9
* | Move Timer from init to libbaseTom Cherry2017-07-101-0/+17
|/ | | | | | | Test: boot bullhead Test: new libbase unit tests Change-Id: Ic398a1daa1fe92c10ea7bc1e6ac3f781cee9a5b5
* Add (partial) support for Windows long pathsRenaud Paquay2017-06-281-0/+19
| | | | | | | | | | | | | | * Update android::base::utf8::open/unlink to support Windows long paths * Add android::base::utf8::fopen, also with support for Windows long paths * Upcoming CLs will add additional APIs to support additional use cases Test: Added tests to utf8_test Bug: 38268753 Change-Id: If72af327f3487766f5370a2f43ee9cabd4a8a810
* logging: make LOG(FATAL) always run with the static analyzer.George Burgess IV2017-05-311-1/+5
| | | | | | | | | | | | | | | | | | | | | ::android::base::GetMinimumLogSeverity() is defined externally, so the static analyzer was allowed to assume that we continue executing after a LOG(FATAL). I manually audited all of the code I have access to, and the only "change the minimum log severity" statements I can see keep FATAL enabled (...and continuing after a FATAL is highly sketchy to me anyway). (I'm sure I tested this at some point in making the previous patch. I probably broke it in a refactor before sending it out for review; my bad. :) ) Bug: None Test: m without the static-analyzer builds; m with it yields fewer false positives. Change-Id: I216cd2034e1daa8d6f6c5e776f64b4cce88bb938