Merge changes I0c25e038,I33a8fb4e,I2c9cbbbd,If4c9711e,I4b00c0df, ...
* changes: liblog: Move liblog tag from 1005 to 1006 system/core Replace log/log.h with android/log.h system/core Replace cutils/log.h with android/log.h logd: logcat: Replace log/log.h with android/log.h libcutils: Replace cutils/log.h with android/log.h liblog: Replace log/log.h with android/log.h liblog: logcat: Replace log/logd.h with log/log.h liblog: logd: logcat: deprecate log/log_read.h liblog: Add C++ wrapper for C event log handler
This commit is contained in:
commit
07607c04ff
143 changed files with 1527 additions and 1496 deletions
|
|
@ -31,17 +31,17 @@
|
|||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <selinux/android.h>
|
||||
|
||||
#include "adb.h"
|
||||
#include "adb_io.h"
|
||||
#include "adb_utils.h"
|
||||
#include "private/android_filesystem_config.h"
|
||||
#include "security_log_tags.h"
|
||||
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <log/log.h>
|
||||
#include <selinux/android.h>
|
||||
|
||||
static bool should_use_fs_config(const std::string& path) {
|
||||
// TODO: use fs_config to configure permissions on /data.
|
||||
return android::base::StartsWith(path, "/system/") ||
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@
|
|||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <paths.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "adb.h"
|
||||
#include "adb_io.h"
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@
|
|||
#include <pthread.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include <adf/adf.h>
|
||||
#include <adfhwc/adfhwc.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
struct adf_hwc_helper {
|
||||
adf_hwc_event_callbacks const *event_cb;
|
||||
void *event_cb_data;
|
||||
|
|
|
|||
|
|
@ -43,18 +43,18 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "android-base/macros.h"
|
||||
#include "android-base/strings.h"
|
||||
|
||||
// Headers for LogMessage::LogLine.
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
#include <android/set_abort_message.h>
|
||||
#include "log/log.h"
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
// For gettid.
|
||||
#if defined(__APPLE__)
|
||||
#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
|
|
@ -27,12 +28,14 @@
|
|||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/parseint.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "boot_event_record_store.h"
|
||||
#include "event_log_list_builder.h"
|
||||
#include "event_log_list_builder.h" /* ToDo: switch to liblog implementation */
|
||||
#include "histogram_logger.h"
|
||||
#include "uptime_parser.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <log/log.h>
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@
|
|||
#include "event_log_list_builder.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <log/log.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using testing::ElementsAreArray;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@
|
|||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "event_log_list_builder.h"
|
||||
|
||||
namespace bootstat {
|
||||
|
|
@ -38,4 +40,4 @@ void LogHistogram(const std::string& event, int32_t data) {
|
|||
android_bWriteLog(HISTOGRAM_LOG_TAG, log.get(), size);
|
||||
}
|
||||
|
||||
} // namespace bootstat
|
||||
} // namespace bootstat
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
#include <sys/ptrace.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -16,25 +16,24 @@
|
|||
|
||||
#define LOG_TAG "DEBUG"
|
||||
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
|
||||
#include <log/log.h>
|
||||
|
||||
#include "backtrace.h"
|
||||
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#if defined(STATIC_CRASHER)
|
||||
#include "debuggerd/client.h"
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <log/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
|
||||
#include "elf_utils.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,22 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/inotify.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/poll.h>
|
||||
#include <linux/input.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <memory>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
static struct pollfd* ufds;
|
||||
static char** device_names;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
// Forward declarations.
|
||||
|
|
|
|||
|
|
@ -25,23 +25,21 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/logprint.h>
|
||||
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <backtrace/BacktraceMap.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/logprint.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
||||
#include <selinux/android.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@
|
|||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
// Whitelist output desired in the logcat output.
|
||||
bool is_allowed_in_logcat(enum logtype ltype) {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/ptrace.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "utility.h"
|
||||
|
|
|
|||
|
|
@ -16,20 +16,17 @@
|
|||
|
||||
#define LOG_TAG "fingerprintd"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <binder/PermissionCache.h>
|
||||
#include <utils/String16.h>
|
||||
|
||||
#include <keystore/IKeystoreService.h>
|
||||
#include <keystore/keystore.h> // for error codes
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/fingerprint.h>
|
||||
#include <hardware/hw_auth_token.h>
|
||||
#include <keystore/IKeystoreService.h>
|
||||
#include <keystore/keystore.h> // for error codes
|
||||
#include <utils/Log.h>
|
||||
#include <utils/String16.h>
|
||||
|
||||
#include "FingerprintDaemonProxy.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,25 +19,22 @@
|
|||
#include "IGateKeeperService.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <binder/PermissionCache.h>
|
||||
#include <utils/String16.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <keystore/IKeystoreService.h>
|
||||
#include <keystore/keystore.h> // For error code
|
||||
#include <gatekeeper/password_handle.h> // for password_handle_t
|
||||
#include <hardware/gatekeeper.h>
|
||||
#include <hardware/hw_auth_token.h>
|
||||
#include <keystore/IKeystoreService.h>
|
||||
#include <keystore/keystore.h> // For error code
|
||||
#include <utils/Log.h>
|
||||
#include <utils/String16.h>
|
||||
|
||||
#include "SoftGateKeeperDevice.h"
|
||||
#include "IUserManager.h"
|
||||
|
|
|
|||
|
|
@ -67,7 +67,17 @@
|
|||
* NOTE: These functions MUST be implemented by /system/lib/liblog.so
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -142,6 +152,690 @@ void __android_log_assert(const char *cond, const char *tag,
|
|||
#endif
|
||||
;
|
||||
|
||||
//
|
||||
// C/C++ logging functions. See the logging documentation for API details.
|
||||
//
|
||||
// We'd like these to be available from C code (in case we import some from
|
||||
// somewhere), so this has a C interface.
|
||||
//
|
||||
// The output will be correct when the log file is shared between multiple
|
||||
// threads and/or multiple processes so long as the operating system
|
||||
// supports O_APPEND. These calls have mutex-protected data structures
|
||||
// and so are NOT reentrant. Do not use LOG in a signal handler.
|
||||
//
|
||||
|
||||
// This file uses ", ## __VA_ARGS__" zero-argument token pasting to
|
||||
// work around issues with debug-only syntax errors in assertions
|
||||
// that are missing format strings. See commit
|
||||
// 19299904343daf191267564fe32e6cd5c165cd42
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
|
||||
int __android_log_bwrite(int32_t tag, const void *payload, size_t len);
|
||||
int __android_log_btwrite(int32_t tag, char type, const void *payload,
|
||||
size_t len);
|
||||
int __android_log_bswrite(int32_t tag, const char *payload);
|
||||
|
||||
int __android_log_security_bwrite(int32_t tag, const void *payload, size_t len);
|
||||
int __android_log_security_bswrite(int32_t tag, const char *payload);
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Normally we strip ALOGV (VERBOSE messages) from release builds.
|
||||
* You can modify this (for example with "#define LOG_NDEBUG 0"
|
||||
* at the top of your source file) to change that behavior.
|
||||
*/
|
||||
#ifndef LOG_NDEBUG
|
||||
#ifdef NDEBUG
|
||||
#define LOG_NDEBUG 1
|
||||
#else
|
||||
#define LOG_NDEBUG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is the local tag used for the following simplified
|
||||
* logging macros. You can change this preprocessor definition
|
||||
* before using the other macros to change the tag.
|
||||
*/
|
||||
#ifndef LOG_TAG
|
||||
#define LOG_TAG NULL
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef __predict_false
|
||||
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -DLINT_RLOG in sources that you want to enforce that all logging
|
||||
* goes to the radio log buffer. If any logging goes to any of the other
|
||||
* log buffers, there will be a compile or link error to highlight the
|
||||
* problem. This is not a replacement for a full audit of the code since
|
||||
* this only catches compiled code, not ifdef'd debug code. Options to
|
||||
* defining this, either temporarily to do a spot check, or permanently
|
||||
* to enforce, in all the communications trees; We have hopes to ensure
|
||||
* that by supplying just the radio log buffer that the communications
|
||||
* teams will have their one-stop shop for triaging issues.
|
||||
*/
|
||||
#ifndef LINT_RLOG
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGV
|
||||
#define __ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define ALOGV(...) do { if (0) { __ALOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define ALOGV(...) __ALOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define ALOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define ALOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGD
|
||||
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGD_IF
|
||||
#define ALOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGI
|
||||
#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGI_IF
|
||||
#define ALOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGW
|
||||
#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGW_IF
|
||||
#define ALOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGE
|
||||
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGE_IF
|
||||
#define ALOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* verbose priority.
|
||||
*/
|
||||
#ifndef IF_ALOGV
|
||||
#if LOG_NDEBUG
|
||||
#define IF_ALOGV() if (false)
|
||||
#else
|
||||
#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* debug priority.
|
||||
*/
|
||||
#ifndef IF_ALOGD
|
||||
#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* info priority.
|
||||
*/
|
||||
#ifndef IF_ALOGI
|
||||
#define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* warn priority.
|
||||
*/
|
||||
#ifndef IF_ALOGW
|
||||
#define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* error priority.
|
||||
*/
|
||||
#ifndef IF_ALOGE
|
||||
#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGV
|
||||
#define __SLOGV(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define SLOGV(...) do { if (0) { __SLOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define SLOGV(...) __SLOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SLOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define SLOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define SLOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGD
|
||||
#define SLOGD(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGD_IF
|
||||
#define SLOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGI
|
||||
#define SLOGI(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGI_IF
|
||||
#define SLOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGW
|
||||
#define SLOGW(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGW_IF
|
||||
#define SLOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGE
|
||||
#define SLOGE(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGE_IF
|
||||
#define SLOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
#endif /* !LINT_RLOG */
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGV
|
||||
#define __RLOGV(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define RLOGV(...) do { if (0) { __RLOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define RLOGV(...) __RLOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RLOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define RLOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define RLOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGD
|
||||
#define RLOGD(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGD_IF
|
||||
#define RLOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGI
|
||||
#define RLOGI(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGI_IF
|
||||
#define RLOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGW
|
||||
#define RLOGW(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGW_IF
|
||||
#define RLOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGE
|
||||
#define RLOGE(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGE_IF
|
||||
#define RLOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Log a fatal error. If the given condition fails, this stops program
|
||||
* execution like a normal assertion, but also generating the given message.
|
||||
* It is NOT stripped from release builds. Note that the condition test
|
||||
* is -inverted- from the normal assert() semantics.
|
||||
*/
|
||||
#ifndef LOG_ALWAYS_FATAL_IF
|
||||
#define LOG_ALWAYS_FATAL_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)android_printAssert(#cond, LOG_TAG, ## __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
#ifndef LOG_ALWAYS_FATAL
|
||||
#define LOG_ALWAYS_FATAL(...) \
|
||||
( ((void)android_printAssert(NULL, LOG_TAG, ## __VA_ARGS__)) )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that
|
||||
* are stripped out of release builds.
|
||||
*/
|
||||
#if LOG_NDEBUG
|
||||
|
||||
#ifndef LOG_FATAL_IF
|
||||
#define LOG_FATAL_IF(cond, ...) ((void)0)
|
||||
#endif
|
||||
#ifndef LOG_FATAL
|
||||
#define LOG_FATAL(...) ((void)0)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LOG_FATAL_IF
|
||||
#define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ## __VA_ARGS__)
|
||||
#endif
|
||||
#ifndef LOG_FATAL
|
||||
#define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assertion that generates a log message when the assertion fails.
|
||||
* Stripped out of release builds. Uses the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOG_ASSERT
|
||||
#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__)
|
||||
//#define ALOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Basic log message macro.
|
||||
*
|
||||
* Example:
|
||||
* ALOG(LOG_WARN, NULL, "Failed with error %d", errno);
|
||||
*
|
||||
* The second argument may be NULL or "" to indicate the "global" tag.
|
||||
*/
|
||||
#ifndef ALOG
|
||||
#define ALOG(priority, tag, ...) \
|
||||
LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log macro that allows you to specify a number for the priority.
|
||||
*/
|
||||
#ifndef LOG_PRI
|
||||
#define LOG_PRI(priority, tag, ...) \
|
||||
android_printLog(priority, tag, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log macro that allows you to pass in a varargs ("args" is a va_list).
|
||||
*/
|
||||
#ifndef LOG_PRI_VA
|
||||
#define LOG_PRI_VA(priority, tag, fmt, args) \
|
||||
android_vprintLog(priority, NULL, tag, fmt, args)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional given a desired logging priority and tag.
|
||||
*/
|
||||
#ifndef IF_ALOG
|
||||
#define IF_ALOG(priority, tag) \
|
||||
if (android_testLog(ANDROID_##priority, tag))
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Event logging.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Event log entry types.
|
||||
*/
|
||||
typedef enum {
|
||||
/* Special markers for android_log_list_element type */
|
||||
EVENT_TYPE_LIST_STOP = '\n', /* declare end of list */
|
||||
EVENT_TYPE_UNKNOWN = '?', /* protocol error */
|
||||
|
||||
/* must match with declaration in java/android/android/util/EventLog.java */
|
||||
EVENT_TYPE_INT = 0, /* uint32_t */
|
||||
EVENT_TYPE_LONG = 1, /* uint64_t */
|
||||
EVENT_TYPE_STRING = 2,
|
||||
EVENT_TYPE_LIST = 3,
|
||||
EVENT_TYPE_FLOAT = 4,
|
||||
} AndroidEventLogType;
|
||||
#define sizeof_AndroidEventLogType sizeof(typeof_AndroidEventLogType)
|
||||
#define typeof_AndroidEventLogType unsigned char
|
||||
|
||||
#ifndef LOG_EVENT_INT
|
||||
#define LOG_EVENT_INT(_tag, _value) { \
|
||||
int intBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_INT, &intBuf, \
|
||||
sizeof(intBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_LONG
|
||||
#define LOG_EVENT_LONG(_tag, _value) { \
|
||||
long long longBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_LONG, &longBuf, \
|
||||
sizeof(longBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_FLOAT
|
||||
#define LOG_EVENT_FLOAT(_tag, _value) { \
|
||||
float floatBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_FLOAT, &floatBuf, \
|
||||
sizeof(floatBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_STRING
|
||||
#define LOG_EVENT_STRING(_tag, _value) \
|
||||
(void) __android_log_bswrite(_tag, _value);
|
||||
#endif
|
||||
|
||||
typedef enum log_id {
|
||||
LOG_ID_MIN = 0,
|
||||
|
||||
#ifndef LINT_RLOG
|
||||
LOG_ID_MAIN = 0,
|
||||
#endif
|
||||
LOG_ID_RADIO = 1,
|
||||
#ifndef LINT_RLOG
|
||||
LOG_ID_EVENTS = 2,
|
||||
LOG_ID_SYSTEM = 3,
|
||||
LOG_ID_CRASH = 4,
|
||||
LOG_ID_SECURITY = 5,
|
||||
LOG_ID_KERNEL = 6, /* place last, third-parties can not use it */
|
||||
#endif
|
||||
|
||||
LOG_ID_MAX
|
||||
} log_id_t;
|
||||
#define sizeof_log_id_t sizeof(typeof_log_id_t)
|
||||
#define typeof_log_id_t unsigned char
|
||||
|
||||
/* For manipulating lists of events. */
|
||||
|
||||
#define ANDROID_MAX_LIST_NEST_DEPTH 8
|
||||
|
||||
/*
|
||||
* The opaque context used to manipulate lists of events.
|
||||
*/
|
||||
typedef struct android_log_context_internal *android_log_context;
|
||||
|
||||
/*
|
||||
* Elements returned when reading a list of events.
|
||||
*/
|
||||
typedef struct {
|
||||
AndroidEventLogType type;
|
||||
uint16_t complete;
|
||||
uint16_t len;
|
||||
union {
|
||||
int32_t int32;
|
||||
int64_t int64;
|
||||
char *string;
|
||||
float float32;
|
||||
} data;
|
||||
} android_log_list_element;
|
||||
|
||||
/*
|
||||
* Creates a context associated with an event tag to write elements to
|
||||
* the list of events.
|
||||
*/
|
||||
android_log_context create_android_logger(uint32_t tag);
|
||||
|
||||
/* All lists must be braced by a begin and end call */
|
||||
/*
|
||||
* NB: If the first level braces are missing when specifying multiple
|
||||
* elements, we will manufacturer a list to embrace it for your API
|
||||
* convenience. For a single element, it will remain solitary.
|
||||
*/
|
||||
int android_log_write_list_begin(android_log_context ctx);
|
||||
int android_log_write_list_end(android_log_context ctx);
|
||||
|
||||
int android_log_write_int32(android_log_context ctx, int32_t value);
|
||||
int android_log_write_int64(android_log_context ctx, int64_t value);
|
||||
int android_log_write_string8(android_log_context ctx, const char *value);
|
||||
int android_log_write_string8_len(android_log_context ctx,
|
||||
const char *value, size_t maxlen);
|
||||
int android_log_write_float32(android_log_context ctx, float value);
|
||||
|
||||
/* Submit the composed list context to the specified logger id */
|
||||
/* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */
|
||||
int android_log_write_list(android_log_context ctx, log_id_t id);
|
||||
|
||||
/*
|
||||
* Creates a context from a raw buffer representing a list of events to be read.
|
||||
*/
|
||||
android_log_context create_android_log_parser(const char *msg, size_t len);
|
||||
|
||||
android_log_list_element android_log_read_next(android_log_context ctx);
|
||||
android_log_list_element android_log_peek_next(android_log_context ctx);
|
||||
|
||||
/* Finished with reader or writer context */
|
||||
int android_log_destroy(android_log_context *ctx);
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
*
|
||||
* The stuff in the rest of this file should not be used directly.
|
||||
*/
|
||||
|
||||
#define android_printLog(prio, tag, ...) \
|
||||
__android_log_print(prio, tag, __VA_ARGS__)
|
||||
|
||||
#define android_vprintLog(prio, cond, tag, ...) \
|
||||
__android_log_vprint(prio, tag, __VA_ARGS__)
|
||||
|
||||
/* XXX Macros to work around syntax errors in places where format string
|
||||
* arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
||||
* (happens only in debug builds).
|
||||
*/
|
||||
|
||||
/* Returns 2nd arg. Used to substitute default value if caller's vararg list
|
||||
* is empty.
|
||||
*/
|
||||
#define __android_second(dummy, second, ...) second
|
||||
|
||||
/* If passed multiple args, returns ',' followed by all but 1st arg, otherwise
|
||||
* returns nothing.
|
||||
*/
|
||||
#define __android_rest(first, ...) , ## __VA_ARGS__
|
||||
|
||||
#define android_printAssert(cond, tag, ...) \
|
||||
__android_log_assert(cond, tag, \
|
||||
__android_second(0, ## __VA_ARGS__, NULL) __android_rest(__VA_ARGS__))
|
||||
|
||||
#define android_writeLog(prio, tag, text) \
|
||||
__android_log_write(prio, tag, text)
|
||||
|
||||
#define android_bWriteLog(tag, payload, len) \
|
||||
__android_log_bwrite(tag, payload, len)
|
||||
#define android_btWriteLog(tag, type, payload, len) \
|
||||
__android_log_btwrite(tag, type, payload, len)
|
||||
|
||||
#define android_errorWriteLog(tag, subTag) \
|
||||
__android_log_error_write(tag, subTag, -1, NULL, 0)
|
||||
|
||||
#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
|
||||
__android_log_error_write(tag, subTag, uid, data, dataLen)
|
||||
|
||||
/*
|
||||
* IF_ALOG uses android_testLog, but IF_ALOG can be overridden.
|
||||
* android_testLog will remain constant in its purpose as a wrapper
|
||||
* for Android logging filter policy, and can be subject to
|
||||
* change. It can be reused by the developers that override
|
||||
* IF_ALOG as a convenient means to reimplement their policy
|
||||
* over Android.
|
||||
*/
|
||||
#if LOG_NDEBUG /* Production */
|
||||
#define android_testLog(prio, tag) \
|
||||
(__android_log_is_loggable(prio, tag, ANDROID_LOG_DEBUG) != 0)
|
||||
#else
|
||||
#define android_testLog(prio, tag) \
|
||||
(__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE) != 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use the per-tag properties "log.tag.<tagname>" to generate a runtime
|
||||
* result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to
|
||||
* ANDROID_LOG_FATAL. default_prio if no property. Undefined behavior if
|
||||
* any other value.
|
||||
*/
|
||||
int __android_log_is_loggable(int prio, const char *tag, int default_prio);
|
||||
|
||||
int __android_log_security(); /* Device Owner is present */
|
||||
|
||||
int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data,
|
||||
uint32_t dataLen);
|
||||
|
||||
/*
|
||||
* Send a simple string to the log.
|
||||
*/
|
||||
int __android_log_buf_write(int bufID, int prio, const char *tag, const char *text);
|
||||
int __android_log_buf_print(int bufID, int prio, const char *tag, const char *fmt, ...)
|
||||
#if defined(__GNUC__)
|
||||
__attribute__((__format__(printf, 4, 5)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
|
|
|||
|
|
@ -1,712 +1 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// C/C++ logging functions. See the logging documentation for API details.
|
||||
//
|
||||
// We'd like these to be available from C code (in case we import some from
|
||||
// somewhere), so this has a C interface.
|
||||
//
|
||||
// The output will be correct when the log file is shared between multiple
|
||||
// threads and/or multiple processes so long as the operating system
|
||||
// supports O_APPEND. These calls have mutex-protected data structures
|
||||
// and so are NOT reentrant. Do not use LOG in a signal handler.
|
||||
//
|
||||
#ifndef _LIBS_LOG_LOG_H
|
||||
#define _LIBS_LOG_LOG_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/logd.h>
|
||||
#include <log/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// This file uses ", ## __VA_ARGS__" zero-argument token pasting to
|
||||
// work around issues with debug-only syntax errors in assertions
|
||||
// that are missing format strings. See commit
|
||||
// 19299904343daf191267564fe32e6cd5c165cd42
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Normally we strip ALOGV (VERBOSE messages) from release builds.
|
||||
* You can modify this (for example with "#define LOG_NDEBUG 0"
|
||||
* at the top of your source file) to change that behavior.
|
||||
*/
|
||||
#ifndef LOG_NDEBUG
|
||||
#ifdef NDEBUG
|
||||
#define LOG_NDEBUG 1
|
||||
#else
|
||||
#define LOG_NDEBUG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is the local tag used for the following simplified
|
||||
* logging macros. You can change this preprocessor definition
|
||||
* before using the other macros to change the tag.
|
||||
*/
|
||||
#ifndef LOG_TAG
|
||||
#define LOG_TAG NULL
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef __predict_false
|
||||
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -DLINT_RLOG in sources that you want to enforce that all logging
|
||||
* goes to the radio log buffer. If any logging goes to any of the other
|
||||
* log buffers, there will be a compile or link error to highlight the
|
||||
* problem. This is not a replacement for a full audit of the code since
|
||||
* this only catches compiled code, not ifdef'd debug code. Options to
|
||||
* defining this, either temporarily to do a spot check, or permanently
|
||||
* to enforce, in all the communications trees; We have hopes to ensure
|
||||
* that by supplying just the radio log buffer that the communications
|
||||
* teams will have their one-stop shop for triaging issues.
|
||||
*/
|
||||
#ifndef LINT_RLOG
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGV
|
||||
#define __ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define ALOGV(...) do { if (0) { __ALOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define ALOGV(...) __ALOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ALOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define ALOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define ALOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGD
|
||||
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGD_IF
|
||||
#define ALOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGI
|
||||
#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGI_IF
|
||||
#define ALOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGW
|
||||
#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGW_IF
|
||||
#define ALOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGE
|
||||
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef ALOGE_IF
|
||||
#define ALOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* verbose priority.
|
||||
*/
|
||||
#ifndef IF_ALOGV
|
||||
#if LOG_NDEBUG
|
||||
#define IF_ALOGV() if (false)
|
||||
#else
|
||||
#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* debug priority.
|
||||
*/
|
||||
#ifndef IF_ALOGD
|
||||
#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* info priority.
|
||||
*/
|
||||
#ifndef IF_ALOGI
|
||||
#define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* warn priority.
|
||||
*/
|
||||
#ifndef IF_ALOGW
|
||||
#define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* error priority.
|
||||
*/
|
||||
#ifndef IF_ALOGE
|
||||
#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGV
|
||||
#define __SLOGV(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define SLOGV(...) do { if (0) { __SLOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define SLOGV(...) __SLOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SLOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define SLOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define SLOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGD
|
||||
#define SLOGD(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGD_IF
|
||||
#define SLOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGI
|
||||
#define SLOGI(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGI_IF
|
||||
#define SLOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGW
|
||||
#define SLOGW(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGW_IF
|
||||
#define SLOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error system log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef SLOGE
|
||||
#define SLOGE(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef SLOGE_IF
|
||||
#define SLOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
#endif /* !LINT_RLOG */
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Simplified macro to send a verbose radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGV
|
||||
#define __RLOGV(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#if LOG_NDEBUG
|
||||
#define RLOGV(...) do { if (0) { __RLOGV(__VA_ARGS__); } } while (0)
|
||||
#else
|
||||
#define RLOGV(...) __RLOGV(__VA_ARGS__)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RLOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define RLOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define RLOGV_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGD
|
||||
#define RLOGD(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGD_IF
|
||||
#define RLOGD_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGI
|
||||
#define RLOGI(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGI_IF
|
||||
#define RLOGI_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGW
|
||||
#define RLOGW(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGW_IF
|
||||
#define RLOGW_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error radio log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef RLOGE
|
||||
#define RLOGE(...) \
|
||||
((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#ifndef RLOGE_IF
|
||||
#define RLOGE_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)__android_log_buf_print(LOG_ID_RADIO, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Log a fatal error. If the given condition fails, this stops program
|
||||
* execution like a normal assertion, but also generating the given message.
|
||||
* It is NOT stripped from release builds. Note that the condition test
|
||||
* is -inverted- from the normal assert() semantics.
|
||||
*/
|
||||
#ifndef LOG_ALWAYS_FATAL_IF
|
||||
#define LOG_ALWAYS_FATAL_IF(cond, ...) \
|
||||
( (__predict_false(cond)) \
|
||||
? ((void)android_printAssert(#cond, LOG_TAG, ## __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
|
||||
#ifndef LOG_ALWAYS_FATAL
|
||||
#define LOG_ALWAYS_FATAL(...) \
|
||||
( ((void)android_printAssert(NULL, LOG_TAG, ## __VA_ARGS__)) )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that
|
||||
* are stripped out of release builds.
|
||||
*/
|
||||
#if LOG_NDEBUG
|
||||
|
||||
#ifndef LOG_FATAL_IF
|
||||
#define LOG_FATAL_IF(cond, ...) ((void)0)
|
||||
#endif
|
||||
#ifndef LOG_FATAL
|
||||
#define LOG_FATAL(...) ((void)0)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LOG_FATAL_IF
|
||||
#define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ## __VA_ARGS__)
|
||||
#endif
|
||||
#ifndef LOG_FATAL
|
||||
#define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assertion that generates a log message when the assertion fails.
|
||||
* Stripped out of release builds. Uses the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOG_ASSERT
|
||||
#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__)
|
||||
//#define ALOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Basic log message macro.
|
||||
*
|
||||
* Example:
|
||||
* ALOG(LOG_WARN, NULL, "Failed with error %d", errno);
|
||||
*
|
||||
* The second argument may be NULL or "" to indicate the "global" tag.
|
||||
*/
|
||||
#ifndef ALOG
|
||||
#define ALOG(priority, tag, ...) \
|
||||
LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log macro that allows you to specify a number for the priority.
|
||||
*/
|
||||
#ifndef LOG_PRI
|
||||
#define LOG_PRI(priority, tag, ...) \
|
||||
android_printLog(priority, tag, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log macro that allows you to pass in a varargs ("args" is a va_list).
|
||||
*/
|
||||
#ifndef LOG_PRI_VA
|
||||
#define LOG_PRI_VA(priority, tag, fmt, args) \
|
||||
android_vprintLog(priority, NULL, tag, fmt, args)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional given a desired logging priority and tag.
|
||||
*/
|
||||
#ifndef IF_ALOG
|
||||
#define IF_ALOG(priority, tag) \
|
||||
if (android_testLog(ANDROID_##priority, tag))
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Event logging.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Event log entry types.
|
||||
*/
|
||||
typedef enum {
|
||||
/* Special markers for android_log_list_element type */
|
||||
EVENT_TYPE_LIST_STOP = '\n', /* declare end of list */
|
||||
EVENT_TYPE_UNKNOWN = '?', /* protocol error */
|
||||
|
||||
/* must match with declaration in java/android/android/util/EventLog.java */
|
||||
EVENT_TYPE_INT = 0, /* uint32_t */
|
||||
EVENT_TYPE_LONG = 1, /* uint64_t */
|
||||
EVENT_TYPE_STRING = 2,
|
||||
EVENT_TYPE_LIST = 3,
|
||||
EVENT_TYPE_FLOAT = 4,
|
||||
} AndroidEventLogType;
|
||||
#define sizeof_AndroidEventLogType sizeof(typeof_AndroidEventLogType)
|
||||
#define typeof_AndroidEventLogType unsigned char
|
||||
|
||||
#ifndef LOG_EVENT_INT
|
||||
#define LOG_EVENT_INT(_tag, _value) { \
|
||||
int intBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_INT, &intBuf, \
|
||||
sizeof(intBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_LONG
|
||||
#define LOG_EVENT_LONG(_tag, _value) { \
|
||||
long long longBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_LONG, &longBuf, \
|
||||
sizeof(longBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_FLOAT
|
||||
#define LOG_EVENT_FLOAT(_tag, _value) { \
|
||||
float floatBuf = _value; \
|
||||
(void) android_btWriteLog(_tag, EVENT_TYPE_FLOAT, &floatBuf, \
|
||||
sizeof(floatBuf)); \
|
||||
}
|
||||
#endif
|
||||
#ifndef LOG_EVENT_STRING
|
||||
#define LOG_EVENT_STRING(_tag, _value) \
|
||||
(void) __android_log_bswrite(_tag, _value);
|
||||
#endif
|
||||
|
||||
typedef enum log_id {
|
||||
LOG_ID_MIN = 0,
|
||||
|
||||
#ifndef LINT_RLOG
|
||||
LOG_ID_MAIN = 0,
|
||||
#endif
|
||||
LOG_ID_RADIO = 1,
|
||||
#ifndef LINT_RLOG
|
||||
LOG_ID_EVENTS = 2,
|
||||
LOG_ID_SYSTEM = 3,
|
||||
LOG_ID_CRASH = 4,
|
||||
LOG_ID_SECURITY = 5,
|
||||
LOG_ID_KERNEL = 6, /* place last, third-parties can not use it */
|
||||
#endif
|
||||
|
||||
LOG_ID_MAX
|
||||
} log_id_t;
|
||||
#define sizeof_log_id_t sizeof(typeof_log_id_t)
|
||||
#define typeof_log_id_t unsigned char
|
||||
|
||||
/* For manipulating lists of events. */
|
||||
|
||||
#define ANDROID_MAX_LIST_NEST_DEPTH 8
|
||||
|
||||
/*
|
||||
* The opaque context used to manipulate lists of events.
|
||||
*/
|
||||
typedef struct android_log_context_internal *android_log_context;
|
||||
|
||||
/*
|
||||
* Elements returned when reading a list of events.
|
||||
*/
|
||||
typedef struct {
|
||||
AndroidEventLogType type;
|
||||
uint16_t complete;
|
||||
uint16_t len;
|
||||
union {
|
||||
int32_t int32;
|
||||
int64_t int64;
|
||||
char *string;
|
||||
float float32;
|
||||
} data;
|
||||
} android_log_list_element;
|
||||
|
||||
/*
|
||||
* Creates a context associated with an event tag to write elements to
|
||||
* the list of events.
|
||||
*/
|
||||
android_log_context create_android_logger(uint32_t tag);
|
||||
|
||||
/* All lists must be braced by a begin and end call */
|
||||
/*
|
||||
* NB: If the first level braces are missing when specifying multiple
|
||||
* elements, we will manufacturer a list to embrace it for your API
|
||||
* convenience. For a single element, it will remain solitary.
|
||||
*/
|
||||
int android_log_write_list_begin(android_log_context ctx);
|
||||
int android_log_write_list_end(android_log_context ctx);
|
||||
|
||||
int android_log_write_int32(android_log_context ctx, int32_t value);
|
||||
int android_log_write_int64(android_log_context ctx, int64_t value);
|
||||
int android_log_write_string8(android_log_context ctx, const char *value);
|
||||
int android_log_write_string8_len(android_log_context ctx,
|
||||
const char *value, size_t maxlen);
|
||||
int android_log_write_float32(android_log_context ctx, float value);
|
||||
|
||||
/* Submit the composed list context to the specified logger id */
|
||||
/* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */
|
||||
int android_log_write_list(android_log_context ctx, log_id_t id);
|
||||
|
||||
/*
|
||||
* Creates a context from a raw buffer representing a list of events to be read.
|
||||
*/
|
||||
android_log_context create_android_log_parser(const char *msg, size_t len);
|
||||
|
||||
android_log_list_element android_log_read_next(android_log_context ctx);
|
||||
android_log_list_element android_log_peek_next(android_log_context ctx);
|
||||
|
||||
/* Finished with reader or writer context */
|
||||
int android_log_destroy(android_log_context *ctx);
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
*
|
||||
* The stuff in the rest of this file should not be used directly.
|
||||
*/
|
||||
|
||||
#define android_printLog(prio, tag, ...) \
|
||||
__android_log_print(prio, tag, __VA_ARGS__)
|
||||
|
||||
#define android_vprintLog(prio, cond, tag, ...) \
|
||||
__android_log_vprint(prio, tag, __VA_ARGS__)
|
||||
|
||||
/* XXX Macros to work around syntax errors in places where format string
|
||||
* arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
||||
* (happens only in debug builds).
|
||||
*/
|
||||
|
||||
/* Returns 2nd arg. Used to substitute default value if caller's vararg list
|
||||
* is empty.
|
||||
*/
|
||||
#define __android_second(dummy, second, ...) second
|
||||
|
||||
/* If passed multiple args, returns ',' followed by all but 1st arg, otherwise
|
||||
* returns nothing.
|
||||
*/
|
||||
#define __android_rest(first, ...) , ## __VA_ARGS__
|
||||
|
||||
#define android_printAssert(cond, tag, ...) \
|
||||
__android_log_assert(cond, tag, \
|
||||
__android_second(0, ## __VA_ARGS__, NULL) __android_rest(__VA_ARGS__))
|
||||
|
||||
#define android_writeLog(prio, tag, text) \
|
||||
__android_log_write(prio, tag, text)
|
||||
|
||||
#define android_bWriteLog(tag, payload, len) \
|
||||
__android_log_bwrite(tag, payload, len)
|
||||
#define android_btWriteLog(tag, type, payload, len) \
|
||||
__android_log_btwrite(tag, type, payload, len)
|
||||
|
||||
#define android_errorWriteLog(tag, subTag) \
|
||||
__android_log_error_write(tag, subTag, -1, NULL, 0)
|
||||
|
||||
#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \
|
||||
__android_log_error_write(tag, subTag, uid, data, dataLen)
|
||||
|
||||
/*
|
||||
* IF_ALOG uses android_testLog, but IF_ALOG can be overridden.
|
||||
* android_testLog will remain constant in its purpose as a wrapper
|
||||
* for Android logging filter policy, and can be subject to
|
||||
* change. It can be reused by the developers that override
|
||||
* IF_ALOG as a convenient means to reimplement their policy
|
||||
* over Android.
|
||||
*/
|
||||
#if LOG_NDEBUG /* Production */
|
||||
#define android_testLog(prio, tag) \
|
||||
(__android_log_is_loggable(prio, tag, ANDROID_LOG_DEBUG) != 0)
|
||||
#else
|
||||
#define android_testLog(prio, tag) \
|
||||
(__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE) != 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use the per-tag properties "log.tag.<tagname>" to generate a runtime
|
||||
* result of non-zero to expose a log. prio is ANDROID_LOG_VERBOSE to
|
||||
* ANDROID_LOG_FATAL. default_prio if no property. Undefined behavior if
|
||||
* any other value.
|
||||
*/
|
||||
int __android_log_is_loggable(int prio, const char *tag, int default_prio);
|
||||
|
||||
int __android_log_security(); /* Device Owner is present */
|
||||
|
||||
int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data,
|
||||
uint32_t dataLen);
|
||||
|
||||
/*
|
||||
* Send a simple string to the log.
|
||||
*/
|
||||
int __android_log_buf_write(int bufID, int prio, const char *tag, const char *text);
|
||||
int __android_log_buf_print(int bufID, int prio, const char *tag, const char *fmt, ...)
|
||||
#if defined(__GNUC__)
|
||||
__attribute__((__format__(printf, 4, 5)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LIBS_LOG_LOG_H */
|
||||
#include <android/log.h>
|
||||
|
|
|
|||
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LIBS_LOG_LOG_READ_H
|
||||
#define _LIBS_LOG_LOG_READ_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
/* struct log_time is a wire-format variant of struct timespec */
|
||||
#define NS_PER_SEC 1000000000ULL
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// NB: do NOT define a copy constructor. This will result in structure
|
||||
// no longer being compatible with pass-by-value which is desired
|
||||
// efficient behavior. Also, pass-by-reference breaks C/C++ ABI.
|
||||
struct log_time {
|
||||
public:
|
||||
uint32_t tv_sec; // good to Feb 5 2106
|
||||
uint32_t tv_nsec;
|
||||
|
||||
static const uint32_t tv_sec_max = 0xFFFFFFFFUL;
|
||||
static const uint32_t tv_nsec_max = 999999999UL;
|
||||
|
||||
log_time(const timespec &T)
|
||||
{
|
||||
tv_sec = T.tv_sec;
|
||||
tv_nsec = T.tv_nsec;
|
||||
}
|
||||
log_time(uint32_t sec, uint32_t nsec)
|
||||
{
|
||||
tv_sec = sec;
|
||||
tv_nsec = nsec;
|
||||
}
|
||||
static const timespec EPOCH;
|
||||
log_time()
|
||||
{
|
||||
}
|
||||
log_time(clockid_t id)
|
||||
{
|
||||
timespec T;
|
||||
clock_gettime(id, &T);
|
||||
tv_sec = T.tv_sec;
|
||||
tv_nsec = T.tv_nsec;
|
||||
}
|
||||
log_time(const char *T)
|
||||
{
|
||||
const uint8_t *c = (const uint8_t *) T;
|
||||
tv_sec = c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24);
|
||||
tv_nsec = c[4] | (c[5] << 8) | (c[6] << 16) | (c[7] << 24);
|
||||
}
|
||||
|
||||
// timespec
|
||||
bool operator== (const timespec &T) const
|
||||
{
|
||||
return (tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec == static_cast<uint32_t>(T.tv_nsec));
|
||||
}
|
||||
bool operator!= (const timespec &T) const
|
||||
{
|
||||
return !(*this == T);
|
||||
}
|
||||
bool operator< (const timespec &T) const
|
||||
{
|
||||
return (tv_sec < static_cast<uint32_t>(T.tv_sec))
|
||||
|| ((tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec < static_cast<uint32_t>(T.tv_nsec)));
|
||||
}
|
||||
bool operator>= (const timespec &T) const
|
||||
{
|
||||
return !(*this < T);
|
||||
}
|
||||
bool operator> (const timespec &T) const
|
||||
{
|
||||
return (tv_sec > static_cast<uint32_t>(T.tv_sec))
|
||||
|| ((tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec > static_cast<uint32_t>(T.tv_nsec)));
|
||||
}
|
||||
bool operator<= (const timespec &T) const
|
||||
{
|
||||
return !(*this > T);
|
||||
}
|
||||
log_time operator-= (const timespec &T);
|
||||
log_time operator- (const timespec &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local -= T;
|
||||
}
|
||||
log_time operator+= (const timespec &T);
|
||||
log_time operator+ (const timespec &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local += T;
|
||||
}
|
||||
|
||||
// log_time
|
||||
bool operator== (const log_time &T) const
|
||||
{
|
||||
return (tv_sec == T.tv_sec) && (tv_nsec == T.tv_nsec);
|
||||
}
|
||||
bool operator!= (const log_time &T) const
|
||||
{
|
||||
return !(*this == T);
|
||||
}
|
||||
bool operator< (const log_time &T) const
|
||||
{
|
||||
return (tv_sec < T.tv_sec)
|
||||
|| ((tv_sec == T.tv_sec) && (tv_nsec < T.tv_nsec));
|
||||
}
|
||||
bool operator>= (const log_time &T) const
|
||||
{
|
||||
return !(*this < T);
|
||||
}
|
||||
bool operator> (const log_time &T) const
|
||||
{
|
||||
return (tv_sec > T.tv_sec)
|
||||
|| ((tv_sec == T.tv_sec) && (tv_nsec > T.tv_nsec));
|
||||
}
|
||||
bool operator<= (const log_time &T) const
|
||||
{
|
||||
return !(*this > T);
|
||||
}
|
||||
log_time operator-= (const log_time &T);
|
||||
log_time operator- (const log_time &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local -= T;
|
||||
}
|
||||
log_time operator+= (const log_time &T);
|
||||
log_time operator+ (const log_time &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local += T;
|
||||
}
|
||||
|
||||
uint64_t nsec() const
|
||||
{
|
||||
return static_cast<uint64_t>(tv_sec) * NS_PER_SEC + tv_nsec;
|
||||
}
|
||||
|
||||
static const char default_format[];
|
||||
|
||||
// Add %#q for the fraction of a second to the standard library functions
|
||||
char *strptime(const char *s, const char *format = default_format);
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#else
|
||||
|
||||
typedef struct log_time {
|
||||
uint32_t tv_sec;
|
||||
uint32_t tv_nsec;
|
||||
} __attribute__((__packed__)) log_time;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* define _LIBS_LOG_LOG_READ_H */
|
||||
|
|
@ -1,54 +1 @@
|
|||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_CUTILS_LOGD_H
|
||||
#define _ANDROID_CUTILS_LOGD_H
|
||||
|
||||
/* the stable/frozen log-related definitions have been
|
||||
* moved to this header, which is exposed by the NDK
|
||||
*/
|
||||
#include <android/log.h>
|
||||
|
||||
/* the rest is only used internally by the system */
|
||||
#if !defined(_WIN32)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int __android_log_bwrite(int32_t tag, const void *payload, size_t len);
|
||||
int __android_log_btwrite(int32_t tag, char type, const void *payload,
|
||||
size_t len);
|
||||
int __android_log_bswrite(int32_t tag, const char *payload);
|
||||
|
||||
int __android_log_security_bwrite(int32_t tag, const void *payload, size_t len);
|
||||
int __android_log_security_bswrite(int32_t tag, const char *payload);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LOGD_H */
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@
|
|||
#define _LIBS_LOG_LOGGER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __linux__
|
||||
#include <time.h> /* clockid_t definition */
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#include <log/log.h>
|
||||
#include <log/log_read.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -76,21 +77,168 @@ struct logger_entry_v4 {
|
|||
char msg[0]; /* the entry's payload */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
/* struct log_time is a wire-format variant of struct timespec */
|
||||
#define NS_PER_SEC 1000000000ULL
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// NB: do NOT define a copy constructor. This will result in structure
|
||||
// no longer being compatible with pass-by-value which is desired
|
||||
// efficient behavior. Also, pass-by-reference breaks C/C++ ABI.
|
||||
struct log_time {
|
||||
public:
|
||||
uint32_t tv_sec; // good to Feb 5 2106
|
||||
uint32_t tv_nsec;
|
||||
|
||||
static const uint32_t tv_sec_max = 0xFFFFFFFFUL;
|
||||
static const uint32_t tv_nsec_max = 999999999UL;
|
||||
|
||||
log_time(const timespec &T)
|
||||
{
|
||||
tv_sec = T.tv_sec;
|
||||
tv_nsec = T.tv_nsec;
|
||||
}
|
||||
log_time(uint32_t sec, uint32_t nsec)
|
||||
{
|
||||
tv_sec = sec;
|
||||
tv_nsec = nsec;
|
||||
}
|
||||
static const timespec EPOCH;
|
||||
log_time()
|
||||
{
|
||||
}
|
||||
#ifdef __linux__
|
||||
log_time(clockid_t id)
|
||||
{
|
||||
timespec T;
|
||||
clock_gettime(id, &T);
|
||||
tv_sec = T.tv_sec;
|
||||
tv_nsec = T.tv_nsec;
|
||||
}
|
||||
#endif
|
||||
log_time(const char *T)
|
||||
{
|
||||
const uint8_t *c = (const uint8_t *) T;
|
||||
tv_sec = c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24);
|
||||
tv_nsec = c[4] | (c[5] << 8) | (c[6] << 16) | (c[7] << 24);
|
||||
}
|
||||
|
||||
// timespec
|
||||
bool operator== (const timespec &T) const
|
||||
{
|
||||
return (tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec == static_cast<uint32_t>(T.tv_nsec));
|
||||
}
|
||||
bool operator!= (const timespec &T) const
|
||||
{
|
||||
return !(*this == T);
|
||||
}
|
||||
bool operator< (const timespec &T) const
|
||||
{
|
||||
return (tv_sec < static_cast<uint32_t>(T.tv_sec))
|
||||
|| ((tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec < static_cast<uint32_t>(T.tv_nsec)));
|
||||
}
|
||||
bool operator>= (const timespec &T) const
|
||||
{
|
||||
return !(*this < T);
|
||||
}
|
||||
bool operator> (const timespec &T) const
|
||||
{
|
||||
return (tv_sec > static_cast<uint32_t>(T.tv_sec))
|
||||
|| ((tv_sec == static_cast<uint32_t>(T.tv_sec))
|
||||
&& (tv_nsec > static_cast<uint32_t>(T.tv_nsec)));
|
||||
}
|
||||
bool operator<= (const timespec &T) const
|
||||
{
|
||||
return !(*this > T);
|
||||
}
|
||||
log_time operator-= (const timespec &T);
|
||||
log_time operator- (const timespec &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local -= T;
|
||||
}
|
||||
log_time operator+= (const timespec &T);
|
||||
log_time operator+ (const timespec &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local += T;
|
||||
}
|
||||
|
||||
// log_time
|
||||
bool operator== (const log_time &T) const
|
||||
{
|
||||
return (tv_sec == T.tv_sec) && (tv_nsec == T.tv_nsec);
|
||||
}
|
||||
bool operator!= (const log_time &T) const
|
||||
{
|
||||
return !(*this == T);
|
||||
}
|
||||
bool operator< (const log_time &T) const
|
||||
{
|
||||
return (tv_sec < T.tv_sec)
|
||||
|| ((tv_sec == T.tv_sec) && (tv_nsec < T.tv_nsec));
|
||||
}
|
||||
bool operator>= (const log_time &T) const
|
||||
{
|
||||
return !(*this < T);
|
||||
}
|
||||
bool operator> (const log_time &T) const
|
||||
{
|
||||
return (tv_sec > T.tv_sec)
|
||||
|| ((tv_sec == T.tv_sec) && (tv_nsec > T.tv_nsec));
|
||||
}
|
||||
bool operator<= (const log_time &T) const
|
||||
{
|
||||
return !(*this > T);
|
||||
}
|
||||
log_time operator-= (const log_time &T);
|
||||
log_time operator- (const log_time &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local -= T;
|
||||
}
|
||||
log_time operator+= (const log_time &T);
|
||||
log_time operator+ (const log_time &T) const
|
||||
{
|
||||
log_time local(*this);
|
||||
return local += T;
|
||||
}
|
||||
|
||||
uint64_t nsec() const
|
||||
{
|
||||
return static_cast<uint64_t>(tv_sec) * NS_PER_SEC + tv_nsec;
|
||||
}
|
||||
|
||||
static const char default_format[];
|
||||
|
||||
// Add %#q for the fraction of a second to the standard library functions
|
||||
char *strptime(const char *s, const char *format = default_format);
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#else
|
||||
|
||||
typedef struct log_time {
|
||||
uint32_t tv_sec;
|
||||
uint32_t tv_nsec;
|
||||
} __attribute__((__packed__)) log_time;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The maximum size of the log entry payload that can be
|
||||
* written to the logger. An attempt to write more than
|
||||
* this amount will result in a truncated log entry.
|
||||
*/
|
||||
#define LOGGER_ENTRY_MAX_PAYLOAD 4068
|
||||
#define LOGGER_ENTRY_MAX_PAYLOAD 4068
|
||||
|
||||
/*
|
||||
* The maximum size of a log entry which can be read from the
|
||||
* kernel logger driver. An attempt to read less than this amount
|
||||
* may result in read() returning EINVAL.
|
||||
*/
|
||||
#define LOGGER_ENTRY_MAX_LEN (5*1024)
|
||||
|
||||
#define NS_PER_SEC 1000000000ULL
|
||||
#define LOGGER_ENTRY_MAX_LEN (5*1024)
|
||||
|
||||
struct log_msg {
|
||||
union {
|
||||
|
|
@ -219,6 +367,94 @@ clockid_t android_log_clockid();
|
|||
log_id_t android_name_to_log_id(const char *logName);
|
||||
const char *android_log_id_to_name(log_id_t log_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
// android_log_context C++ helpers
|
||||
class android_log_event_context {
|
||||
android_log_context ctx;
|
||||
int ret;
|
||||
|
||||
public:
|
||||
explicit android_log_event_context(int tag) : ret(0) {
|
||||
ctx = create_android_logger(tag);
|
||||
}
|
||||
explicit android_log_event_context(log_msg& log_msg) : ret(0) {
|
||||
ctx = create_android_log_parser(log_msg.msg() + sizeof(uint32_t),
|
||||
log_msg.entry.len - sizeof(uint32_t));
|
||||
}
|
||||
~android_log_event_context() { android_log_destroy(&ctx); }
|
||||
|
||||
int close() {
|
||||
int retval = android_log_destroy(&ctx);
|
||||
if (retval < 0) ret = retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// To allow above C calls to use this class as parameter
|
||||
operator android_log_context() const { return ctx; };
|
||||
|
||||
int error() const { return ret; }
|
||||
|
||||
int begin() {
|
||||
int retval = android_log_write_list_begin(ctx);
|
||||
if (retval < 0) ret = retval;
|
||||
return ret;
|
||||
}
|
||||
int end() {
|
||||
int retval = android_log_write_list_end(ctx);
|
||||
if (retval < 0) ret = retval;
|
||||
return ret;
|
||||
}
|
||||
|
||||
android_log_event_context& operator <<(int32_t value) {
|
||||
int retval = android_log_write_int32(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(uint32_t value) {
|
||||
int retval = android_log_write_int32(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(int64_t value) {
|
||||
int retval = android_log_write_int64(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(uint64_t value) {
|
||||
int retval = android_log_write_int64(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(const char* value) {
|
||||
int retval = android_log_write_string8(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(std::string& value) {
|
||||
int retval = android_log_write_string8_len(ctx,
|
||||
value.data(),
|
||||
value.length());
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
android_log_event_context& operator <<(float value) {
|
||||
int retval = android_log_write_float32(ctx, value);
|
||||
if (retval < 0) ret = retval;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int write(log_id_t id) {
|
||||
int retval = android_log_write_list(ctx, id);
|
||||
if (retval < 0) ret = retval;
|
||||
return ret;
|
||||
}
|
||||
|
||||
android_log_list_element read() { return android_log_read_next(ctx); }
|
||||
android_log_list_element peak() { return android_log_peek_next(ctx); }
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,11 +17,12 @@
|
|||
#ifndef _LOGPRINT_H
|
||||
#define _LOGPRINT_H
|
||||
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/event_tag_map.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <log/event_tag_map.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,11 +24,15 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <log/log_read.h>
|
||||
#include <android/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#define LOGGER_MAGIC 'l'
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Header Structure to pstore */
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
uint8_t magic;
|
||||
|
|
@ -84,6 +88,7 @@ typedef struct __attribute__((__packed__)) {
|
|||
* in C++.
|
||||
* http://stackoverflow.com/questions/4412749/are-flexible-array-members-valid-in-c
|
||||
*/
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
int8_t type; // EVENT_TYPE_STRING;
|
||||
int32_t length; // Little Endian Order
|
||||
|
|
@ -98,10 +103,6 @@ typedef struct __attribute__((__packed__)) {
|
|||
char data[];
|
||||
} android_log_event_string_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ANDROID_LOG_PMSG_FILE_MAX_SEQUENCE 256 /* 1MB file */
|
||||
#define ANDROID_LOG_PMSG_FILE_SEQUENCE 1000
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/SortedVector.h>
|
||||
#include <utils/TypeHelpers.h>
|
||||
#include <utils/Errors.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@
|
|||
#ifndef _LIBS_UTILS_LOG_H
|
||||
#define _LIBS_UTILS_LOG_H
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace android {
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <utils/TypeHelpers.h>
|
||||
#include <utils/Vector.h>
|
||||
#include <utils/VectorImpl.h>
|
||||
#include <utils/TypeHelpers.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
#ifndef ANDROID_VECTOR_H
|
||||
#define ANDROID_VECTOR_H
|
||||
|
||||
#include <new>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <new>
|
||||
|
||||
#include <utils/VectorImpl.h>
|
||||
#include <android/log.h>
|
||||
#include <utils/TypeHelpers.h>
|
||||
#include <utils/VectorImpl.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#define LOG_TAG "libbacktrace"
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
// Macro to log the function name along with the warning message.
|
||||
#define BACK_LOGW(format, ...) \
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <backtrace/backtrace_constants.h>
|
||||
#include <backtrace/BacktraceMap.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "thread_utils.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/ashmem.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
|
@ -30,10 +31,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linux/ashmem.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/ashmem.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#define ASHMEM_DEVICE "/dev/ashmem"
|
||||
|
||||
|
|
|
|||
|
|
@ -14,21 +14,21 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#define LOG_TAG "DEBUG"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/debugger.h>
|
||||
#include <cutils/sockets.h>
|
||||
|
||||
#define LOG_TAG "DEBUG"
|
||||
#include <log/log.h>
|
||||
|
||||
static int send_request(int sock_fd, void* msg_ptr, size_t msg_len) {
|
||||
int result = 0;
|
||||
if (TEMP_FAILURE_RETRY(write(sock_fd, msg_ptr, msg_len)) != (ssize_t) msg_len) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "log/log.h"
|
||||
#include "android/log.h"
|
||||
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
|
||||
|
|
|
|||
|
|
@ -21,18 +21,18 @@
|
|||
#define _ATFILE_SOURCE 1
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include <cutils/fs.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/fs.h>
|
||||
|
||||
#define ALL_PERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
#define BUF_SIZE 64
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <utils/Compat.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
#define LOG_TAG "NativeHandle"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
static const int kMaxNativeFds = 1024;
|
||||
|
|
|
|||
|
|
@ -17,18 +17,18 @@
|
|||
#define LOG_TAG "properties"
|
||||
// #define LOG_NDEBUG 0
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <log/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
|
||||
int8_t property_get_bool(const char *key, int8_t default_value) {
|
||||
if (!key) {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/qtaguid.h>
|
||||
#include <log/log.h>
|
||||
|
||||
static const char* CTRL_PROCPATH = "/proc/net/xt_qtaguid/ctrl";
|
||||
static const int CTRL_MAX_INPUT_LEN = 128;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/sched_policy.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#define UNUSED __attribute__((__unused__))
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cutils/sockets.h>
|
||||
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
/* For the socket trust (credentials) check */
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/hashmap.h>
|
||||
#include <cutils/memory.h>
|
||||
#include <cutils/str_parms.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,17 @@
|
|||
*/
|
||||
|
||||
#define LOG_TAG "Properties_test"
|
||||
#include <cutils/log.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <limits.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/macros.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "cutils-trace"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
|
@ -23,13 +25,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/compiler.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <cutils/trace.h>
|
||||
|
||||
#define LOG_TAG "cutils-trace"
|
||||
#include <log/log.h>
|
||||
|
||||
/**
|
||||
* Maximum size of a message that can be logged to the trace buffer.
|
||||
* Note this message includes a tag, the pid, and the string given as the name.
|
||||
|
|
|
|||
|
|
@ -16,16 +16,15 @@
|
|||
*/
|
||||
|
||||
#define LOG_TAG "config_mbr"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <diskconfig/diskconfig.h>
|
||||
|
||||
|
||||
/* start and len are in LBA units */
|
||||
static void
|
||||
cfg_pentry(struct pc_partition *pentry, uint8_t status, uint8_t type,
|
||||
|
|
|
|||
|
|
@ -20,21 +20,19 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <linux/fs.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linux/fs.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/config_utils.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include <diskconfig/diskconfig.h>
|
||||
|
||||
|
||||
static int
|
||||
parse_len(const char *str, uint64_t *plen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include <diskconfig/diskconfig.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
*/
|
||||
|
||||
#define LOG_TAG "dump_diskconfig"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "diskconfig.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@
|
|||
*/
|
||||
|
||||
#define LOG_TAG "write_lst"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <diskconfig/diskconfig.h>
|
||||
|
||||
struct write_list *
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@
|
|||
*/
|
||||
#define LOG_TAG "ion"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/ion.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/ion.h>
|
||||
#include <android/log.h>
|
||||
#include <ion/ion.h>
|
||||
|
||||
int ion_open()
|
||||
|
|
|
|||
|
|
@ -84,12 +84,11 @@ cc_library {
|
|||
// 's/^\([0-9]*\)[ \t]*liblog[ \t].*/-DLIBLOG_LOG_TAG=\1/p' \
|
||||
// $(LOCAL_PATH)/event.logtags)
|
||||
// so make sure we do not regret hard-coding it as follows:
|
||||
"-DLIBLOG_LOG_TAG=1005",
|
||||
"-DLIBLOG_LOG_TAG=1006",
|
||||
"-DSNET_EVENT_LOG_TAG=1397638484",
|
||||
],
|
||||
logtags: ["event.logtags"],
|
||||
compile_multilib: "both",
|
||||
stl: "none",
|
||||
}
|
||||
|
||||
ndk_library {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ NAME
|
|||
liblog - Android NDK logger interfaces
|
||||
|
||||
SYNOPSIS
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
ALOG(android_priority, tag, format, ...)
|
||||
IF_ALOG(android_priority, tag)
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@
|
|||
#
|
||||
# TODO: generate ".java" and ".h" files with integer constants from this file.
|
||||
|
||||
1005 liblog (dropped|1)
|
||||
1006 liblog (dropped|1)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <log/event_tag_map.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/logd.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "fake_log_device.h"
|
||||
#include "log_portability.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "config_write.h"
|
||||
#include "fake_log_device.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/log_read.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <log/logd.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/log_read.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <log/logd.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/log_read.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <log/uio.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/list.h>
|
||||
#include <log/log.h>
|
||||
#include <log/log_read.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/list.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,9 @@
|
|||
#include <android/set_abort_message.h>
|
||||
#endif
|
||||
|
||||
#include <android/log.h>
|
||||
#include <log/event_tag_map.h>
|
||||
#include <log/logd.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/log_read.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/list.h>
|
||||
#include <log/logd.h>
|
||||
#include <log/logprint.h>
|
||||
|
||||
#include "log_portability.h"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <log/logger.h>
|
||||
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/log_read.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include "benchmark.h"
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <log/log.h>
|
||||
#include <log/logger.h>
|
||||
#include <log/log_read.h>
|
||||
#include <log/logprint.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
|
|
|||
|
|
@ -14,16 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memtrack/memtrack.h>
|
||||
|
||||
#define LOG_TAG "memtrack"
|
||||
|
||||
#include <log/log.h>
|
||||
#include <memtrack/memtrack.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <hardware/memtrack.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@
|
|||
|
||||
#define LOG_TAG "libmemunreachable"
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#endif // LIBMEMUNREACHABLE_LOG_H_
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include "nativebridge/native_bridge.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <cutils/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -25,6 +23,9 @@
|
|||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
#include "NativeBridgeTest.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cutils/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -26,6 +23,11 @@
|
|||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
TEST_F(NativeBridgeTest, PreInitializeNativeBridgeFail1) {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NativeBridgeTest.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cutils/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -26,6 +21,13 @@
|
|||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "NativeBridgeTest.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
TEST_F(NativeBridgeTest, PreInitializeNativeBridgeFail2) {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NativeBridgeTest.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <cutils/log.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -26,6 +21,13 @@
|
|||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "NativeBridgeTest.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
static constexpr const char* kTestData = "PreInitializeNativeBridge test.";
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
#include <dlfcn.h>
|
||||
#ifdef __ANDROID__
|
||||
#include "dlext_namespaces.h"
|
||||
#include "cutils/properties.h"
|
||||
#define LOG_TAG "libnativeloader"
|
||||
#include "log/log.h"
|
||||
#include "android/log.h"
|
||||
#include "cutils/properties.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -30,9 +30,9 @@
|
|||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
#include "android-base/file.h"
|
||||
#include "android-base/macros.h"
|
||||
#include "android-base/strings.h"
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/macros.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
|||
|
|
@ -14,27 +14,25 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#define LOG_TAG "DHCP"
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include <netutils/ifc.h>
|
||||
#include "dhcpmsg.h"
|
||||
|
|
|
|||
|
|
@ -1,34 +1,21 @@
|
|||
/*
|
||||
* Copyright 2008, The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
|
@ -37,20 +24,29 @@
|
|||
#include <linux/ipv6_route.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/sockios.h>
|
||||
|
||||
#include "netutils/ifc.h"
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#define LOG_TAG "NetUtils"
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define ALOGD printf
|
||||
#define ALOGW printf
|
||||
#endif
|
||||
|
||||
#include "netutils/ifc.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
/* SIOCKILLADDR is an Android extension. */
|
||||
#define SIOCKILLADDR 0x8939
|
||||
|
|
|
|||
|
|
@ -1,37 +1,36 @@
|
|||
/*
|
||||
* Copyright 2008, The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
#define LOG_TAG "DHCP"
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define ALOGD printf
|
||||
#define ALOGW printf
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,17 +18,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define LOG_TAG "packagelistparser"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/limits.h>
|
||||
|
||||
#define LOG_TAG "packagelistparser"
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <packagelistparser/packagelistparser.h>
|
||||
|
||||
#define CLOGE(fmt, ...) \
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
|
@ -19,9 +19,9 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <private/pixelflinger/ggl_context.h>
|
||||
|
||||
#include "ARMAssembler.h"
|
||||
|
|
|
|||
|
|
@ -2,26 +2,26 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "ARMAssemblerInterface.h"
|
||||
|
||||
namespace android {
|
||||
|
|
|
|||
|
|
@ -32,14 +32,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <private/pixelflinger/ggl_context.h>
|
||||
|
||||
#include "codeflinger/Arm64Assembler.h"
|
||||
#include "codeflinger/CodeCache.h"
|
||||
#include "codeflinger/Arm64Disassembler.h"
|
||||
|
||||
#include "codeflinger/CodeCache.h"
|
||||
|
||||
/*
|
||||
** --------------------------------------------
|
||||
|
|
|
|||
|
|
@ -15,17 +15,16 @@
|
|||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "CodeCache"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/ashmem.h>
|
||||
#define LOG_TAG "CodeCache"
|
||||
#include <cutils/log.h>
|
||||
|
||||
|
||||
#include "CodeCache.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
|
@ -19,10 +19,11 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "GGLAssembler.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -25,24 +25,21 @@
|
|||
**
|
||||
*/
|
||||
|
||||
|
||||
#define LOG_TAG "MIPS64Assembler"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <private/pixelflinger/ggl_context.h>
|
||||
|
||||
#include "MIPS64Assembler.h"
|
||||
#include "CodeCache.h"
|
||||
#include "mips64_disassem.h"
|
||||
|
||||
|
||||
#define NOT_IMPLEMENTED() LOG_ALWAYS_FATAL("Arm instruction %s not yet implemented\n", __func__)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
namespace android {
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <private/pixelflinger/ggl_context.h>
|
||||
|
||||
#include "MIPSAssembler.h"
|
||||
#include "CodeCache.h"
|
||||
#include "MIPSAssembler.h"
|
||||
#include "mips_disassem.h"
|
||||
|
||||
// Choose MIPS arch variant following gcc flags
|
||||
|
|
|
|||
|
|
@ -2,30 +2,29 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "GGLAssembler.h"
|
||||
|
||||
|
||||
namespace android {
|
||||
|
||||
void GGLAssembler::build_fog(
|
||||
|
|
|
|||
|
|
@ -2,22 +2,24 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "GGLAssembler.h"
|
||||
|
||||
namespace android {
|
||||
|
|
@ -25,7 +27,7 @@ namespace android {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
void GGLAssembler::store(const pointer_t& addr, const pixel_t& s, uint32_t flags)
|
||||
{
|
||||
{
|
||||
const int bits = addr.size;
|
||||
const int inc = (flags & WRITE_BACK)?1:0;
|
||||
switch (bits) {
|
||||
|
|
@ -59,8 +61,8 @@ void GGLAssembler::store(const pointer_t& addr, const pixel_t& s, uint32_t flags
|
|||
}
|
||||
|
||||
void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags)
|
||||
{
|
||||
Scratch scratches(registerFile());
|
||||
{
|
||||
Scratch scratches(registerFile());
|
||||
int s0;
|
||||
|
||||
const int bits = addr.size;
|
||||
|
|
@ -72,7 +74,7 @@ void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags)
|
|||
break;
|
||||
case 24:
|
||||
// 24 bits formats are a little special and used only for RGB
|
||||
// R,G,B is packed as 0x00BBGGRR
|
||||
// R,G,B is packed as 0x00BBGGRR
|
||||
s0 = scratches.obtain();
|
||||
if (s.reg != addr.reg) {
|
||||
LDRB(AL, s.reg, addr.reg, immed12_pre(0)); // R
|
||||
|
|
@ -90,7 +92,7 @@ void GGLAssembler::load(const pointer_t& addr, const pixel_t& s, uint32_t flags)
|
|||
}
|
||||
if (inc)
|
||||
ADD(AL, 0, addr.reg, addr.reg, imm(3));
|
||||
break;
|
||||
break;
|
||||
case 16:
|
||||
if (inc) LDRH(AL, s.reg, addr.reg, immed8_post(2));
|
||||
else LDRH(AL, s.reg, addr.reg);
|
||||
|
|
@ -112,7 +114,7 @@ void GGLAssembler::extract(integer_t& d, int s, int h, int l, int bits)
|
|||
assert(maskLen<=8);
|
||||
#endif
|
||||
assert(h);
|
||||
|
||||
|
||||
if (h != bits) {
|
||||
const int mask = ((1<<maskLen)-1) << l;
|
||||
if (isValidImmediate(mask)) {
|
||||
|
|
@ -126,12 +128,12 @@ void GGLAssembler::extract(integer_t& d, int s, int h, int l, int bits)
|
|||
}
|
||||
s = d.reg;
|
||||
}
|
||||
|
||||
|
||||
if (l) {
|
||||
MOV(AL, 0, d.reg, reg_imm(s, LSR, l)); // component = packed >> l;
|
||||
s = d.reg;
|
||||
}
|
||||
|
||||
|
||||
if (s != d.reg) {
|
||||
MOV(AL, 0, d.reg, s);
|
||||
}
|
||||
|
|
@ -212,12 +214,12 @@ void GGLAssembler::expand(integer_t& dst, const integer_t& src, int dbits)
|
|||
} while(dbits>0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dbits -= sbits;
|
||||
do {
|
||||
ORR(AL, 0, d, s, reg_imm(s, LSL, sbits));
|
||||
// d |= d<<sbits;
|
||||
s = d;
|
||||
s = d;
|
||||
dbits -= sbits;
|
||||
if (sbits*2 < dbits) {
|
||||
sbits *= 2;
|
||||
|
|
@ -241,14 +243,14 @@ void GGLAssembler::downshift(
|
|||
int dl = d.format.c[component].l;
|
||||
int dbits = dh - dl;
|
||||
int dithering = 0;
|
||||
|
||||
|
||||
ALOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits);
|
||||
|
||||
if (sbits>dbits) {
|
||||
// see if we need to dither
|
||||
dithering = mDithering;
|
||||
}
|
||||
|
||||
|
||||
int ireg = d.reg;
|
||||
if (!(d.flags & FIRST)) {
|
||||
if (s.flags & CORRUPTIBLE) {
|
||||
|
|
@ -271,7 +273,7 @@ void GGLAssembler::downshift(
|
|||
if (isValidImmediate(mask) || isValidImmediate(~mask)) {
|
||||
build_and_immediate(ireg, s.reg, mask, 32);
|
||||
sl = offset;
|
||||
s.reg = ireg;
|
||||
s.reg = ireg;
|
||||
sbits = dbits;
|
||||
maskLoBits = maskHiBits = 0;
|
||||
}
|
||||
|
|
@ -281,7 +283,7 @@ void GGLAssembler::downshift(
|
|||
const uint32_t mask = ((1<<sbits)-1) << sl;
|
||||
if (isValidImmediate(mask) || isValidImmediate(~mask)) {
|
||||
build_and_immediate(ireg, s.reg, mask, 32);
|
||||
s.reg = ireg;
|
||||
s.reg = ireg;
|
||||
maskLoBits = maskHiBits = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +327,7 @@ void GGLAssembler::downshift(
|
|||
MOV(AL, 0, ireg, reg_imm(s.reg, LSR, sl));
|
||||
sh -= sl;
|
||||
sl = 0;
|
||||
s.reg = ireg;
|
||||
s.reg = ireg;
|
||||
}
|
||||
// scaling (V-V>>dbits)
|
||||
SUB(AL, 0, ireg, s.reg, reg_imm(s.reg, LSR, dbits));
|
||||
|
|
@ -333,7 +335,7 @@ void GGLAssembler::downshift(
|
|||
if (shift>0) ADD(AL, 0, ireg, ireg, reg_imm(dither.reg, LSR, shift));
|
||||
else if (shift<0) ADD(AL, 0, ireg, ireg, reg_imm(dither.reg, LSL,-shift));
|
||||
else ADD(AL, 0, ireg, ireg, dither.reg);
|
||||
s.reg = ireg;
|
||||
s.reg = ireg;
|
||||
}
|
||||
|
||||
if ((maskLoBits|dithering) && (sh > dbits)) {
|
||||
|
|
|
|||
|
|
@ -34,21 +34,20 @@
|
|||
* from: @(#)kadb.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "mips_opcode.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "mips_opcode.h"
|
||||
|
||||
static char *sprintf_buffer;
|
||||
static int sprintf_buf_len;
|
||||
|
||||
|
||||
typedef uint64_t db_addr_t;
|
||||
static void db_printf(const char* fmt, ...);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,26 +2,26 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "GGLAssembler.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,29 +2,28 @@
|
|||
**
|
||||
** Copyright 2006-2011, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#define LOG_TAG "pixelflinger"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/memory.h>
|
||||
#include <cutils/log.h>
|
||||
|
||||
#include "buffer.h"
|
||||
#include "scanline.h"
|
||||
|
|
|
|||
|
|
@ -26,21 +26,21 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <cutils/ashmem.h>
|
||||
#include <cutils/log.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <android/log.h>
|
||||
#include <cutils/ashmem.h>
|
||||
|
||||
#include "codeflinger/ARMAssemblerInterface.h"
|
||||
#include "codeflinger/MIPS64Assembler.h"
|
||||
|
||||
using namespace android;
|
||||
|
||||
#define TESTS_DATAOP_ENABLE 1
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
|
||||
|
|
@ -19,12 +19,12 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/memory.h>
|
||||
|
||||
#include "trap.h"
|
||||
#include "picker.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <cutils/memory.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue