Commit graph

390 commits

Author SHA1 Message Date
Vijay Venkatraman
3c6763ca21 Exporting C headers from system/core
Moved headers from include/libcutils and include/liblog to
libcutils/include and liblog/include respectively, so they can be
exported via these libs. They needed to be moved since Soong does
not allow export from external folder.

Added symlink from old locations. They are needed since Soong
includes system/core/include by default. Once all modules are
cleaned up to explicitly add the required libs, the symlinks will be
removed.

Also added liblog_vndk_headers that exports a special log/log.h for
VNDK.

Moved headers of libcutils to libcutils_headers. They should be used
by modules for header-only inlines. Added libcutils_headers as
dependency of libcutils.

Added libcutils_vndk_headers that exports a special cutils/log.h
deprecating usage of the file. A later CL will deprecate the one in
libcutils_headers

Test: Add above libs to shared lib of local module
Change-Id: I6e1f9c5f23d8b6eae13dc3b7e5dfe7fae93b8510
2017-01-22 19:45:38 -08:00
Jeff Sharkey
7e5d0b1fae Define GID range for external data and OBBs.
To quickly answer the question of "how much data is a UID using?" we
need a GID range to label files on external storage, similar to
the GID ranges already defined for cached and shared data.

Also define a new GID that will be used to label the OBB files shared
between all users under /data/media/obb.

Test: builds, newly added tests pass
Bug: 34263266
Change-Id: I16fb7d166c3dcdeafbf477162d191d3b73ae8ac2
2017-01-18 17:11:05 -07:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
Wei Wang
677ba31db2 libcutils: change klog_level to KLOG_INFO_LEVEL
Some of Android componets e.g. init have migrated to use base/logging to get rid
of klog utilities. However, without explicit initilization, the default
klog_level is set to 3 which masks the logwrap output.
This patch sets default klog_level to KLOG_INFO_LEVEL to make
android_fork_execvp_ext log available.

Bug: 34256270
Test: manual
Change-Id: Ibe74707a92c954053cd0e6828a984fbd72b4acae
2017-01-12 22:18:46 -08:00
Jeff Sharkey
dff44709cf Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

This change also tightens up the implementation of both the cache
and shared GID calculation to ensure that they stay inside the valid
ranges, and includes tests to verify.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ie4377e5aae267f2da39a165888139228995987cb
2016-12-13 13:28:08 -07:00
Josh Gao
e2d9732682 cutils: add adb trace tag.
Bug: http://b/31289465
Test: systrace
Change-Id: I8537731febc6629f055b86f6e19b16104208c4f8
2016-12-12 12:28:45 -08:00
Mark Salyzyn
809dee506e Merge "libcutils: move cutils/files.h to cutils/android_get_control_file.h"
am: 8c41e791ed

Change-Id: Ifbc00285da734859d590153a7c6cfc8e51c014f9
2016-11-17 15:33:02 +00:00
Mark Salyzyn
52bd37e633 libcutils: move cutils/files.h to cutils/android_get_control_file.h
files.[h|cpp] is bound to be abused with junk, replace with
android_get_control_file.[h|cpp]. Plus some sundry cleanup.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests and init_tests
Bug: 32450474
Change-Id: Ibd4a7aa4624ea19a43d1f98a3c71ac37805d36b5
2016-11-16 15:56:56 -08:00
Mark Salyzyn
c020d3fa6e libcutils: add android_get_control_file()
am: 0b034d9d7b

Change-Id: I7d0a58c12839dba59aa43b96e5a920d3c415efcf
2016-11-04 14:42:57 +00:00
Mark Salyzyn
0b034d9d7b libcutils: add android_get_control_file()
Solve one more issue where privilege is required to open a file and
we do not want to grant such to the service. This is the client side
of the picture, init is the server. The file's descriptor was placed
into the environment as "ANDROID_FILE_<path>" where non-alpha and
non-numeric characters in the <path> are replaced with _ and this
function picks the file descriptor up.

Added definition ANDROID_FILE_ENV_PREFIX ("ANDROID_FILE_") and
android_get_control_file() prototype in a new include <cutils/files.h>

android_get_control_file() checks if the resulting file descriptor is
valid, open and matches the name reference, which on purpose will fail
if a symbolic link is in the path rather than using a fully qualified
path.  Add gTest unit test for both.

Test: gTest libcutils_test --gtest_filter=FileTest.android_get_control_file
Bug: 32450474
Change-Id: I2d0310a1727f1e393a00d9fc7e6cf5d028f27905
2016-11-03 13:34:20 -07:00
Mark Salyzyn
9fd2ffc145 Merge "liblog: restructure log/log.h and android/log.h"
am: 11a7165ecf

Change-Id: I6ebdebdd82e8a59a711ee0fe41056abdacb084b3
2016-10-24 20:46:08 +00:00
Mark Salyzyn
749a298dfd liblog: restructure log/log.h and android/log.h
We went too far, so this is a partial revert, part deux.

Keep general purpose logging macros in android/log.h for the NDK.
More internal features like Radio, System and Events logging are
moved back to log/log.h.  Correct liblog ndk symbols.  Correct for
some Android Coding standards.

Test: compile
Bug: 31992412
Change-Id: Id3731496fa226e8c170305d0d2a1859e8cf67e14
2016-10-24 11:03:49 -07:00
Elliott Hughes
091113ec6c Merge "Remove socket_loopback_client."
am: 5171bebf41

Change-Id: I28080f043ba5a042573e81a6da3f5be83c7a4251
2016-10-14 20:37:06 +00:00
Treehugger Robot
5171bebf41 Merge "Remove socket_loopback_client." 2016-10-14 18:21:38 +00:00
Tao Wu
4b9774fe97 Merge "Fallback to IPv6 when IPv4 is not available in adb" am: c32d7fd66f am: 5b7c6772b0
am: 27c6c4cf04

Change-Id: I2ceb40b4589dfc2721197065ae5a85e9dc83b907
2016-10-14 01:51:54 +00:00
Treehugger Robot
c32d7fd66f Merge "Fallback to IPv6 when IPv4 is not available in adb" 2016-10-14 01:35:43 +00:00
Elliott Hughes
dd92a0a812 Remove socket_loopback_client.
Bug: http://b/31537253
Test: builds
Change-Id: If02c8107206fb60e4622f8937bee0d0a362e1c7d
2016-10-13 16:51:46 -07:00
Chia-I Wu
7e671b343f Merge "Add native_handle_init" am: d790aae4bc am: 28423b86fe
am: bf72cf21dc

Change-Id: I5d4cc013421350dd30fa13d168112d30ad93e7cd
2016-10-13 22:32:57 +00:00
Tao Wu
7b700763f5 Fallback to IPv6 when IPv4 is not available in adb
Test: manual - make sure it works in both IPv4/IPv6 env.
BUG: 31537253
Change-Id: Ica492bff34a8c0441516a213d0e8b78fcdfd3282
Signed-off-by: Tao Wu <lepton@google.com>
2016-10-13 08:54:43 -07:00
Chia-I Wu
b843791b61 Add native_handle_init
HIDL requires file descriptors to be wrapped in native_handle_t.  We want
a low overhead way to do that when the number of file descriptors is known
at compile time.  Instead of

  // wrap an fd in native_handle_t
  native_handle_t* fd_handle = native_handle_create(1, 0);
  if (!fd_handle) {
    // clean up and return error
  }
  fd_handle->data[0] = fd;

  hidl_cb(..., fd_handle);

  native_handle_delete(fd_handle);

this change adds native_handle_init to allow for

  // wrap an fd in native_handle_t
  NATIVE_HANDLE_DECLARE_STORAGE(fd_storage, 1, 0);
  native_handle_t* fd_handle = native_handle_init(fd_storage, 1, 0);
  fd_handle->data[0] = fd;

  hidl_cb(..., fd_handle);

Test: make libcutils
Bug: 32021609
Change-Id: If1fd07482243d37492fdea57c602a1b13c8953cc
2016-10-12 18:04:41 -07:00
Chia-I Wu
ebebf0198d Merge "Add native_handle_clone" am: e8f6c7398b am: 462e087e40
am: cb52dc258e

Change-Id: I011555d429120a26e61fbce5f7a125ce96fadb3f
2016-10-08 01:39:01 +00:00
Chia-I Wu
e8f6c7398b Merge "Add native_handle_clone" 2016-10-08 01:25:35 +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
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
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
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
Chia-I Wu
fd3ea3d118 Add native_handle_clone
libhwbinder's Parcel::readNativeHandleNoDup returns a temporary
native_handle_t.  We want a way to save the temporary handle for later
use.

Change-Id: I16f32043aa8b7d2c0aa57d67551500259b411410
2016-09-26 21:59:04 +08: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
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
7673c4dc88 Merge "Hide warning in cutils/trace.h" am: 5cf3db6d2b am: a802e570b3
am: 06ec4b1352

Change-Id: If41d5b551ffe237922f4768cf403cadf7ee15887
2016-09-22 09:15:21 +00:00
Colin Cross
9993e799f1 Hide warning in cutils/trace.h
system/core/include is included in the global include path using
-isystem, which hides all warnings.  cutils/trace.h has an ignored
return value warning, move the implementation to trace-dev.c so it
doesn't cause warnings in every module that includes it in preparation
for moving from -isystem to -I.

Test: m -j native
Bug: 31492149
Change-Id: If8b3fe13059c9e59c2d5208294d427d84fa6e588
2016-09-21 17:45:31 -07:00
Colin Cross
3b7524fe3a Merge "Fix warnings in cutils/atomic.h" am: 5e093f367c am: 6f292bcab9
am: a205ed0aad

Change-Id: I03b1bcf695452b7f0322aaa166c2fe64fc0b49bb
2016-09-16 20:08:56 +00:00
Colin Cross
ec69c05463 Fix warnings in cutils/atomic.h
system/core/include is included in the global include path using
-isystem, which hides all warnings.  Fix warnings in cutils/atomic.h in
preparation for moving from -isystem to -I.

Test: m -j native
Bug: 31492149
Change-Id: I2a212f192309090a16d507e9ab6acf0fd7cac02d
2016-09-15 19:22:32 -07:00
Felipe Leme
c561b35f29 Added a NETWORK trace tag. am: 785735bde1
am: 860f100454

Change-Id: I729a74de3a1da6cbf176e33dfda253ac47d4dfd8
2016-09-08 00:44:48 +00:00
Felipe Leme
785735bde1 Added a NETWORK trace tag.
BUG: 31281543
Change-Id: I4d7c7fc26c77fec099bbf0f9426e3a9f3a722e6d
2016-09-07 12:47:18 -07:00
Mark Salyzyn
8b1f7b595c Merge "libcutils: Add ashmem_valid() function"
am: d00c7470ea

Change-Id: Ib09d3ee7bb131c30f59ea273f357c045394206fb
2016-08-24 15:48:55 +00:00
Mark Salyzyn
ee431112ff libcutils: Add ashmem_valid() function
Bug: 30310689
Change-Id: I14c52c5d52745a725799652b87c86281ac214899
2016-08-23 15:29:28 -07:00
Dmitriy Filchenko
97e3cb7074 Merge "Remove process_name.c"
am: e5b7ad1c39

Change-Id: I8f98f5fe9ff526ed8780971eddef128ed46de271
2016-08-19 01:30:34 +00:00
Dmitriy Filchenko
1bb49f483b Remove process_name.c
BUG: 29824203

Change-Id: I88d67cafb8ec0c4eea3db047bac0671de698ba02
2016-08-18 23:54:46 +00:00
Elliott Hughes
8932be864d Merge \"Remove no-op klog_init.\"
am: 5558cd362b

Change-Id: I3f2112bead6740f1df48bc5b028f62c91d40425b
2016-07-19 19:48:36 +00:00
Elliott Hughes
489e3fbaa0 Remove no-op klog_init.
Change-Id: I467edad1d004ac16647f4aa1f0eead04e808efa0
2016-07-19 11:45:36 -07:00
Elliott Hughes
73d363bbc1 Merge \"Make klog_fd thread-safe and make klog_init a no-op.\"
am: 588b770063

Change-Id: I884276a8f8b8209f6e956c5fb410e8265184e1b5
2016-07-08 17:05:25 +00:00
Elliott Hughes
171a829c39 Make klog_fd thread-safe and make klog_init a no-op.
I'll come back and remove klog_init when I've removed other calls to it.

Change-Id: Iad7fd26d853b4ddc54e9abd44516b6f138cbbfcb
Test: booted N9, looked at "adb shell dmesg" output.
2016-06-29 16:16:41 -07:00
Josh Gao
88347e1430 Merge changes from topic \'debuggerd_client\'
am: abf88685e3

Change-Id: I2a61e4e8b5ec5a4ab6566ab4f8eb31653255fbc5
2016-06-20 20:47:18 +00:00
Josh Gao
9c02dc5916 debuggerd: add libdebuggerd_client.
Bug: http://b/24414818
Change-Id: I079c534d2c952b6975bf0428eb86cc7a55525737
2016-06-17 13:11:29 -07:00
Josh Gao
771c1ed582 Merge "cutils: don\'t fortify property_get on clang." am: 310da0b990
am: 2a1f209245

* commit '2a1f20924516b41e22adb766b6751869fb5c3af4':
  cutils: don't fortify property_get on clang.

Change-Id: Idd7402dca16633fa19e2110b6d74b005b3e519f9
2016-06-03 19:46:05 +00:00
Treehugger Robot
310da0b990 Merge "cutils: don't fortify property_get on clang." 2016-06-03 19:29:12 +00:00
Josh Gao
74ebdf3c8e cutils: don't fortify property_get on clang.
clang doesn't do the frontend inlining/dead code elimination needed for
the fortified implementation to work. Therefore, turn it off.

Bug: http://b/28381737
Change-Id: Ie8dd970e3908b1daaa587ad2bd041e8f6e2089db
2016-06-02 15:29:11 -07:00
Calin Juravle
65d7c4722c Merge "Add utility to prepare files in a similar way to directories" into nyc-dev
am: 6a29fe931d

* commit '6a29fe931d9fd3bf7f2aad3713dc70c080970763':
  Add utility to prepare files in a similar way to directories

Change-Id: I288024d55e8cead1c902950938b03bfa8dcc3df3
2016-06-02 10:24:54 +00:00
Calin Juravle
9812105b20 Add utility to prepare files in a similar way to directories
Bug: 28785119
Bug: 28625993
Change-Id: I505eb4deca0a89f64fe4505dd6729fe6a48bc1aa
2016-05-24 18:19:12 +01:00