summaryrefslogtreecommitdiffstats
path: root/libutils
Commit message (Collapse)AuthorAgeFilesLines
* Remove USE_MINGW/CYGWIN; Whitelist windows modulesDan Willemsen2015-09-021-13/+5
| | | | | | | | CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being replaced with LOCAL_..._windows variables. Bug: 23566667 Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
* VectorImpl.cpp: fix benign multiplication overflowNick Kralevich2015-08-281-1/+4
| | | | | | | | | | j is a ssize_t, which can go negative. If it goes negative, the resulting multiplication of mItemSize*j doesn't make any sense. Since the value is never used, just don't perform the calculation if j < 0. Bug: 23607865 Change-Id: I14f6f6506645d582f7d67a2e2d60ead3cb18b957
* libutils: Enable LOCAL_SANITIZE := integerNick Kralevich2015-08-241-0/+4
| | | | | | | Call abort() on undefined or sketchy integer behavior. Protects against integer overflow attacks. Change-Id: I475e5e9fb04160dd2d201e926ab2b897539f8bb6
* libutils: cleanups for -fsanitize=integerNick Kralevich2015-08-242-0/+14
| | | | | | | | | | | | | | * Hashing functions rely on integer overflow behavior. Mark those functions as safe. * abort() if a passed in size_t value is greater than UINT32_MAX. This can occur on 64 bit builds where size_t is larger than uint32_t. * Special case the index lookup for an empty sorted vector. Without the special case, size() == 0, and size()-1 underflows. Change-Id: I343a14b589fc8f0d221c1998ae5d6f0b9e2781f8
* Merge "libutils: fix overflow in String8::allocFromUTF8"Sergio Giro2015-08-181-0/+3
|\
| * libutils: fix overflow in String8::allocFromUTF8Sergio Giro2015-08-181-0/+3
| | | | | | | | | | | | | | | | Patch contributed in: https://code.google.com/p/android/issues/detail?id=182908 Bug: 23290056 Change-Id: Ide0e9a8acc4e95a9104bab3ae803aa3a40098222
* | libutils: fix signed/unsigned comparison warningsNick Kralevich2015-08-173-21/+21
|/ | | | Change-Id: Ib283c85a404a20688c5357fa513e5d07c2f42803
* Merge "Use __ANDROID__ instead of HAVE_ANDROID_OS."Elliott Hughes2015-07-303-17/+10
|\
| * Use __ANDROID__ instead of HAVE_ANDROID_OS.Elliott Hughes2015-07-303-17/+10
| | | | | | | | Change-Id: I9967f3fd758c2a5b40be5b60ae72be7e2fb75136
* | Use _WIN32 rather than HAVE_WINSOCK.Elliott Hughes2015-07-291-1/+1
|/ | | | Change-Id: I9855b6fe72e2f2f3a8360c0993a67cb988024ee4
* Move libutils off AndroidConfig.h.Elliott Hughes2015-07-291-0/+1
| | | | Change-Id: Ia0e4a4f968c640eb44317821d2dc6b195f9f490e
* Consistently use strerror in libutils.Elliott Hughes2015-06-306-29/+31
| | | | | | | | It's easier for people to debug, and side-steps the problem that errno values differ between architectures. Bug: http://b/17458391 Change-Id: I1db9b2cbb653839d3936b91e37e5cff02671318a
* Add a space before :=.Evgenii Stepanov2015-06-121-1/+1
| | | | Change-Id: Ib1d94648cdc163675ac7b6acf86408d5be6b5ad2
* Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.Elliott Hughes2015-04-021-1/+0
| | | | Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
* Revert "Revert "Create libbase.""Dan Albert2015-03-166-352/+0
| | | | This reverts commit a7870d88167f619e758b5bcd15b410d16da7c16b.
* Revert "Create libbase."Nicolas Geoffray2015-03-166-0/+352
| | | | | | | | Breaks internal master. This reverts commit 98ff77204cef9bb8f0f27420833233622060a09e. Change-Id: I18dc6021cb43efff8aa88486c2d980dc2b8eedba
* Create libbase.Dan Albert2015-03-146-352/+0
| | | | | | | Move StringPrintf and the string based file I/O from libutils to libbase. Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
* Remove useless refCounting from FileMap.Narayan Kamath2015-02-232-11/+3
| | | | | | | | | Nobody ever called acquire() so release() was always equivalent to delete. Just use delete instead so that people can use unique_ptr directly (or shared_ptr if they really want refcounts). Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
* Merge "Remove reference to NOT_USING_KLIBC and cygwin."Narayan Kamath2015-02-201-14/+1
|\
| * Remove reference to NOT_USING_KLIBC and cygwin.Narayan Kamath2015-02-191-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | The reference to NOT_USING_KLIBC appears to be the only one in our codebase. This change also removes some cygwin specific retry logic - all other supported platforms in this section of the code should support mapping at an offset. Note that i've reversed the sense of the check, we always sysconf since that's recommended practice. Change-Id: Ib985fb665193d7a07a282f7092cd77c0bc508a66
* | Fix the WriteStringToFile overload that takes mode/owner/group.Elliott Hughes2015-02-172-2/+31
|/ | | | | | | | | | The actual bug is == instead of !=, but the real cause was me trying to be too clever. This patch switches to much simpler code, and -- since the intended use of this code is security anyway -- adds logging if anything goes wrong. Bug: 19361774 Change-Id: If2af07d31a5002f9010b838247b691f6b28bdfb1
* Clean up reading and writing in init.Elliott Hughes2015-02-062-24/+72
| | | | | | | | | | | | | This isn't particularly useful in and of itself, but it does introduce the first (trivial) unit test, improves the documentation (including details about how to debug init crashes), and made me aware of how unpleasant the existing parser is. I also fixed a bug in passing --- unless you thought the "peboot" and "pm" commands were features... Bug: 19217569 Change-Id: I6ab76129a543ce3ed3dab52ef2c638009874c3de
* Fix Windows build.Elliott Hughes2015-02-041-0/+2
| | | | | | | Only two days in, and I'm already really regretting putting this code somewhere that builds for Mac OS and Windows... Change-Id: I576ee4a9e647e10dc2d47c7e1e38aedee2bf404c
* Add a WriteStringToFile overload that cares about permissions.Elliott Hughes2015-02-041-8/+35
| | | | Change-Id: I857a80b61768d4e9610bdd149eff2d9d8e48d2c0
* Add Google-style StringPrintf.Elliott Hughes2015-02-034-0/+137
| | | | Change-Id: If333c28b8ed047346a2dd85e591c4bedbab874cc
* Fix Mac build.Elliott Hughes2015-02-031-0/+2
| | | | | | | I knew I should have created a new library that doesn't build for the Mac or Windows rather than adding to libutils... Change-Id: I7c07eaa93affb7e83d4da384f03652c39065562a
* Add Google-style ReadFileToString and WriteStringToFile.Elliott Hughes2015-02-034-10/+109
| | | | | Bug: 19217569 Change-Id: I64789d3fa6777ee30a324cdf00fdc275c1230e1b
* Kill HAVE_PTHREADS.Yabin Cui2015-01-273-57/+42
| | | | | Bug: 19083585 Change-Id: Ic09eb3dd250bc5c5b63cac7998f99f5fa007f407
* Fix references to HAVE_PRCTL.Elliott Hughes2014-12-151-2/+2
| | | | Change-Id: I8343b398f2ce0d743487fdd086e67763c7dd67f1
* Clean up libutils Android.mkTrevor Drake2014-12-061-10/+0
| | | | | | | | | | | | | | | | | Removed LOCAL_C_INCLUDES as the external/zlib headers are no longer referenced by anything in libutils. Removed unused host_commonLdlibs build variable. This was referenced by the lib64utils host target which was removed in commit 03cc1f747 Tested compiling some of the projects that make use of libcutils using a clean out dir with the folllowing targets aosp_arm-eng : make -j16 logd dexdump aosp-flouder-userdebug : make -j16 keystore vold libjavacore logd aosp-x86_64-eng : make -j16 keystore vold libjavacore logd dexdump Change-Id: I663e52bbf28dde27866dad9429bf95ada6b594a5
* Use __arm__ instead of ARCH_ARM.Elliott Hughes2014-12-041-1/+1
| | | | Change-Id: I777da5757f01d8328d5475e654d56d81dc802655
* Libutils: Comment out unused constantsAndreas Gampe2014-11-241-2/+3
| | | | | | For build-system CFLAGS clean-up, "remove" unused variables. Change-Id: Ic96f066981cd96ca16af81ee3fdbc972507e8c81
* Kill HAVE_BIG_ENDIAN, HAVE_ENDIAN_H, and HAVE_LITTLE_ENDIAN.Elliott Hughes2014-11-211-11/+4
| | | | Change-Id: I9e25ac9d27e95b04fb8bf7a66c619af0139d8b8f
* kill HAVE_MADVISEYabin Cui2014-11-191-2/+6
| | | | | | Change to avoid "unused parameter" warning. Bug: 18397020 Change-Id: I4b26de55314c78237daead8e873385b97cafe4d4
* kill HAVE_MADVISEYabin Cui2014-11-181-2/+2
| | | | | Bug: 18397020 Change-Id: Ibc8d886d729c51932a403531888214de4e541452
* Move libutils to libc++.Dan Albert2014-11-151-4/+0
| | | | | Bug: 15193147 Change-Id: I85aff3bcabb5ee3c8be9918b7bef0fd1bbfa98e3
* System/core: Use memmoveAndreas Gampe2014-11-131-1/+1
| | | | | | Should use memmove when you expect overlap. Change-Id: I268a173db40a4be54232958e37aa8a03c2a885ee
* kill HAVE_POSIX_FILEMAPYabin Cui2014-11-111-12/+10
| | | | | Bug: 18315579 Change-Id: I0bd5fb946b12cb90e0c9c73a478df41609b8c3e2
* am 7a92d20e: Merge "Clean up some test makefiles."Dan Albert2014-11-053-24/+47
|\ | | | | | | | | * commit '7a92d20ec845c07472eaea7cf14fd0e69df836ef': Clean up some test makefiles.
| * Clean up some test makefiles.Dan Albert2014-11-043-24/+47
| | | | | | | | | | | | | | Needed for building with libc++ as the default STL. Bug: 15193147 Change-Id: I8b462bd288fbea7e0ab182f85ffcbf438afb6aa4
* | am 1c77bf4c: Merge "Fix windows specific behavior of FileMap" into lmp-devXavier Ducrohet2014-10-161-1/+0
|\ \ | | | | | | | | | | | | * commit '1c77bf4ce5059f3a770418cfa8afed39ee41ab24': Fix windows specific behavior of FileMap
| * | Fix windows specific behavior of FileMapXavier Ducrohet2014-10-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of the FileMap destructor would close the file, only on Windows, which did not match the behavior on mac/linux. This is because calling munmap does not close the file descriptor. It must be closed separately, before or after munmap. On Windows, the file must also be closed manually, before or after closing the mappingFile. The change basically removes the closing file from the windows-specific part of the destructor, to make behavior more consistent on all platforms where the caller to FileMap is responsible for closing its own file (since FileMap receives an opened file). Change-Id: I5e3cfffbb870d5f3595802ccac57dbc1dbf1ce6e
* | | am 3fe9adc9: Merge "Fix write past end of memory." into lmp-devChristopher Ferris2014-10-071-9/+9
|\| | | | | | | | | | | | | | * commit '3fe9adc932948da8993d3f812bce1875efc47c0e': Fix write past end of memory.
| * | Fix write past end of memory.Christopher Ferris2014-10-071-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | The computed flattened size of the blob does not match the size used by the flatten function when the last cached entry size is not 4 byte aligned. Bug: 17873145 Change-Id: I9f9fc102d4bde4681ae977b6de5f263aaaf56708
* | | am 522c1d34: am e18ed89e: Merge "Remove makefile cruft."Dan Albert2014-09-121-6/+0
|\ \ \ | | |/ | |/| | | | | | | * commit '522c1d340b6c1742d3e47aad27b974e43fad4bc2': Remove makefile cruft.
| * | Merge "Remove makefile cruft."Dan Albert2014-09-121-6/+0
| |\ \
| | * | Remove makefile cruft.Dan Albert2014-09-121-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | Don't manually include stlport, and don't use private bionic headers. Change-Id: I0fc4e8b34ab449e9ef07c26f71e472fca5640590
* | | | am e4bf208c: am 082a52b5: Merge "Move libutils over to pthread_gettid_np."Elliott Hughes2014-09-122-6/+2
|\| | | | | | | | | | | | | | | | | | | * commit 'e4bf208ce8d893634a0f6f63ce34ec6498934d05': Move libutils over to pthread_gettid_np.
| * | | Move libutils over to pthread_gettid_np.Elliott Hughes2014-09-122-6/+2
| |/ / | | | | | | | | | | | | Bug: 17476168 Change-Id: I934d93a023eb00e036ed3cee8c52efaeb17b8915
* | | am 6ba555f2: Merge "libutils: Don\'t segfault ProcessCallStack when getting ↵Igor Murashkin2014-08-191-0/+5
|\ \ \ | | |/ | |/| | | | | | | | | | | | | thread name fails" into lmp-dev * commit '6ba555f2ad878129cd1da9dd7b7613ab166090ab': libutils: Don't segfault ProcessCallStack when getting thread name fails