We simply copy the stuff we need from cutils headers.
A future patch will change cutils to include the private <bionic_atomic_inline.h>
Change-Id: Ib6fd9a03bc9e337ce867bd606dc94c2b4438480a
log_channel_t contains fd member, which is file descriptor for
exact logging channel. change cc05d12716
lacks initialization of this member in __write_to_log_init(), thus
logging code is not working, although not crashable.
Additional details may be found in comments here:
http://review.source.android.com/5617
The file descriptor wasn't getting set, so the writev() call was
silently failing.
There's a parallel implementation over in system/core/liblog, but it's
still using the old approach and didn't have this problem.
Main differences from original code:
1. now log channel for LOG_ID_MAIN may exist even if LOG_ID_RADIO
facility failed.
2. __write_to_log_null() now acts as always successful function.
3. it's more simplier to add new logging channels now
ammended commit fixes my typo on line 130
Simplify the code a little, removing un-necessary mutex locks/unlocks.
Provide slightly better diagnostic message in case of corruption.
Use snprintf/strlcat instead of sprintf/strcat