The earliest point we can start logd is after /system is mounted.
Ideally on post-fs-system (does not exist), post-fs will do.
As insurance, we will also make sure logd is started if a
logd-reinit is requested. This results in logd starting at least
4 processes earlier than it does currently, with a tighter
grouping of threads which means we are taking advantage of a
lighter CPU load at the time, rather than taking cycles during
heavy activity during core startup.
Change-Id: If4f0bd3a53bb4c47500a54d741ca635d87c0c330
C (but not C++) has a concept of a flexible array member, which
is documented at https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html .
Using a flexible array member indicates that the structure is
really a header for a variable length object.
In logd's case, the variable length structure android_event_string_t
was embedded within another structure called
android_log_event_string_t. This makes gcc's __builtin_object_size()
function really confused. When compiling with C++,
__builtin_object_size(android_log_event_string_t.payload.data, 1)
would return 0, whereas if you compiled the code with C, the same
call would (properly) return -1.
Code which does automatic bounds checking, such as the proposed
patch at https://android-review.googlesource.com/145411 , will
cause problems for logd if this syntax is used.
Don't try to embed a variable length structure within another
structure. This doesn't appear to be valid C nor C++, and
while it's worked, it seems problematic.
Instead, inline the structure so it's one big happy structure.
Change-Id: I8ac02b7142a4f6560f5f80df2effcf720f9896fc
(Cherry picked from commit 83e6f2606b)
Resolved conflict in include/private/android_filesystem_config.h, content
already in libcutils/fs_config.c.
Change-Id: I817707721786e9b920fef14ebe836fdcd65a8606
adb shell uses termios to disable canonical input processing in order to
get raw control codes but it does not disable CR/LF translation. The default
for Linux terminals is to convert CR to LF unless the running program
specifically asks for this to be disabled. Since adb does not, there is no
way to send a CR to any program run on adb shell. Many programs do in fact
differentiate and so are broken by this behaviour, notably nano. This patch
sets the termios flags to disable all line ending translation.
Change-Id: I8b950220f7cc52fefaed2ee37d97e0789b40a078
Signed-off-by: Alistair Buxton <a.j.buxton@gmail.com>
Some of this code was unused, most didn't need to be exposed, and we
can just use basename(3).
Also use a better default program name than "unknown".
Change-Id: I62d990f64e4fd0c16aa4b7e907dd06e4f26ddcdd
While the defaults (logd or stderr) make sense for most use cases,
there are places that can only log to the kernel, or need to log to a
file, etc.
Allow the user to pass in an arbitrary logging object, and provide
LogdLogger and StderrLogger as defaults.
Change-Id: I62368acc795ff313242bb205d65017404bf64e88
Change 055f1aa4ff switched to using isalnum(3)
but didn't take into account that isalnum has the opposite sense to the
function it replaced, so the tests should have been inverted.
Bug: http://b/20056546
Change-Id: I90630c0bea69ddbb4a95dc09f79f49d23fd497de
__android_log_write() was just a special form of
__android_log_buf_write that used a default log ID and set the abort
message for fatal messages. Presumably the latter was intended to be
set for __android_log_buf_write as well.
Change-Id: I51cff7561a2754676b2088d95fa4f4505ac3c3c2
LOGTO(dest, severity) and PLOGTO(dest, severity) log to other log
buffers. For example, `LOGTO(SYSTEM, FATAL) << "Foobar";`.
Change-Id: Id1ca1c8fdae72d69b73945ae9b006525d0be1582
Several people have been independently confused about when this gets
built and why over the past couple of days.
Change-Id: I2d4a02f66e24c0734327585b7d27e50a344b1e94