summaryrefslogtreecommitdiffstats
path: root/base
Commit message (Collapse)AuthorAgeFilesLines
* libbase: a slightly cleaner solution to libbase's `off64_t` problem.Elliott Hughes2018-10-253-10/+25
| | | | | | | | | Given that I can't actually go back in time and just make bionic's `off_t` be 64-bit. Bug: N/A Test: builds Change-Id: Ic93336b07bffc0977bd0e9caad6a22ce29ca06ed
* Merge "libbase: quick fix for Mac build."Treehugger Robot2018-10-251-0/+5
|\
| * libbase: quick fix for Mac build.Elliott Hughes2018-10-251-0/+5
| | | | | | | | | | | | | | | | I'll come back for the better fix later... Bug: N/A Test: builds Change-Id: I967c2436cf5816cf9a0edcd3f04f307969e48bcb
* | Merge "libbase: add O_CLOEXEC to <android-base/file.h>."Elliott Hughes2018-10-252-2/+7
|\ \
| * | libbase: add O_CLOEXEC to <android-base/file.h>.Elliott Hughes2018-10-242-2/+7
| |/ | | | | | | | | | | | | | | We already expose O_BINARY, and O_CLOEXEC seems equally legitimate. Bug: N/A Test: builds Change-Id: I7f07e1bb2a5d6b5c5f293783c39ceab148fabefb
* / libbase: remove ARRAYSIZE_UNSAFE.Elliott Hughes2018-10-241-54/+14
|/ | | | | | | | Also fix the indentation of a neighboring comment. Bug: N/A Test: builds Change-Id: Iebe5f518b2ac14718f3cae91007e62b61bed9dc0
* Merge "Add a simple MappedFile to libbase and switch fastboot and ↵Elliott Hughes2018-10-244-0/+187
|\ | | | | | | libziparchive over."
| * Add a simple MappedFile to libbase and switch fastboot and libziparchive over.Elliott Hughes2018-10-234-0/+187
| | | | | | | | | | | | | | | | This allows us to remove libziparchive's dependency on libutils. Bug: http://b/79112958 Test: ran libbase and libziparchive tests, ran fastboot manually Change-Id: I95c651976dad222863e5b8c37d4514b778f5dce7
* | adb: rationalize fatal/error logging.Elliott Hughes2018-10-191-8/+3
|/ | | | | | | | | | | | | | | | | | | Let's use LOG(FATAL)/PLOG(FATAL) for actual fatal stuff. Add a Windows error(3) and move folks who didn't really mean "abort" fatal over to it. Also get rid of syntax_error which wasn't adding a lot of value, and most of the places it was adding "usage: " didn't seem entirely appropriate anyway. In particular, we seemed to have confused fastdeploy.cpp into aborting in most user error cases, and none of the reviewers noticed. Clearly we'd all lost track of far too many options. (I've also cleaned up a few random instances of fprintf(3) + exit(2).) Bug: N/A Test: manual Change-Id: I3e8440848a24e30d928de9eded505916bc324786
* Merge changes from topic "windows-libcxx"Pirama Arumuga Nainar2018-10-111-0/+1
|\ | | | | | | | | | | | | * changes: Do not enable -Wold-style-cast for Windows Add sys/types.h in utf8.h Adapt to switch to libc++ for Windows
| * Add sys/types.h in utf8.hPirama Arumuga Nainar2018-09-211-0/+1
| | | | | | | | | | | | | | | | | | Bug: http://b/91353691 It's needed for mode_t. Test: Build and test Windows modules under Wine. Change-Id: I3fa6b2946316a9bd2a0d800ae928ba5de480a283
* | Assert that ParseInt/ParseUint are only used with signed/unsigned numbers ↵Tom Cherry2018-10-051-0/+3
| | | | | | | | | | | | | | | | respectively Test: build fails when the signedness is mismatched Test: build succeeds otherwise Change-Id: Idd6b146cc167d4607eafc81dbad6c2a79b167094
* | Add noexcept to move constructors and assignment operators.Chih-Hung Hsieh2018-10-052-3/+3
| | | | | | | | | | | | Bug: 116614593 Test: build with WITH_TIDY=1 Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
* | Enable -Wexit-time-destructor for all targetsPirama Arumuga Nainar2018-09-261-2/+1
|/ | | | | | | This warning should be available for Windows as well. Test: mmma system/core/base Change-Id: Id2e7e4da2e5105870a8d1e10c793e4a54c5b3d04
* Suppress implicit-fallthrough warnings.Chih-Hung Hsieh2018-09-171-0/+2
| | | | | | | | Add FALLTHROUGH_INTENDED for clang compiler. Bug: 112564944 Test: build with global -Wimplicit-fallthrough. Change-Id: I40f8bbf94e207c9dd90921e9b762ba51abab5777
* Merge "Add Start/Stop/Reset to CapturedStdFd."Christopher Ferris2018-09-054-101/+161
|\
| * Add Start/Stop/Reset to CapturedStdFd.Christopher Ferris2018-09-044-101/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the fd() function to be private since it should not have been exposed in the first place. Fix the way logging_test uses CapturedXXX. Adding this because the new isolated testing doesn't print errors to stderr so the ASSERT_ EXPECT_ messages can get swallowed. Also, it's easier to reuse a CapturedXXX object in a test with these functions. Test: New unit tests pass. Change-Id: I38b113fc184146ce434802f80a9b7997fa83e78a
* | libbase: add Fdopen that takes a unique_fd.Josh Gao2018-09-041-0/+12
|/ | | | | | | | | | | | | | | | | | | | Using fdopen with unique_fd correctly is more annoying than it should be, because fdopen doesn't close the file descriptor received upon failure, which means you have to something like the following: unique_fd ufd = ...; int fd = ufd.release(); FILE* file = fdopen(fd, "..."); if (!file) { close(fd); return; } Add an android::base::Fdopen that does that dance for you. Bug: http://b/113880863 Test: treehugger Change-Id: I6325acf1ff06484005c1053fe09672c5eeeecaa1
* Set errno for all error return cases.Christopher Ferris2018-08-292-4/+54
| | | | | Test: Updated unit tests pass. Change-Id: I2c1f14ed44ce144a46cb2866c146fca89a05539e
* Fix typo in parseint.untouched_on_failure testTom Cherry2018-08-231-1/+1
| | | | | | | | | This test means to check both that ParseInt() and ParseUint() do not change the result on failure, however it erroneously tested ParseInt() twice. Test: unit tests Change-Id: If534e2525827e19aba6cae0eef45668d57623efb
* Fix two ParseInt edge casesTom Cherry2018-08-222-0/+32
| | | | | | | | | | | | | | | 1) ParseInt and ParseUint accept strings that have spaces followed by a valid number, however the base check for determining hex numbers does not take this into account currently, but now does this this change. 2) ParseUint rejects negative numbers except in the case that the template argument is unsigned long long. That is a mistake; it should reject negative numbers in all cases and this change does that by rejecting any string with a - prefix. Bug: 112668205 Test: new (and old) unit tests Change-Id: I0179b42e50adc1b169cf0e6d830283b71210a029
* base: remove execute bit from utf8.hSpencer Low2018-08-111-0/+0
| | | | | | | | | I originally accidentally created this file with the execute bit on. Test: mma Change-Id: I8075ffdbb114475434ad48912a9dd24f19a9025b Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
* ParseFloat/ParseDouble, also take std::stringSteven Moreland2018-08-091-0/+11
| | | | | | | | For convenience and to match the integer parsing functions. Bug: 110758329 Test: m only Change-Id: I33620d9a29465e1f425872fd57063ac32031988a
* Merge "Add ParseFloat (in parsedouble.h)."Steven Moreland2018-08-092-6/+47
|\
| * Add ParseFloat (in parsedouble.h).Steven Moreland2018-08-082-6/+47
| | | | | | | | | | | | Bug: 110758329 # for using here Test: libbase_test (added float_smoke) Change-Id: I640f85655567c707cbee625ca9c88db2ab91da66
* | Merge "ParseDouble: allow validation only."Treehugger Robot2018-08-093-8/+15
|\|
| * ParseDouble: allow validation only.Steven Moreland2018-08-083-8/+15
| | | | | | | | | | | | | | | | | | This change also updates documentation for Parse(Ui|I)nt functions which recently had a corresponding change applied. Bug: 110758329 Test: libbase_test Change-Id: I4842c0500a6e49498eeb8a63d1117c06727fffdf
* | base: move unique_fd fdsan tests into bionic.Josh Gao2018-08-082-55/+0
|/ | | | | | | | | | EXPECT_DEATH forks behind the scenes, which turns off fdsan, leading to these tests failing. Instead of duplicating the special EXPECT_FDSAN_DEATH macro, just move these tests into the bionic fdsan tests. Test: none Change-Id: Ia7b65d4560601d5a78d143aced887a6773b401c0
* 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-203-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-151-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