- handle_host_request
- When the host:kill command comes in, shutdown the socket before
calling exit(). If we don't do this, the client will output error info
even though everything is working ok.
- adb_connect()
- If we can't parse the version string, explain this in error output
and don't goto error which would try to close an fd we already closed.
- If host:kill doesn't work, output error info. Don't try to close
already closed fd.
- adb_main()
- If writing the ACK somehow has an error, output error info (I doubt
this will ever get hit).
- adb_commandline()
- Fix typo about max port number.
- Make 'adb kill-server' and 'adb start-server' output any detailed
error info.
Change-Id: Id1a309cc1bf516f7f49bd332b34d30f148b406da
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
adb can hang at shutdown due to a deadlock relating to WSACleanup().
This works around the issue by not calling WSACleanup() which shouldn't
be done anyway since threads aren't done using Winsock at shutdown.
A quick way to reproduce the original problem is to run many instances
of adb, many of which will call exit() soon:
for /l %i in (1,1,20) do @start adb nodaemon server
You may have to boost the 20 to 200, or set ADB_TRACE=1 or use Windows
10 instead of Windows 7, to affect the timing, but eventually there
should be hung adb processes with that repro.
A more complete fix to prevent problems like this from occuring in the
future, would be to additionally do the following:
- Investigate all static destructors that are called when exit() is
called.
- If they don't do anything important, switch all calls to exit() to
instead call _exit() and then ban exit() from being called.
Change-Id: Id1be3bf0053809a45f2eca4461e4c35b5ef9388d
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Change `adb shell` so that interactive sessions use a PTY but
non-interactive do not. This matches `ssh` functionality better
and also enables future work to split stdout/stderr for
non-interactive sessions.
A test to verify this behavior is added to test_device.py with
supporting modifications in device.py.
Bug: http://b/21215503
Change-Id: Ib4ba40df85f82ddef4e0dd557952271c859d1c7b
Make these fatal errors:
- Win32 GetTempPathW() failures.
- Errors opening /dev/null (and don't use LOG(FATAL) for this error
since that will do a crash-dump on Windows which isn't appropriate for a
transient runtime error).
- Errors with dup2.
- Errors opening adb.log.
Change-Id: Ided76a5436d8c6f059d8f6799c49ba04c87181ae
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
- handle_forward_request
- Because we have detailed info about which syscall failed (at least
on Win32), use a more generic prefix of "cannot bind listener" followed
by the detailed info.
- install_listener
- Return string errors for a few errors even though I don't think any
callers actually output the string for those errors.
- Remove the printf since the callers print the message themselves.
- adb_main
- LOG(FATAL) calls abort() which on Windows calls the Windows Error
Reporting service which pops up a dialog asking if you want a
crashdump to be uploaded to Microsoft. So really, abort() is
designed for app bugs. Windows isn't the only one doing this, Chromium
also makes LOG(FATAL) crashdump-ready. Since an error here is not
necessarily an app-bug, use a 'normal' error output API like fatal()
which prints an error and just uses exit().
- sysdeps_win32.cpp
- When Winsock APIs fail, make the string clarify which API failed.
Use terse unix-style descriptions (like what you'd get from
cp/mv/dd/etc.).
- Don't trace WSAEWOULDBLOCK from recv() which is a normal occurrence.
- Add a comment about WSAEWOULDBLOCK => EAGAIN.
Change-Id: I58e47f49fa2f6c1b4b92a36d0c4bfe369b456f2a
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
This is a follow-up to https://android-review.googlesource.com/153623
which prevented android::base::InitLogging() from being called when
tracing was disabled.
It is ok to call InitLogging() on a device or host because calling it
does not imply that a logging file is used, which was the reason for
not calling it on a device.
So this change should preserve the device behavior of not using a
logging file when tracing is disabled, plus it will call InitLogging()
all the time in case logging APIs are called.
Change-Id: I3fd6ba2c567f67a2f111a85f174893fbf866ec57
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
First, HOST is always 0 in adbd, which matches ADB_HOST=0.
Second, HOST is always 1 when adb_main is called, which matches ADB_HOST=1.
For adb client that doesn't call adb_main, it never touches local_init(),
init_transport_registration() and fdevent_loop(). So the changes in adb.cpp,
services.cpp and transport_local.cpp do nothing with it.
As a conclusion, I think we can remove HOST and use ADB_HOST instead.
Change-Id: Ide0e0eca7468b6c3c130f6b50974406280678b2e
libchromeos (dependency of metricsd) is only defined for linux.
All metrics target must only be defined on mac too or the build system
will complain.
BUG: 22879597
Change-Id: I5bee816e001518a8053d1dfc7b39cca81a4314fd
Since watchprops would have to be rewritten anyway in the upcoming properties
rewrite, there seems little point in rewriting it for toybox first. Let's
see how many people actually use watchprops and decide whether it's worth
the effort...
Change-Id: I996e7209bc81633ee66602f09f130226336d9987
MODULE_LICENSE_BSD and NOTICE were removed as the license is no longer
different from the rest of system/core.
BUG: 23086670
Change-Id: I1e83ef2ecb9c721150f8aab283c9ff960337da8c
This builds:
* metrics_client: command line interface to log metrics.
* libmetrics: shared library used by services to log metrics.
* metrics_daemon: background daemon responsible for aggregating the
metrics log and upload it periodically.
BUG: 22879597
Change-Id: I79adc4953d5bfd541df955fbc77d3549f5bbd26b
This makes the import path less confusing:
* metrics/metrics_library.h is imported from the exported headers.
* metricsd/* for includes by the metrics daemon itself.
BUG: 22879597
Change-Id: I9f44ea3a548cae39d4546fcd724e8007f6dd4bd0
DBus is not setup in several targets and the metrics_daemon will crash
if it cannot connect to DBus.
Running metrics daemon without dbus allows us to test the daemon in any
target.
BUG: 22879597
Change-Id: Ica69c8e96c3df794a210a0fa3d44f85a98a660f0