Commit graph

497 commits

Author SHA1 Message Date
Treehugger Robot
d0dec304c5 Merge "libutils: use libbase_headers instead of libbase." 2019-01-08 06:42:22 +00:00
Steven Moreland
8338072591 CallStack: include prefix/tag when unlinked
Bug: N/A
Test: manual
Change-Id: I8f7a19744af938a02d876ab81c1dafee04744f96
2019-01-03 10:17:07 -08:00
Josh Gao
f0ea1e6e5d libutils: use libbase_headers instead of libbase.
Bug: http://b/121391019
Test: treehugger
Change-Id: I0e5d218b9afe6f832cc6bd0ef78bc1a5581f3e2f
2019-01-02 14:31:26 -08:00
Nick Kralevich
0a8b4d1a8b use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC)
instead.

Bug: 120983106
Test: compiles and boots
Change-Id: I7c135ee22aee61cc7895486fda904b1790c093d1
2018-12-17 09:39:24 -08:00
Jiyong Park
4f301cd977 Suppress lint warnings on google-default-arguments
The lint rule google-default-arguments ensures that virtual or override
methods do not have default arguments, because different default values
across the hierarchy chain (e.g. Base::foo(int a=0) v.s.
Derived::foo(int a=10)) can cause confusions.

However, since the uses of the default arguments in libbinder don't lead
to such problem, suppress the warnings.

Test: WITH_TIDY=true WITH_TIDY_CHECKS=google-default-arguments m
libbinder does not show any warning about google-default-arguments

Change-Id: Ica41034ab0ad1037a0facc447ee47e0c77fa9c55
2018-10-29 23:06:23 +09:00
Elliott Hughes
9fbebc5d55 "utils/Errors.h": include <stdint.h> for int32_t.
No need for a Unix/Windows difference here.

Bug: N/A
Test: builds
Change-Id: If7b27f939f9c13ef336d2015608f2a24db8cc96d
2018-10-16 13:17:15 -07:00
Elliott Hughes
643268f325 Move system/core/ off NO_ERROR.
It causes trouble for Windows, and OK already exists.

Bug: N/A
Test: builds
Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
2018-10-08 11:15:52 -07:00
Chih-Hung Hsieh
747eb149d0 Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
2018-10-05 16:43:47 +00:00
Chih-Hung Hsieh
502f4864d6 Suppress implicit-fallthrough warnings.
Add FALLTHROUGH_INTENDED for clang compiler.

Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I40f8bbf94e207c9dd90921e9b762ba51abab5777
2018-09-17 16:50:11 +00:00
Elliott Hughes
85528e8a75 Move off safe-iop.
Bug: http://b/25224572
Test: ran tests
Change-Id: I6687015eedb28c69d1f57c9d3cd7324d4995e47a
2018-08-28 13:40:04 -07:00
Hans Boehm
59cd823752 Merge "Check sp<>::clear() for data races" 2018-08-17 22:20:39 +00:00
Hans Boehm
f4f76205fe Check sp<>::clear() for data races
sp<>::clear() presents the same risks of heap corruption in the presence
of data races as does assignment. Add the same data race check.

Bug: 112651574
Test: Build and boot AOSP
Change-Id: I75d4eedd756d521920e61ff9187509f9145d4235
2018-08-17 11:40:39 -07:00
Elliott Hughes
7b6751d2f8 libutils: remove unused strzcmp16_h_n.
Bug: N/A
Test: builds
Change-Id: I864bfb3597da76cd0a4fecce67e39d5d81538764
2018-08-17 09:59:29 -07:00
Hans Boehm
2a019ecf4f Revert^2 "Prepare to fail in RefBase destructor if count is untouched"
This reverts commit b9d0753d2b.

Reason for revert: Re-land with MacOS workaround.

Test: Build (on Linux) and boot AOSP, with weak symbols enabled and disabled.

Change-Id: I5150cd90367178f3b039761dca3bccc9c2987df1
2018-08-08 16:30:12 -07:00
Xin Li
5d707816ac Merge "Merge Android Pie into master" 2018-08-07 16:51:24 +00:00
Hans Boehm
b9d0753d2b Revert "Prepare to fail in RefBase destructor if count is untouched"
This reverts commit 9d3146af22.

Reason for revert: It appears that weak symbols don't work as expected on MacOS, breaking the MacOS aapt build.

Change-Id: Ica0955106485a7bf2e2c3f09ff7910e230eb4139
2018-08-07 05:35:12 +00:00
Hans Boehm
b708511f78 Merge "Prepare to fail in RefBase destructor if count is untouched"
am: f502182ac6

Change-Id: I91ff7140a9a72c910ef01a2e13f277fa36c82b50
2018-08-06 11:01:28 -07:00
Hans Boehm
9d3146af22 Prepare to fail in RefBase destructor if count is untouched
Move towards crashing if a normally configured RefBase object is
destroyed without ever incrementing the reference count. We've been
threatening to do this for a long time. The previously last known
violation had been fixed.

This also fixes stack trace printing from RefBase, which had previously
been broken, and which we found necessary to track down further
violations of this rule.

Unfortunately, we found several more violations with the aid of
that fix. After existing CLs are submitted, there are
still some failures, but they are no longer numerous. Thus this CL
doesn't actually crash in the event of a violation, but does log a
verbose stack trace if it encounters one.

Bugs have been filed against the remaining known RefBase client offenders.
We plan to enable crashing on usage violations once those are fixed.

The fix for the stack trace printing breakage unfortunately requires
the use of weak symbols in order to avoid a circular build dependency.
We expect to eventually replace this with execinfo.h functionality.

Some random reformatting, driven by consistency with current formatting
requirements.

Add missing include to BacktraceMap.h.

Bug: 79112958
Bug: 30292291
Test: Boot AOSP, Master
Change-Id: I8151c54560c3b6f75ffc4c48229f0388a2066958
2018-08-03 17:56:47 -07:00
Josh Gao
9404f2da14 Merge changes from topic "looper_unique_fd"
am: 7e7cefa2c7

Change-Id: Id920135cff272f593b71ef8cb7ff41ee16de4484
2018-07-23 14:36:43 -07:00
Josh Gao
2d08ae57d4 libutils: switch Looper's fds to unique_fd.
Switch Looper to using unique_fd for its owned file descriptors, to
benefit from fdsan.

Bug: http://b/111560345
Test: treehugger
Change-Id: I8efff7741ed19fd71f82f7e604b4f1c66fc5ea2b
2018-07-18 18:12:12 -07:00
Yi Kong
2a6a58a818 Merge "[libutils] Modernize codebase by replacing NULL with nullptr"
am: ab3203f383

Change-Id: I5c2aaaea705a3ab82a5ad999f813e4cc22e63401
2018-07-17 10:06:10 -07:00
Yi Kong
e1731a4f2e [libutils] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-07-16 18:11:34 -07:00
Yi Kong
0f45e589ef Merge "Modernize codebase by replacing NULL with nullptr"
am: 9154fbc8df

Change-Id: I439ffa4df2e5672ed2b66d88abbb61ed67355926
2018-07-13 21:38:41 -07:00
Yi Kong
c1a1562548 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning for binder.

Test: m
Bug: 68236239
Change-Id: I8184bd6aa4ebff1bd8c88dad16886e98df853b03
2018-07-13 15:28:59 -07:00
Jiyong Park
4ebda908de Shared libs are supported in recovery mode
am: 011ee12b1d

Change-Id: I867dbafecf11215b82d952c532774cdf12c6e782
2018-06-13 16:43:09 -07:00
Jiyong Park
011ee12b1d Shared libs are supported in recovery mode
adbd has been built as a static executable since the same binary was
copied to the recovery partition where shared library is not supported.
However, since we now support shared library in the recovery partition,
adbd is built as a dynamic executable.

In addition, the dependency from adbd to libdebuggerd_handler is removed
as debuggerd is handled by the dynamic linker.

A few more modules in /system/core are marked as recovery_available:
true as they are transitive dependencies of the dynamic linker.

This change also includes ld.config.recovery.txt which is the linker
config file for the recovery mode. It is installed to /etc/ld.config.txt
and contains linker namespace config for the dynamic binaries under
/sbin.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: I363d5a787863f1677ee40afb5d5841321ddaae77
2018-06-10 08:32:24 +09:00
Jiyong Park
dfe433db47 Merge "Mark as recovery_available: true" am: 9f6f8bf0dc
am: d7fece5d91

Change-Id: Id59445da13aeef13784f04daebc8a96a7d506cbb
2018-05-21 22:32:36 -07:00
Jiyong Park
612210c75b Mark as recovery_available: true
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
2018-05-15 09:47:04 +09:00
Pirama Arumuga Nainar
87013686ad Merge "Remove more semicolons at the end of namespaces" am: d652a9e231
am: b2206b0d43

Change-Id: Ie6da257aac75729e056918f4a5f2c9e339ff05ab
2018-04-12 09:36:44 -07:00
Pirama Arumuga Nainar
90affce0c8 Remove more semicolons at the end of namespaces
These warnings are triggered by -Wextra-semi (and not -Weverything, as
incorrectly mentioned in I49b6e6af483e011632e6a34c0663c93e5c385aa6).
This warning is added to Hidl-generated libs.

To appease clang-format, this patch also fixes some extra newlines.

Test: Build
Change-Id: I63cf5d8ecba46ad87876ff21848bfff04b12ec6e
2018-04-11 23:14:13 -07:00
Pirama Arumuga Nainar
2a8e2cd325 Merge "Remove extra semicolon at end of namespace" am: 1d2bf45b55
am: c309a0715f

Change-Id: I1a1b0c6c6837f2985bdccfd5b3f4d05a1feec006
2018-04-10 17:43:07 -07:00
Pirama Arumuga Nainar
eab48ce0d5 Remove extra semicolon at end of namespace
Upcoming clang update to r328903 adds a new warning:
  warning: extra ';' outside of a function is incompatible with C++98
  [-Wc++98-compat-extra-semi]

which is included in -Weverything.

We can just delete the extra semicolon (even though we use gnu99), and
save the extra byte.

Test: Build

Change-Id: I49b6e6af483e011632e6a34c0663c93e5c385aa6
2018-04-10 22:10:54 +00:00
Jiyong Park
d3c26ed8bc Merge "Revert "libutilscallstack is private VNDK-SP"" am: 7a72d07e40
am: bde587f715

Change-Id: If7634b1db99f068e77f73d8274f1f54efabde5d0
2018-03-15 01:59:22 +00:00
Jiyong Park
130fea3478 Revert "libutilscallstack is private VNDK-SP"
CallStack.cpp was part of libutils, but has been separated into a new
library libutilscallstack [1] and then made invisible to vendors [2].
However, this is causing problem to the vendors who have been using
the CallStack class from libutils, because the class is no longer
available to them.

In order to support them, marking libutilscallstack as
'vendor_available: true'.

This reverts commit a32678df55.

[1] https://android-review.googlesource.com/c/platform/system/core/+/591954
[2] https://android-review.googlesource.com/c/platform/system/core/+/599754
Bug: 74600214
Test: m -j
Test: 2016/2017 pixel devices boots to the UI and Photo Editing works

Change-Id: Iaa232ed978378b566a4710e2320ee6ed04572e14
2018-03-14 16:21:00 +09:00
Steven Moreland
d6c3476582 Merge "libutils: Remove Static.cpp and darwin hacks." am: 929112bcd1
am: 41a294981b

Change-Id: Iebe132eaca4f9034a8e011881f1514f864529fc5
2018-03-08 21:44:42 +00:00
Steven Moreland
241b93cfd3 libutils: Remove Static.cpp and darwin hacks.
Bug: N/A
Test: in internal master, the only libraries that reference this
  symbol are:
./prebuilts/sdk/tools/linux/bin/split-select android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt2 android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
+ VNDK libraries
Test: libutils_test

Change-Id: Id39e5ef6438e48fa225ba06dbb59902ca5b60f70
2018-03-06 17:44:08 +00:00
Steven Moreland
977f72f9bc String16: remove integer overflows
Bug: 73826242
Test: manual
Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
2018-03-01 11:04:08 -08:00
Steven Moreland
9571234e22 libutils: remove subdirs
no longer used in Android

Test/Bug: none

Change-Id: I155d5ade02527bf47893a8bf8bcbb07b0aae53d8
2018-02-23 14:44:22 -08:00
Elliott Hughes
dc699a269f bpfmt.
Bug: N/A
Test: builds
Change-Id: I89ad00e1c4c7e0767bc80a7ac7935a4d55e090ac
2018-02-16 17:58:14 -08:00
Jiyong Park
a32678df55 libutilscallstack is private VNDK-SP
The library isn't intented to be exposed to vendors. It is a platform
private library.

Bug: 72471487
Test: Pixel 2016/2017 boots to the UI. Photo editing works.
Change-Id: Ib0479a43d66d988c2f882688240746bed3213dad
2018-01-25 14:02:08 +09:00
David Sehr
abfb9f3b99 Remove libziparchive dependency on libutils
Prevent future cyclic dependency from libunwind changes.

Bug: 66919073
Test: make -j 50
Change-Id: I2a4fa5b7c2c3a82db2073d0fa51940da6603be1f
2018-01-18 09:23:53 -08:00
Treehugger Robot
51c2088f3b Merge "Usage suggestions." 2017-12-19 20:32:29 +00:00
Steven Moreland
b8f152d3e2 Usage suggestions.
Providing alternative suggestions for using C++ stdlib types
instead of libutils types:
- higher interoperability
- fewer "legacy" quirks
- ability to use stl algorithms
- high optimization levels

Test: none
Change-Id: If81aa9982ca0ad229fa13c8142387906981b054d
2017-12-19 01:16:00 +00:00
Steven Moreland
8edb49060a Remove CompileTimeIfElse.
- not used anywhere
- equivalent to std::conditional

Test: none
Bug: none
Change-Id: Iffc00acb899d5159359d60c09443c7d2d7fdf2a0
2017-12-18 15:52:50 -08:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Dan Willemsen
829ecaa808 Merge "Fix / suppress new unused warnings for mingw+clang"
am: f106bb6bb8

Change-Id: I4e4ac1ff248bd437dd721cac8d55b4925e7af5a8
2017-11-30 22:43:14 +00:00
Dan Willemsen
f106bb6bb8 Merge "Fix / suppress new unused warnings for mingw+clang" 2017-11-30 22:31:54 +00:00
Dan Willemsen
528f144e77 Fix / suppress new unused warnings for mingw+clang
Bug: 69933068
Test: mmma system/core
Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
2017-11-29 21:37:28 -08:00
Logan Chien
d38831e107 Merge "libutils: Cleanup unused class declaration"
am: 23cc38d440

Change-Id: I93c1e2f9fc1d2c5ee6b1a6310952a4f7824b88a4
2017-11-28 02:22:03 +00:00