android_log_timestamp returns the property leading letter,
it is better to return a clockid_t with android_log_clockid()
Bug: 23668800
Change-Id: I3c4e3e6b87f6676950797f1f0e203b44c542ed43
Also, inline the bulk_read and bulk_write functions which were only
being used by one other function.
Bug: http://b/25847115
Change-Id: I218a869030219f606577a5529601c542488115e0
If __system_property_area_init() fails, there is a fundamental issue
with the system and we should abort from init.
Bug: 21852512
Change-Id: I05d7978ba3bcc347027a6d9443de7cdd229033d2
This will make it easier to catch formatting nits.
This style is based on the Google style guide (well known publicly) and
follows the Chromium style changes we have adopted.
Bug: 25887990
Change-Id: If9562223752dfe611a32c341e703338f806bcc0f
/property_contexts exists before selinux policies are loaded, so we must
restorecon before other processes can access it
Bug: 21852512
Change-Id: Ie983caac635eb928ab19eea996a5625f3673de39
Before, an anonymous map wound up printing the pc as relative.
Unfortunately, this meant that it was impossible to tell the actual
pc. The new code prints the map name as <anonymous:map_start> and
still prints the pc as relative.
In addition, add the start of the map for map names that begin with a
'[' character.
Bug: 25844836
Change-Id: Ie0b6149dde258fe13f0e5a3e5739d85374512f4b
Instead of using a single directory for both the internal data of
metricsd and metrics_collector and the shared files (metrics samples log
file and the metrics enabled file), we should use separate directory to
allow for a finer access control.
The new structure will be:
* /data/misc/metrics for the files accessible to all daemons reporting
metrics, metricsd and metrics_collector.
* /data/misc/metricsd for the private files of metricsd.
* /data/misc/metrics_collector for the private files of
metrics_collector.
Bug: 25886951
Test: Unit tests.
Test: Manual: metricsd and metrics_collector run without errors.
Change-Id: I006d19f45f5f419d2b08744126c2e2a0b899c9fa
Instead of using a global directory for persistent integers, specify the
directory to use in the constructor.
This will make changing the backing directory easier.
Bug: 25886951
Change-Id: I590816b195fa81b179a5ec78b9cdf41bc86353dc
If we stat a file and get a size of 0, and then successfully read bytes
from that file, we would previously divide by zero when calculating the
percentage completion of the file. This case happens either when we're
racing against something else writing to the file, or when we're pulling
magical files such as the ones in /dev/cpuctl/ that lie about their
size.
Bug: http://b/25925733
Change-Id: I980b9c14f44a1eb4a42bc8736c94fa6db06c08d1
The previous change to do this (f96dc73b) only skipped individually
named symlinks, not symlinks inside of a directory that was being
pulled.
Bug: http://b/25601283
Change-Id: I25bdcbc546a9d3a0dbd8dacdb065fb134d96022b
Codesearch finds no reference to this in the Android tree. It was
added in 2010 in commit bbf1c64527.
Change-Id: I8cd1153912b78b4b23b8f5ba2577a58c5c49e316
Anyone wanting to call /system/xbin/librank can execute "su"
beforehand. There's no need for it to be setuid root.
Bug: 25739721
Change-Id: Ie3d68701397d21e901bf1ec17b4b4a9f12128d2d
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
Use /system/etc/security/cacerts_google as the default certificates
directory. If the crash_reporter.full_certs property is set to 1,
use the full /system/etc/security/cacerts directory. This
property can be set in a target's product.mk, if they decide to
configure crash_reporter with a crash_server not covered by the
cacerts_google subset of certificates.
Bug: 25798318
Change-Id: I617c3d13b74af8d9577823a8f1a61f8375bcb504
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
* The literals are signed negative int and got warnings about
.... cannot be narrowed to type uint64_t [-Wc++11-narrowing]
Change-Id: I88c2fc328dfe5c7e2f9ade32bcba273e4a74a84c
This patch ensures that we read any error response from the server if the
server closes the connection. Unfortunately, that's not sufficient to ensure
that we always see the server's error message --- sometimes the data just
gets thrown away because we keep writing without reading. Setting SO_LINGER
avoids this.
Bug: http://b/25230872
Change-Id: I96c019cc72bd139198de79bf29e6536cc462c20f
* The literals are signed int type and got warnings about
.... cannot be narrowed to type int16_t [-Wc++11-narrowing]
Change-Id: I156d8e456c70840953aebb24739f94256248b810
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
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
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