Commit graph

18622 commits

Author SHA1 Message Date
Josh Gao
8e82180c83 Merge changes I36b66fc5,I0561affb
am: 166e716851

* commit '166e716851a11f1c2280b211fe00017e1eb2c3b5':
  libcutils: turn on -Werror on Win32, fix resulting build break.
  libcutils: add prefix to local variables in Android.mk.
2015-11-24 20:17:30 +00:00
Josh Gao
166e716851 Merge changes I36b66fc5,I0561affb
* changes:
  libcutils: turn on -Werror on Win32, fix resulting build break.
  libcutils: add prefix to local variables in Android.mk.
2015-11-24 20:12:08 +00:00
Josh Gao
1175d0fdb0 libcutils: turn on -Werror on Win32, fix resulting build break.
Mingw doesn't provide strndup or strtok_r used in str_parms.c, resulting in
-Wimplicit-function-declaration being emitted for the Windows build.
None of the consumers of str_parms.c appear to be compiled for Windows,
so we can just remove it from the Windows build.

Change-Id: I36b66fc54ed261d38f5294bc8662ddb2db4fe64f
2015-11-24 09:35:45 -08:00
Chih-hung Hsieh
8893c66d35 Merge "Add explicit cast to shut off clang warnings."
am: f091dfe010

* commit 'f091dfe01079293c0a98afd4fe6d5df7bfd85c7f':
  Add explicit cast to shut off clang warnings.
2015-11-24 17:13:44 +00:00
Chih-hung Hsieh
f091dfe010 Merge "Add explicit cast to shut off clang warnings." 2015-11-24 17:08:20 +00:00
Josh Gao
9e86f8e036 libcutils: add prefix to local variables in Android.mk.
Change-Id: I0561affbcc306c20f8aa87beb2d9728a9bb79f5e
2015-11-24 08:45:07 -08:00
Nick Kralevich
17c0edc6ee Merge "init: Don\'t ignore setsockcreatecon errors"
am: 07cb69415a

* commit '07cb69415a478a96c33bffc44bff49d035f51afc':
  init: Don't ignore setsockcreatecon errors
2015-11-24 02:44:57 +00:00
Nick Kralevich
07cb69415a Merge "init: Don't ignore setsockcreatecon errors" 2015-11-24 01:18:12 +00:00
Nick Kralevich
83ccb1c76b init: Don't ignore setsockcreatecon errors
The init language supports setting the creation context of a socket
as the 6th argument to the socket keyword. For example, in the
following service, the context associated with the netd socket
is u:r:netd:s0

service netd /system/bin/netd
    class main
    socket netd stream 0660 root system u:r:netd:s0
    socket dnsproxyd stream 0660 root inet
    socket mdns stream 0660 root system
    socket fwmarkd stream 0660 root inet

The 6 argument form of the socket statement is rarely if ever used,
since the init code supplies a sensible default.

Currently, there's no error checking on the value supplied as
the 6th argument. For example, if you have the following socket
statement:

  socket netd stream 0660 root system graphics

a socket will attempt to get created with an invalid "graphics"
context. When setsockcreatecon fails, it retains the default socket
creation context, which for init is u:r:init:s0. This results in a
socket being created which is in an unexpected context.

Check the return value from the setsockcreatecon() call. If an
invalid context is specified, return early and don't subsequently
attempt to create the socket with the default context.

Bug: 25851205
Change-Id: Ic66cd6f7efe3897fb247b587ddeac5d35e1602b7
2015-11-23 17:09:49 -08:00
Chih-Hung Hsieh
2858ba18e7 Add explicit cast to shut off clang warnings.
* The literals are signed negative int and got warnings about
  .... cannot be narrowed to type uint64_t [-Wc++11-narrowing]

Change-Id: I88c2fc328dfe5c7e2f9ade32bcba273e4a74a84c
2015-11-23 09:07:16 -08:00
Elliott Hughes
49f4f575f9 Merge "Move SendLargeFile into SyncConnection."
am: ddf41f1ad0

* commit 'ddf41f1ad0bc5fbe4a09fbcfde74492a51a705cf':
  Move SendLargeFile into SyncConnection.
2015-11-21 01:48:14 +00:00
Elliott Hughes
ddf41f1ad0 Merge "Move SendLargeFile into SyncConnection." 2015-11-21 01:44:08 +00:00
Elliott Hughes
6aab58c499 Move SendLargeFile into SyncConnection.
Just a trivial refactor. Code change comes later.

Change-Id: If9e509a8c44649e5be4daaca57972939b037b8db
2015-11-20 17:35:17 -08:00
Chih-hung Hsieh
7a2aa9d26d Merge "Add explicit cast to shut off clang warnings."
am: 79cfba55e9

* commit '79cfba55e9d1ff72930f2c10dd5805864baf4276':
  Add explicit cast to shut off clang warnings.
2015-11-20 20:35:13 +00:00
Chih-hung Hsieh
79cfba55e9 Merge "Add explicit cast to shut off clang warnings." 2015-11-20 20:30:10 +00:00
Elliott Hughes
1146ae0205 Merge "Avoid SIGPIPE in adb."
am: 8c5511c692

* commit '8c5511c692eaf3a9239be68dcc8650162933bd10':
  Avoid SIGPIPE in adb.
2015-11-20 20:22:05 +00:00
Elliott Hughes
8c5511c692 Merge "Avoid SIGPIPE in adb." 2015-11-20 20:18:01 +00:00
Chih-Hung Hsieh
caa8810c64 Add explicit cast to shut off clang warnings.
* The literals are signed int type and got warnings about
  .... cannot be narrowed to type int16_t [-Wc++11-narrowing]

Change-Id: I156d8e456c70840953aebb24739f94256248b810
2015-11-20 10:21:55 -08:00
Elliott Hughes
65433da1cb Avoid SIGPIPE in adb.
We're now able to send packets faster than the device can handle them,
meaning that sometimes we're several packets through before the device
says "hey, wait, I can't write" and closes the connection. At best this
led to us reporting that we couldn't sync because "Connection reset";
at worst we'd get SIGPIPE because we were still streaming to a connection
that had already been closed.

This change renames adb_main adb_server_main, and moves the ignoring of
SIGPIPE into adb_commandline so it applies to both client and server (but
not adbd).

This change doesn't address the "wrong error message" part of the problem,
but at least it means you'll get *an* error message.

Bug: http://b/25230872
Change-Id: Ic60e4d13ed03fdcdf0d5cbc97201ebd1097c16ed
2015-11-20 09:42:23 -08:00
Sergio Giro
e483305e47 Merge "libutils: fix cache removal when callback invalidates the key"
am: b0df9dca7c

* commit 'b0df9dca7ca4d7ea2506f42e8b7ad720099401f6':
  libutils: fix cache removal when callback invalidates the key
2015-11-20 17:12:41 +00:00
Sergio Giro
b0df9dca7c Merge "libutils: fix cache removal when callback invalidates the key" 2015-11-20 17:09:10 +00:00
Sergio Giro
b7170fe3fe libutils: fix cache removal when callback invalidates the key
Bug: 24785286
Change-Id: I9d17d2247258a56ef7776b3a701389e825a9c533
2015-11-20 14:54:51 +00:00
Mark Salyzyn
247e22090a Merge "liblog: resolve deadlocks"
am: 8f8a88cad3

* commit '8f8a88cad334a630d6325672a7c6a32a0769a783':
  liblog: resolve deadlocks
2015-11-19 22:45:38 +00:00
Mark Salyzyn
8f8a88cad3 Merge "liblog: resolve deadlocks" 2015-11-19 22:37:25 +00:00
Mark Salyzyn
2d2e0a5c5e liblog: resolve deadlocks
Although ever present, an increased regression introduced with
commit b6bee33182 (liblog: logd:
support logd.timestamp = monotonic).

A signal handler can interrupt in locked context, if log is written
in the signal handler, we are in deadlock. To reduce the contention
and chances for this problem separate out timestamp lock from is
loggable lock to reduce contention situations. Provide a best-guess
response if lock would fail in timestamp path.

Use a common lock() inline within each module, with a comment speaking
to the issues surrounding calling a function that has a mutex within
a signal handler.

ToDo: Hold off signals temporarily in mainline, restart when unblock.
      Can not use pthread_sigmask(SIG_BLOCK,,) as it breaks AtCmd.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 25563384
Change-Id: I47e2c87c988c3e359eb9eef129c6a3a08e9eedef
2015-11-19 13:14:16 -08:00
Elliott Hughes
5e3589da14 Merge "Don\'t send screen unless we\'re talking to a new adbd."
am: 9f90368701

* commit '9f903687011c195154b0c69c02e6aaa35c867242':
  Don't send $TERM unless we're talking to a new adbd.
2015-11-18 21:04:14 +00:00
Elliott Hughes
9f90368701 Merge "Don't send $TERM unless we're talking to a new adbd." 2015-11-18 20:55:40 +00:00
Elliott Hughes
c2252df25a Don't send $TERM unless we're talking to a new adbd.
I put the conditional in the wrong place, not realizing that even the
old shell system allowed one 'argument'.

Bug: http://b/25765657
Change-Id: I2752fb838d6377bf24e5b4cf959462557a196c87
2015-11-18 12:45:48 -08:00
Casey Dahlin
47f25063af Merge "Introduce unique_fd"
am: 9a6b8eeb44

* commit '9a6b8eeb44a78064ffbe4c04928a3904b1be2ab3':
  Introduce unique_fd
2015-11-18 20:44:51 +00:00
Casey Dahlin
9a6b8eeb44 Merge "Introduce unique_fd" 2015-11-18 20:36:05 +00:00
Bertrand Simonnet
b84b7c79a0 Merge "metricsd: Split into two daemons."
am: f3f2c63adb

* commit 'f3f2c63adbc8b123d3de6adfed3362fa9aabc9e3':
  metricsd: Split into two daemons.
2015-11-18 20:05:59 +00:00
Casey Dahlin
918b9e8dc6 Introduce unique_fd
unique_fds are wrappers for integer file descriptors that automatically
close when they go out of scope. They are movable but not copyable and
generally mimic the semantics of std::unique_ptr

Change-Id: I0657b848b6536d5ad9fc06686e240ea5c387b0ac
Test: Considerable exercise in new AIDL integration tests
Bug: None
Signed-off-by: Casey Dahlin <sadmac@google.com>
2015-11-18 12:01:24 -08:00
Bertrand Simonnet
f3f2c63adb Merge "metricsd: Split into two daemons." 2015-11-18 19:53:44 +00:00
Mark Salyzyn
4ad82b5755 Merge "liblog: printable do not escape tabs"
am: 08251c3646

* commit '08251c3646ac8516ddc7a2ccd3fd35e74b10b088':
  liblog: printable do not escape tabs
2015-11-18 18:50:56 +00:00
Mark Salyzyn
08251c3646 Merge "liblog: printable do not escape tabs" 2015-11-18 18:42:55 +00:00
Mark Salyzyn
65d5ca2001 liblog: printable do not escape tabs
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 25755153
Change-Id: I99324e751db0e1ed1eb00820e82b176b6d789249
2015-11-18 09:59:12 -08:00
Bertrand SIMONNET
608e428006 metricsd: Split into two daemons.
This CL splits metrics_daemon into two independent daemons: metricsd and
metrics_collector.

* metricsd will be responsible for reading the metrics from disk and
  periodically uploading them to the server.
* metrics_collector will be responsible for gathering generic metrics
  from the system and managing the weave state for metrics.

This refactoring is necessary to prepare the migration of metricsd to
log over binder.

Bug: 25670908
Test: Unit tests.
Test: manual: both daemons run. Metrics are logged, uploaded and the
      weave interaction works.

Change-Id: Ib00e1772bb7eec87cbcdcd912c30b555d79d7074
2015-11-18 09:54:16 -08:00
Josh Gao
975c9a6863 Merge "adb: don\'t use adb_dirname in between getting and printing errno."
am: 44901f1147

* commit '44901f1147104f9f5726e250052e0bcb14823f5c':
  adb: don't use adb_dirname in between getting and printing errno.
2015-11-18 00:52:12 +00:00
Josh Gao
44901f1147 Merge "adb: don't use adb_dirname in between getting and printing errno." 2015-11-18 00:44:05 +00:00
Josh Gao
e2773a3f8e Merge "debuggerd: remove some levels of indentation."
am: cdff80c446

* commit 'cdff80c4462ae582dbe490db96aca500454513de':
  debuggerd: remove some levels of indentation.
2015-11-18 00:37:39 +00:00
Josh Gao
cdff80c446 Merge "debuggerd: remove some levels of indentation." 2015-11-18 00:16:01 +00:00
Josh Gao
8ab7fd4017 debuggerd: remove some levels of indentation.
Use ScopedFd and unique_ptr to manage resources, so that we can early
exit instead of having 9 levels of indentation.

Change-Id: Ia5fed76c7d959f1f198ea540c56c508f7e1585c4
2015-11-17 14:44:50 -08:00
Josh Gao
f6e65e3f80 adb: don't use adb_dirname in between getting and printing errno.
adb_dirname might trample over the errno value we want to print. Move
the adb_dirname call out to a local to prevent this.

Change-Id: I8a62cb2e1be8704225a9c3b72dd01259c7eaaae4
2015-11-17 14:41:57 -08:00
Josh Gao
167b4bed93 Merge "Revert "libcutils: don\'t build for Windows.""
am: 39a1b77381

* commit '39a1b773817aafc98e20910d2dd6dd790ea08bf3':
  Revert "libcutils: don't build for Windows."
2015-11-17 22:36:54 +00:00
Josh Gao
39a1b77381 Merge "Revert "libcutils: don't build for Windows."" 2015-11-17 22:31:13 +00:00
Josh Gao
b4362070fc Merge "debuggerd: add .clang-format."
am: c5a85f71ab

* commit 'c5a85f71ab2ff21bdb06dfbb0e7ff3fded8a133c':
  debuggerd: add .clang-format.
2015-11-17 22:29:46 +00:00
Josh Gao
cab716f101 Revert "libcutils: don't build for Windows."
This reverts commit bb3f9ce0aa.
2015-11-17 14:28:33 -08:00
Josh Gao
053eba0bc1 Merge changes Ice07f892,Ie1f082a0
am: 74a33fbcef

* commit '74a33fbcef65d8964d5dfe1d6bd2f4b8d8e154b2':
  libcutils: don't build for Windows.
  adb: don't link against libcutils on Windows.
2015-11-17 22:28:06 +00:00
Bertrand Simonnet
f826969e10 Merge "metricsd: Don\'t upload if product id is empty."
am: 0ba2606444

* commit '0ba260644440f51cd5e1d8db10bebf4c041ec7e7':
  metricsd: Don't upload if product id is empty.
2015-11-17 22:22:39 +00:00
Josh Gao
c5a85f71ab Merge "debuggerd: add .clang-format." 2015-11-17 22:21:29 +00:00