Commit graph

2244 commits

Author SHA1 Message Date
Mark Salyzyn
74ba3b0ce6 Merge "system/core: drop or replace log/logger.h" am: 1f90485804 am: cb670780be
am: 6e5ffe2680

Change-Id: I4c1351fb61b3357d059a8e1da4ce14e3701e17af
2016-10-04 18:37:14 +00:00
Mark Salyzyn
6e5ffe2680 Merge "system/core: drop or replace log/logger.h" am: 1f90485804
am: cb670780be

Change-Id: I532a0f6143511f53f3303751f95de115ac034cd7
2016-10-04 18:33:44 +00:00
Mark Salyzyn
37c9451349 system/core: drop or replace log/logger.h
debuggerd does not require log/logger.h, can use android/log.h
In some cases, mark why log/logger.h was required.

Test: Compile and boot smoke test
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: Ia34987e25a01d81971ec8d785415f732b8376c4f
2016-10-04 09:09:10 -07:00
Mohan Srinivasan
96eba22338 Merge "liblog: logd: Add android_lookupEventTag_len()" am: 093951a230 am: aed39f1f3d
am: 2acb41b46c

Change-Id: Ifd5da3780cf05863b71fad9583b1b83f4962b46f
2016-10-03 22:47:51 +00:00
Mohan Srinivasan
2acb41b46c Merge "liblog: logd: Add android_lookupEventTag_len()" am: 093951a230
am: aed39f1f3d

Change-Id: If1615c62df20df58eda2910455f2a1e05268fba7
2016-10-03 22:42:20 +00:00
Mark Salyzyn
807e40ecc9 liblog: logd: Add android_lookupEventTag_len()
Allows us to mitigate the impact of MAP_PRIVATE and copy on write by
calling android_lookupEventTag_len instead of android_lookupEventTag,
and delaying the copy on write impact to the later.  We return a
string length in a supplied location along with the string pointer
with android_lookupEventTag_len(const EventTagMap* map, size_t* len,
int tag).  The string is not guaranteed to be nul terminated.  Since
android_lookupEventTag() called even once can cause the memory
impact, we will mark it as deprecated, but we currently have no
timeframe for removal since this is a very old interface.

Add an API for __android_log_is_loggable_len() that accepts the non
null terminated content and fixup callers that would gain because the
length is known prior to the call either in the compiler or at
runtime.  Tackle transition to android_lookupEventTag_len() and
fixup callers.

On any application that performs logging (eg: com.android.phone)

/proc/<pid>/smaps before:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 463 /system/etc/event-log-tags
Size:                 20 kB
Rss:                  20 kB
Pss:                   1 kB
Shared_Clean:          0 kB
Shared_Dirty:         20 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:            20 kB
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd wr mr mw me ac

/proc/<pid>/smaps after:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 1773 /system/etc/event-log-tags
Size:                 20 kB
Rss:                  20 kB
Pss:                   1 kB
Shared_Clean:         20 kB  (was 0kB)
Shared_Dirty:          0 kB  (was 20kB)
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:           20 kB  (was 0kB)
Anonymous:             0 kB  (was 20kB)
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd wr mr mw me ac

Added liblog-unit-tests --gtest_filter=liblog.event_log_tags to
check for Shared_Clean: to not be 0 and Anonymous: to be 0 for
all processes referencing event-log-tags.  Which can include multiple
references to /system/etc/event-log-tags and future possible refs to
/data/misc/logd/event-log-tags and /dev/event-log-tags.  We want
failure messages to help point to errant code using the deprecated
interface.

This change saves 1/4MB of memory or more on a typical system.

Test: gTest liblog-unit-tests
Bug: 31456426
Change-Id: I9e08e44d9092bd96fe704b5709242e7195281d33
2016-10-03 11:08:34 -07:00
Mark Salyzyn
9f6b98dec0 system/core Replace log/log.h with android/log.h am: ff2dcd9af9 am: cac331afd9
am: 0308b0eabd

Change-Id: I4d631d53b4fc27e1a02d412bae21fffad6635258
2016-09-30 22:18:18 +00:00
Mark Salyzyn
0abff8fc61 system/core Replace cutils/log.h with android/log.h am: 66ce3e08c5 am: eb189f147b
am: 16f7786032

Change-Id: I26939d55686b6182c9fae5fc74f3e7ed92132cdb
2016-09-30 22:18:03 +00:00
Mark Salyzyn
9bb1f2f915 libcutils: Replace cutils/log.h with android/log.h am: 23ed4c242a am: f56fce0240
am: 9fd2eaf827

Change-Id: If01fd686fc15aaf74b6f06b7e661eb46e127d51b
2016-09-30 22:17:30 +00:00
Mark Salyzyn
2156aae1d5 liblog: Replace log/log.h with android/log.h am: 6584d0a35a am: 499a33d6dc
am: c528ac0fe8

Change-Id: I2e6eb5782ccd27e47e8302381d790611fd58a1d7
2016-09-30 22:17:20 +00:00
Mark Salyzyn
ea3c6d1029 liblog: logcat: Replace log/logd.h with log/log.h am: a166708d15 am: 772ed1c63c
am: 2b42b87d8c

Change-Id: I4a977e248d0ea7e3b8ed31aed0643752aaab4e1c
2016-09-30 22:17:14 +00:00
Mark Salyzyn
a06a6509d9 liblog: logd: logcat: deprecate log/log_read.h am: 004cd3c55d am: 78a459a8c8
am: 13c68b09d9

Change-Id: Icaab3eedecad8f55d8d1291b3414da5c12cec287
2016-09-30 22:17:08 +00:00
Mark Salyzyn
519bdbf0b4 liblog: Add C++ wrapper for C event log handler am: 8eaaac0103 am: 8b4cab3f69
am: 848da90978

Change-Id: I215d1da28c1d4e0377097f49493d1e9c5fc9ee75
2016-09-30 22:17:02 +00:00
Mark Salyzyn
0308b0eabd system/core Replace log/log.h with android/log.h am: ff2dcd9af9
am: cac331afd9

Change-Id: I95c6a64bc35a041688303fcee4d506865d0a19a4
2016-09-30 22:13:00 +00:00
Mark Salyzyn
16f7786032 system/core Replace cutils/log.h with android/log.h am: 66ce3e08c5
am: eb189f147b

Change-Id: I3f2b13e259d9bbb7bc714f21eab7181fa72c35bf
2016-09-30 22:12:55 +00:00
Mark Salyzyn
9fd2eaf827 libcutils: Replace cutils/log.h with android/log.h am: 23ed4c242a
am: f56fce0240

Change-Id: I588c3a252594e1ecd4b34242217cf23c84e4af67
2016-09-30 22:12:45 +00:00
Mark Salyzyn
c528ac0fe8 liblog: Replace log/log.h with android/log.h am: 6584d0a35a
am: 499a33d6dc

Change-Id: If28b70b199b4bbf99f853d6c6d14b73a72fafacb
2016-09-30 22:12:41 +00:00
Mark Salyzyn
2b42b87d8c liblog: logcat: Replace log/logd.h with log/log.h am: a166708d15
am: 772ed1c63c

Change-Id: Ibd14ac6a57994019e188e6ec138682b50d1f7e69
2016-09-30 22:12:36 +00:00
Mark Salyzyn
13c68b09d9 liblog: logd: logcat: deprecate log/log_read.h am: 004cd3c55d
am: 78a459a8c8

Change-Id: If1a76043e7941191b3c6ba07ca0277b7f9b7f2e6
2016-09-30 22:12:32 +00:00
Mark Salyzyn
848da90978 liblog: Add C++ wrapper for C event log handler am: 8eaaac0103
am: 8b4cab3f69

Change-Id: I2760c8480818f30dd126e7cfbb900a0f5796c8b1
2016-09-30 22:12:28 +00:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Mark Salyzyn
66ce3e08c5 system/core Replace cutils/log.h with android/log.h
Should use android/log.h instead of cutils/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
2016-09-30 12:47:05 -07:00
Mark Salyzyn
23ed4c242a libcutils: Replace cutils/log.h with android/log.h
Replace references to cutils/log.h and log/log.h with android/log.h.
Point cutils/log.h to android/log.h. Adjust header order to comply
with Android Coding standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I4b00c0dff3a0a50cbb54301fdc5a6c29c21dab65
2016-09-30 12:47:05 -07:00
Mark Salyzyn
6584d0a35a liblog: Replace log/log.h with android/log.h
Move all liblog related content into android/log.h, and make
log/log.h points to android/log.h.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I858e0ebe047b86f2a8530a99bc9c380d3d58edbb
2016-09-30 12:47:05 -07:00
Mark Salyzyn
a166708d15 liblog: logcat: Replace log/logd.h with log/log.h
Should use log/log.h and in some cases android/log.h instead. Can
not remove file because still in use by partners, so log/logd.h
points to log/log.h.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I3580d46154617abb7231027a44f4ab9ee023febf
2016-09-30 12:47:05 -07:00
Mark Salyzyn
004cd3c55d liblog: logd: logcat: deprecate log/log_read.h
Always used in combination with log/logger.h except in log_time.cpp,
and not used externally.  As a result liblog has to support stl, a
small price to pay since goal is to convert liblog to C++ internally.

Test: compile
Bug: 31456426
Bug: 26552300
Bug: 31289077
Change-Id: I72828ec807d0a2c8e40bbdebd7a69f147a7ca5a9
2016-09-30 12:47:05 -07:00
Mark Salyzyn
8eaaac0103 liblog: Add C++ wrapper for C event log handler
Add android_log_event_context class.

Test: in context of 'logd: add getEventTag command and service'
Bug: 31456426
Bug: 26552300
Bug: 31289077
Bug: 19235719
Change-Id: Icf918b443f01e04040c8d3efe0cdb7a8e70be10c
2016-09-30 12:47:05 -07:00
Miodrag Dinic
53be7eb3d0 Merge "[qemu]: Fix payload size format in qemu_pipe_frame_send()" am: e5976bea7a am: 8c274361fb
am: f610eaac14

Change-Id: I890fbb885044e82d4ec66a5a400240124003ac25
2016-09-30 18:00:16 +00:00
Miodrag Dinic
f610eaac14 Merge "[qemu]: Fix payload size format in qemu_pipe_frame_send()" am: e5976bea7a
am: 8c274361fb

Change-Id: I7c80343b0002ec68ef9cde40dad2202aa9b70c00
2016-09-30 17:49:11 +00:00
Miodrag Dinic
192be1dcae [qemu]: Fix payload size format in qemu_pipe_frame_send()
The following change introduced regression for booting AOSP
on emulator for all architectures:

7c7990e Fix warnings in system/ headers

qemu_pipe expects payload size in the message header to be in hex format,
as stated in the comment for qemu_pipe_frame_send().

Change-Id: I32cfa9c9b2af56f93bbda0ea5597451c389ae45e
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
2016-09-30 13:58:11 +02:00
Colin Cross
0763c30289 Merge "Fix more system/core/include warnings" am: 18fbd80504 am: 5fe194a9fd
am: b5ca47989c

Change-Id: I8d5a602f94bc57866aa3827cc508c94afb4ac4ba
2016-09-29 17:58:08 +00:00
Colin Cross
b5ca47989c Merge "Fix more system/core/include warnings" am: 18fbd80504
am: 5fe194a9fd

Change-Id: I8e561ab27f93ed10efa8a0e864cd7d1283bb6163
2016-09-29 17:42:19 +00:00
Colin Cross
18fbd80504 Merge "Fix more system/core/include warnings" 2016-09-29 17:20:30 +00:00
Mark Salyzyn
ae1612c54c Merge "liblog: fix errno issues with event tag map" am: dfd30c4a16 am: 930ff186ce
am: 71b38def04

Change-Id: I83de9e374a67946fde8191d63720b102690d468f
2016-09-28 18:21:01 +00:00
Mark Salyzyn
71b38def04 Merge "liblog: fix errno issues with event tag map" am: dfd30c4a16
am: 930ff186ce

Change-Id: Iac84f40e9e79063bee7f213eb21ff5f866462a32
2016-09-28 18:17:49 +00:00
Colin Cross
1811d156e9 Fix more system/core/include warnings
The warnings in these files were hidden by -isystem
framework/native/include.

Bug: 31752268
Test: m -j
Change-Id: I2a54376aea380ee24e6483fb7d35fdfe8991c490
2016-09-27 16:21:12 -07:00
Mark Salyzyn
70a83dc7b3 liblog: fix errno issues with event tag map
Cleanup.

Save the errno for the calls that fail, and reinstate them for
return. Drop fprintf stutter, one succinct line. Solve a memory
leak in close.  Change android_lookupEventTag() to use an
unsigned int so that we can use the full range of uint32_t tags.

Make sure this file compiles clean in C++.

Test: gTest liblog-unit-tests
Bug: 30963384
Bug: 31456426
Change-Id: I6a5efa6fb7e991431caba75ef0971e111968f6bf
2016-09-26 09:23:55 -07:00
David Pursell
7bc0052ff1 Merge "Flattenable: switch from assignment to memcpy()." am: b2356a6993 am: bb276d8555
am: 9f106bece8

Change-Id: I43e4e5c6bb0aa1fd23a1d0d9776c9e2c8028527e
2016-09-23 22:56:01 +00:00
David Pursell
9f106bece8 Merge "Flattenable: switch from assignment to memcpy()." am: b2356a6993
am: bb276d8555

Change-Id: I2d7317f601dcfc85705f2e71408c314de55a0f69
2016-09-23 22:53:48 +00:00
David Pursell
b2356a6993 Merge "Flattenable: switch from assignment to memcpy()." 2016-09-23 22:46:03 +00:00
Colin Cross
8e3427fb04 Merge "Move android_get_control_socket out of line" am: 4b5abcdba2 am: 4873829953
am: ea2b61c7a8

Change-Id: Ib406546b998d6d525829f0023a5f693c2e1dfd6c
2016-09-23 21:00:41 +00:00
Colin Cross
ea2b61c7a8 Merge "Move android_get_control_socket out of line" am: 4b5abcdba2
am: 4873829953

Change-Id: I45e8b86e43a47213664acf486a5de266bab6deb8
2016-09-23 20:58:40 +00:00
David Pursell
2ebce7384b Flattenable: switch from assignment to memcpy().
FlattenableUtils read() and write() currently use assignment to copy
bytes. However, by casting the void* buffer to type T, the compiler is
allowed to assume that buffer obeys the alignment requirements of T,
which is not necessarily the case during serialization. On some
architectures, we can get SIGBUS when this alignment is violated.

We don't want the users of these routines to have to worry about
alignment when packing structures, so use memcpy() instead which should
always be safe since the compiler won't assume any alignment for the
void* buffer.

On architectures that can handle unaligned direct read/write of type T,
the compiler should be smart enough to optimize this code back to a
direct read/write anyway, but architectures that can't handle it will
fall back to memcpy; this means that this change shouldn't have any
impact on current Android devices. See the linked bug for more details.

Bug: http://b/31671510
Test: libgui Sensor serialization no longer gives SIGBUS.
Test: libgui.so unchanged on Shamu before and after this CL.
Change-Id: I2197127e8cbfb43f4f553bda6464f6ebe087febd
2016-09-23 13:56:40 -07:00
Colin Cross
e8ffa449fd Move android_get_control_socket out of line
android_get_control_socket has a warning from the implicit cast from
long to int.  The warning was being hidden because cutils/sockets.h was
included with -isystem.  Move android_get_control_socket to sockets.cpp,
since we don't want header only dependencies anyways, and fix the
warning with a range check and a static_cast.

Bug: 31492149
Test: m -j <module that uses sockets.h and -Wall>
Change-Id: I1f394ab26d4ec8a7dd0e7907c10416d7f8647624
2016-09-23 11:26:08 -07:00
Colin Cross
28cda0bf38 Merge "Fix warnings in libutils headers" am: 65a1633ec3 am: 0f79b62bf6
am: 1446cbac58

Change-Id: I94a39bb24224218ef1c48080ace3455c1fc7233a
2016-09-22 23:04:13 +00:00
Colin Cross
021899fa8a Merge "Remove has_trivial_move trait from Vector<T>" am: 588b3b0c03 am: 85942090f6
am: 749181c10b

Change-Id: Ie339e0ea27463d0c5b093e9a5e262367d1ca57a5
2016-09-22 22:58:13 +00:00
Colin Cross
bd45ba6972 Merge "Fix warnings in system/ headers" am: d7f60fd871 am: 299df0bf01
am: 88fd7e2ec4

Change-Id: I94891ea3c3a00ee39b48531fcc8e5e3d6ebe724a
2016-09-22 22:52:44 +00:00
Colin Cross
1446cbac58 Merge "Fix warnings in libutils headers" am: 65a1633ec3
am: 0f79b62bf6

Change-Id: I62fea8f4ed3f2a9d16d68539eb073965531944da
2016-09-22 22:51:15 +00:00
Ajay Panicker
531b201eb6 Merge "Remove net_bt_stack group and replace it with bluetooth" am: 7875407bb7 am: f924c252bd
am: b0db9714bb

Change-Id: I025c5301fecf0566d8184efce099a195fdbfc460
2016-09-22 21:58:27 +00:00
Colin Cross
749181c10b Merge "Remove has_trivial_move trait from Vector<T>" am: 588b3b0c03
am: 85942090f6

Change-Id: Ic41410047760bff11063d12839921ae008fe7e65
2016-09-22 20:33:40 +00:00