diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2016-10-17 14:28:00 -0700 |
|---|---|---|
| committer | Mark Salyzyn <salyzyn@google.com> | 2016-10-20 08:11:39 -0700 |
| commit | cfd5b080af8de527d768f0ff7902c26af8d49307 (patch) | |
| tree | 32295b3aeb6ba8a116592576939348d09814b0be | |
| parent | 1edd61ce5d2f34ff34d015643b5915b3b1c186e8 (diff) | |
| download | system_core-cfd5b080af8de527d768f0ff7902c26af8d49307.tar.gz system_core-cfd5b080af8de527d768f0ff7902c26af8d49307.tar.bz2 system_core-cfd5b080af8de527d768f0ff7902c26af8d49307.zip | |
system/core: preparation to pull back interfaces from android/log.h
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.
Correct liblog/README
Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.
Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
62 files changed, 144 insertions, 80 deletions
diff --git a/base/logging.cpp b/base/logging.cpp index dab86fe89..cbc3c8ac1 100644 --- a/base/logging.cpp +++ b/base/logging.cpp @@ -45,7 +45,7 @@ // Headers for LogMessage::LogLine. #ifdef __ANDROID__ -#include <android/log.h> +#include <log/log.h> #include <android/set_abort_message.h> #else #include <sys/types.h> diff --git a/bootstat/event_log_list_builder.cpp b/bootstat/event_log_list_builder.cpp index a6af13e0f..ce540a03b 100644 --- a/bootstat/event_log_list_builder.cpp +++ b/bootstat/event_log_list_builder.cpp @@ -20,7 +20,7 @@ #include <memory> #include <string> -#include <android/log.h> +#include <log/log.h> #include <android-base/logging.h> namespace { diff --git a/bootstat/event_log_list_builder_test.cpp b/bootstat/event_log_list_builder_test.cpp index 8f7f323f8..25909b08f 100644 --- a/bootstat/event_log_list_builder_test.cpp +++ b/bootstat/event_log_list_builder_test.cpp @@ -18,9 +18,9 @@ #include <inttypes.h> -#include <android/log.h> #include <gmock/gmock.h> #include <gtest/gtest.h> +#include <log/log.h> using testing::ElementsAreArray; diff --git a/bootstat/histogram_logger.cpp b/bootstat/histogram_logger.cpp index 3144d8b5e..4f2386c05 100644 --- a/bootstat/histogram_logger.cpp +++ b/bootstat/histogram_logger.cpp @@ -19,8 +19,8 @@ #include <cstdlib> #include <memory> -#include <android/log.h> #include <android-base/logging.h> +#include <log/log.h> #include "event_log_list_builder.h" diff --git a/debuggerd/crasher.cpp b/debuggerd/crasher.cpp index cfcc26ef5..3db67b30d 100644 --- a/debuggerd/crasher.cpp +++ b/debuggerd/crasher.cpp @@ -1,3 +1,21 @@ +/* + * 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 + * + * 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. + */ + +#define LOG_TAG "crasher" + #include <assert.h> #include <errno.h> #include <fcntl.h> diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp index b8a62a583..5ae66db5c 100644 --- a/debuggerd/debuggerd.cpp +++ b/debuggerd/debuggerd.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "debuggerd" + #include <arpa/inet.h> #include <dirent.h> #include <elf.h> diff --git a/debuggerd/getevent.cpp b/debuggerd/getevent.cpp index dfa7bec02..dbb878acb 100644 --- a/debuggerd/getevent.cpp +++ b/debuggerd/getevent.cpp @@ -26,6 +26,7 @@ #include <sys/ioctl.h> #include <sys/limits.h> #include <sys/poll.h> +#include <unistd.h> #include <memory> diff --git a/debuggerd/signal_sender.cpp b/debuggerd/signal_sender.cpp index 3adbef2db..7fe4dee6f 100644 --- a/debuggerd/signal_sender.cpp +++ b/debuggerd/signal_sender.cpp @@ -14,7 +14,10 @@ * limitations under the License. */ +#define LOG_TAG "debuggerd-signal" + #include <errno.h> +#include <pthread.h> #include <signal.h> #include <stdlib.h> #include <string.h> diff --git a/debuggerd/test/log_fake.cpp b/debuggerd/test/log_fake.cpp index 59910adab..3336bcb50 100644 --- a/debuggerd/test/log_fake.cpp +++ b/debuggerd/test/log_fake.cpp @@ -19,8 +19,8 @@ #include <string> -#include <android/log.h> #include <android-base/stringprintf.h> +#include <log/log.h> // Forward declarations. class Backtrace; diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp index e2461c0c6..459e4cc45 100644 --- a/debuggerd/tombstone.cpp +++ b/debuggerd/tombstone.cpp @@ -36,6 +36,7 @@ #include <backtrace/Backtrace.h> #include <backtrace/BacktraceMap.h> #include <cutils/properties.h> +#include <log/log.h> #include <log/logprint.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/debuggerd/utility.cpp b/debuggerd/utility.cpp index e334e715c..419d36c3b 100644 --- a/debuggerd/utility.cpp +++ b/debuggerd/utility.cpp @@ -27,9 +27,9 @@ #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) { diff --git a/include/log/logger.h b/include/log/logger.h index 46587fb74..65b38de8d 100644 --- a/include/log/logger.h +++ b/include/log/logger.h @@ -17,7 +17,7 @@ #include <string> #endif -#include <android/log.h> +#include <log/log.h> #ifdef __cplusplus extern "C" { diff --git a/include/utils/Log.h b/include/utils/Log.h index 6ef3fa37d..5276a498d 100644 --- a/include/utils/Log.h +++ b/include/utils/Log.h @@ -30,7 +30,7 @@ #include <sys/types.h> -#include <android/log.h> +#include <log/log.h> #ifdef __cplusplus diff --git a/include/utils/SortedVector.h b/include/utils/SortedVector.h index 9f2ec021f..86f349645 100644 --- a/include/utils/SortedVector.h +++ b/include/utils/SortedVector.h @@ -21,7 +21,7 @@ #include <stdint.h> #include <sys/types.h> -#include <android/log.h> +#include <log/log.h> #include <utils/TypeHelpers.h> #include <utils/Vector.h> #include <utils/VectorImpl.h> diff --git a/include/utils/Vector.h b/include/utils/Vector.h index 6c1931ed7..28a77b834 100644 --- a/include/utils/Vector.h +++ b/include/utils/Vector.h @@ -22,7 +22,7 @@ #include <new> -#include <android/log.h> +#include <log/log.h> #include <utils/TypeHelpers.h> #include <utils/VectorImpl.h> diff --git a/libbacktrace/BacktraceMap.cpp b/libbacktrace/BacktraceMap.cpp index 19ea1e369..449637553 100644 --- a/libbacktrace/BacktraceMap.cpp +++ b/libbacktrace/BacktraceMap.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "backtrace-map" + #include <ctype.h> #include <inttypes.h> #include <stdint.h> diff --git a/libcutils/dlmalloc_stubs.c b/libcutils/dlmalloc_stubs.c index 86fc88066..6c07bed9a 100644 --- a/libcutils/dlmalloc_stubs.c +++ b/libcutils/dlmalloc_stubs.c @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "dlmalloc-stubs" + #include "android/log.h" #define UNUSED __attribute__((__unused__)) diff --git a/libcutils/fs.c b/libcutils/fs.c index 1622ed927..c49233e8c 100644 --- a/libcutils/fs.c +++ b/libcutils/fs.c @@ -25,6 +25,7 @@ #include <errno.h> #include <fcntl.h> #include <limits.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c index 2cc72a691..cab926394 100644 --- a/libcutils/sched_policy.c +++ b/libcutils/sched_policy.c @@ -23,7 +23,7 @@ #include <string.h> #include <unistd.h> -#include <android/log.h> +#include <log/log.h> #include <cutils/sched_policy.h> #define UNUSED __attribute__((__unused__)) diff --git a/libcutils/sockets_unix.cpp b/libcutils/sockets_unix.cpp index e51a1c7a2..3545403aa 100644 --- a/libcutils/sockets_unix.cpp +++ b/libcutils/sockets_unix.cpp @@ -14,7 +14,11 @@ * limitations under the License. */ +#define LOG_TAG "socket-unix" + #include <sys/uio.h> +#include <time.h> +#include <unistd.h> #include <android/log.h> #include <cutils/sockets.h> diff --git a/libion/ion.c b/libion/ion.c index 424776a3c..4565efb80 100644 --- a/libion/ion.c +++ b/libion/ion.c @@ -27,6 +27,7 @@ #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/types.h> +#include <unistd.h> #include <android/log.h> #include <ion/ion.h> diff --git a/liblog/README b/liblog/README index eefa80fef..dd378325a 100644 --- a/liblog/README +++ b/liblog/README @@ -1,12 +1,18 @@ -LIBLOG(3) Android NDK Programming Manual LIBLOG(3) +LIBLOG(3) Android Internal NDK Programming Manual LIBLOG(3) NAME - liblog - Android NDK logger interfaces + liblog - Android Internal NDK logger interfaces SYNOPSIS - #include <android/log.h> + /* + * Please limit to 24 characters for runtime is loggable, + * 16 characters for persist is loggable, and logcat pretty + * alignment with limit of 7 characters. + */ + #define LOG_TAG "yourtag" + #include <log/log.h> ALOG(android_priority, tag, format, ...) IF_ALOG(android_priority, tag) @@ -66,21 +72,44 @@ SYNOPSIS int android_logger_get_log_readable_size(struct logger *logger) int android_logger_get_log_version(struct logger *logger) - struct logger_list *android_logger_list_alloc(int mode, unsigned int - tail, pid_t pid) - struct logger *android_logger_open(struct logger_list *logger_list, - log_id_t id) - struct logger_list *android_logger_list_open(log_id_t id, int mode, - unsigned int tail, pid_t pid) - - int android_logger_list_read(struct logger_list *logger_list, struct - log_msg *log_msg - + struct logger_list *android_logger_list_alloc(int mode, + unsigned int tail, + pid_t pid) + struct logger *android_logger_open(struct logger_list *logger_list, + log_id_t id) + struct logger_list *android_logger_list_open(log_id_t id, int mode, + unsigned int tail, + pid_t pid) + int android_logger_list_read(struct logger_list *logger_list, + struct log_msg *log_msg) void android_logger_list_free(struct logger_list *logger_list) log_id_t android_name_to_log_id(const char *logName) const char *android_log_id_to_name(log_id_t log_id) + android_log_context create_android_logger(uint32_t tag) + + 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) + + int android_log_write_list(android_log_context ctx, + log_id_t id = LOG_ID_EVENTS) + + 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) + + int android_log_destroy(android_log_context *ctx) + Link with -llog DESCRIPTION @@ -163,8 +192,8 @@ ERRORS library retries on EINTR, -EINTR should never be returned. SEE ALSO - syslogd(8) + syslogd(8), klogd, auditd(8) - 24 Jan 2014 LIBLOG(3) + 17 Oct 2016 LIBLOG(3) diff --git a/liblog/event_tag_map.c b/liblog/event_tag_map.c index 6705fb285..0e5a281bb 100644 --- a/liblog/event_tag_map.c +++ b/liblog/event_tag_map.c @@ -19,6 +19,7 @@ #include <errno.h> #include <fcntl.h> #include <inttypes.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> diff --git a/liblog/fake_log_device.c b/liblog/fake_log_device.c index 5f7f05b9d..493922101 100644 --- a/liblog/fake_log_device.c +++ b/liblog/fake_log_device.c @@ -25,10 +25,14 @@ #if !defined(_WIN32) #include <pthread.h> #endif +#include <stdint.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include <android/log.h> +#include <log/uio.h> #include "fake_log_device.h" #include "log_portability.h" diff --git a/liblog/fake_writer.c b/liblog/fake_writer.c index 47935e35d..dab8bc54e 100644 --- a/liblog/fake_writer.c +++ b/liblog/fake_writer.c @@ -18,7 +18,7 @@ #include <fcntl.h> #include <unistd.h> -#include <android/log.h> +#include <log/log.h> #include "config_write.h" #include "fake_log_device.h" diff --git a/liblog/log_event_write.c b/liblog/log_event_write.c index 8c8a9a1fe..7262fc584 100644 --- a/liblog/log_event_write.c +++ b/liblog/log_event_write.c @@ -15,8 +15,9 @@ */ #include <errno.h> +#include <stdint.h> -#include <android/log.h> +#include <log/log.h> #include "log_portability.h" diff --git a/liblog/logd_reader.c b/liblog/logd_reader.c index 71ff0752a..99d7fea3b 100644 --- a/liblog/logd_reader.c +++ b/liblog/logd_reader.c @@ -31,9 +31,7 @@ #include <time.h> #include <unistd.h> -#include <android/log.h> #include <cutils/sockets.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/liblog/logd_writer.c b/liblog/logd_writer.c index 2913507c2..8fdfb92d3 100644 --- a/liblog/logd_writer.c +++ b/liblog/logd_writer.c @@ -32,7 +32,6 @@ #include <unistd.h> #include <cutils/sockets.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/liblog/logger.h b/liblog/logger.h index d2aebcb82..fb477868d 100644 --- a/liblog/logger.h +++ b/liblog/logger.h @@ -19,11 +19,11 @@ #include <stdatomic.h> #include <stdbool.h> -#include <log/uio.h> #include <android/log.h> #include <cutils/list.h> #include <log/logger.h> +#include <log/uio.h> #include "log_portability.h" diff --git a/liblog/logger_read.c b/liblog/logger_read.c index d979e22e9..c3cb7adc1 100644 --- a/liblog/logger_read.c +++ b/liblog/logger_read.c @@ -25,7 +25,6 @@ #include <android/log.h> #include <cutils/list.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include "config_read.h" diff --git a/liblog/logger_write.c b/liblog/logger_write.c index 1e56b270b..c481e366a 100644 --- a/liblog/logger_write.c +++ b/liblog/logger_write.c @@ -24,9 +24,7 @@ #include <android/set_abort_message.h> #endif -#include <android/log.h> #include <log/event_tag_map.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/liblog/pmsg_writer.c b/liblog/pmsg_writer.c index b3c4a1a04..c1c068e86 100644 --- a/liblog/pmsg_writer.c +++ b/liblog/pmsg_writer.c @@ -26,9 +26,6 @@ #include <sys/types.h> #include <time.h> -#include <android/log.h> -#include <log/logger.h> - #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/liblog/tests/liblog_benchmark.cpp b/liblog/tests/liblog_benchmark.cpp index cd012ce69..44045c34b 100644 --- a/liblog/tests/liblog_benchmark.cpp +++ b/liblog/tests/liblog_benchmark.cpp @@ -20,9 +20,7 @@ #include <sys/types.h> #include <unistd.h> -#include <android/log.h> #include <cutils/sockets.h> -#include <log/logger.h> #include <private/android_logger.h> #include "benchmark.h" diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index 7db048d20..fd38849e6 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp @@ -27,12 +27,10 @@ #include <string> -#include <android/log.h> #include <android-base/file.h> #include <android-base/stringprintf.h> #include <cutils/properties.h> #include <gtest/gtest.h> -#include <log/logger.h> #include <log/logprint.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc index 9f9c83faf..32b2d27db 100644 --- a/libnativebridge/native_bridge.cc +++ b/libnativebridge/native_bridge.cc @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "nativebridge" + #include "nativebridge/native_bridge.h" #include <dlfcn.h> @@ -22,6 +24,7 @@ #include <stdio.h> #include <sys/mount.h> #include <sys/stat.h> +#include <unistd.h> #include <cstring> diff --git a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp index 67eba8040..e212f1ba2 100644 --- a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp +++ b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp @@ -14,6 +14,7 @@ ** See the License for the specific language governing permissions and ** limitations under the License. */ +#define LOG_TAG "pixelflinger-code" #include <errno.h> #include <stdint.h> diff --git a/libpixelflinger/codeflinger/blending.cpp b/libpixelflinger/codeflinger/blending.cpp index d4aa47538..092f14092 100644 --- a/libpixelflinger/codeflinger/blending.cpp +++ b/libpixelflinger/codeflinger/blending.cpp @@ -15,6 +15,8 @@ ** limitations under the License. */ +#define LOG_TAG "pixelflinger-code" + #include <assert.h> #include <stdint.h> #include <stdio.h> diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index d68f6dc73..b8a0e555d 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -15,6 +15,8 @@ ** limitations under the License. */ +#define LOG_TAG "pixelflinger-code" + #include <assert.h> #include <stdio.h> diff --git a/libpixelflinger/codeflinger/texturing.cpp b/libpixelflinger/codeflinger/texturing.cpp index d66981dad..f4f465796 100644 --- a/libpixelflinger/codeflinger/texturing.cpp +++ b/libpixelflinger/codeflinger/texturing.cpp @@ -15,6 +15,8 @@ ** limitations under the License. */ +#define LOG_TAG "pixelflinger-code" + #include <assert.h> #include <stdint.h> #include <stdio.h> diff --git a/libpixelflinger/trap.cpp b/libpixelflinger/trap.cpp index f00e50aee..fa6338aa4 100644 --- a/libpixelflinger/trap.cpp +++ b/libpixelflinger/trap.cpp @@ -15,6 +15,8 @@ ** limitations under the License. */ +#define LOG_TAG "pixelflinger-trap" + #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/libsysutils/src/FrameworkCommand.cpp b/libsysutils/src/FrameworkCommand.cpp index dccacda4e..a6c4abcc4 100644 --- a/libsysutils/src/FrameworkCommand.cpp +++ b/libsysutils/src/FrameworkCommand.cpp @@ -18,7 +18,7 @@ #include <errno.h> -#include <android/log.h> +#include <log/log.h> #include <sysutils/FrameworkCommand.h> #define UNUSED __attribute__((unused)) diff --git a/libsysutils/src/FrameworkListener.cpp b/libsysutils/src/FrameworkListener.cpp index b96174a9c..52f28af47 100644 --- a/libsysutils/src/FrameworkListener.cpp +++ b/libsysutils/src/FrameworkListener.cpp @@ -19,8 +19,9 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> -#include <android/log.h> +#include <log/log.h> #include <sysutils/FrameworkCommand.h> #include <sysutils/FrameworkListener.h> #include <sysutils/SocketClient.h> diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp index b78769254..fef801ad0 100644 --- a/libsysutils/src/NetlinkEvent.cpp +++ b/libsysutils/src/NetlinkEvent.cpp @@ -41,7 +41,7 @@ const int LOCAL_QLOG_NL_EVENT = 112; const int LOCAL_NFLOG_PACKET = NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET; -#include <android/log.h> +#include <log/log.h> #include <sysutils/NetlinkEvent.h> NetlinkEvent::NetlinkEvent() { diff --git a/libsysutils/src/NetlinkListener.cpp b/libsysutils/src/NetlinkListener.cpp index 1c4c7df6d..896dad3a6 100644 --- a/libsysutils/src/NetlinkListener.cpp +++ b/libsysutils/src/NetlinkListener.cpp @@ -20,11 +20,12 @@ #include <string.h> #include <sys/socket.h> #include <sys/types.h> +#include <unistd.h> #include <linux/netlink.h> /* out of order because must follow sys/socket.h */ -#include <android/log.h> #include <cutils/uevent.h> +#include <log/log.h> #include <sysutils/NetlinkEvent.h> #if 1 diff --git a/libsysutils/src/ServiceManager.cpp b/libsysutils/src/ServiceManager.cpp index 1abe988a8..13bac0923 100644 --- a/libsysutils/src/ServiceManager.cpp +++ b/libsysutils/src/ServiceManager.cpp @@ -17,10 +17,12 @@ #define LOG_TAG "Service" #include <errno.h> +#include <stdio.h> #include <string.h> +#include <unistd.h> -#include <android/log.h> #include <cutils/properties.h> +#include <log/log.h> #include <sysutils/ServiceManager.h> ServiceManager::ServiceManager() { diff --git a/libsysutils/src/SocketClient.cpp b/libsysutils/src/SocketClient.cpp index 02505d304..971f90821 100644 --- a/libsysutils/src/SocketClient.cpp +++ b/libsysutils/src/SocketClient.cpp @@ -25,8 +25,9 @@ #include <string.h> #include <sys/socket.h> #include <sys/types.h> +#include <unistd.h> -#include <android/log.h> +#include <log/log.h> #include <sysutils/SocketClient.h> SocketClient::SocketClient(int socket, bool owned) { diff --git a/libsysutils/src/SocketListener.cpp b/libsysutils/src/SocketListener.cpp index 6a676a954..3f8f3db8f 100644 --- a/libsysutils/src/SocketListener.cpp +++ b/libsysutils/src/SocketListener.cpp @@ -24,9 +24,10 @@ #include <sys/time.h> #include <sys/types.h> #include <sys/un.h> +#include <unistd.h> -#include <android/log.h> #include <cutils/sockets.h> +#include <log/log.h> #include <sysutils/SocketListener.h> #include <sysutils/SocketClient.h> diff --git a/libutils/SharedBuffer.cpp b/libutils/SharedBuffer.cpp index 2b3690c07..269326a6d 100644 --- a/libutils/SharedBuffer.cpp +++ b/libutils/SharedBuffer.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "sharedbuffer" + #include <stdlib.h> #include <string.h> diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp index 065210193..c32f46246 100644 --- a/libutils/Unicode.cpp +++ b/libutils/Unicode.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define LOG_TAG "unicode" + #include <limits.h> #include <stddef.h> diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc index b00557cfc..d36cc3fe5 100644 --- a/libziparchive/zip_archive.cc +++ b/libziparchive/zip_archive.cc @@ -18,6 +18,8 @@ * Read-only access to Zip archives, with minimal heap allocation. */ +#define LOG_TAG "ziparchive" + #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -30,11 +32,11 @@ #include <memory> #include <vector> -#include <android/log.h> #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/macros.h> // TEMP_FAILURE_RETRY may or may not be in unistd #include <android-base/memory.h> +#include <log/log.h> #include <utils/Compat.h> #include <utils/FileMap.h> #include "ziparchive/zip_archive.h" diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c index 107aa3edc..49746b36a 100644 --- a/lmkd/lmkd.c +++ b/lmkd/lmkd.c @@ -18,6 +18,7 @@ #include <arpa/inet.h> #include <errno.h> +#include <sched.h> #include <signal.h> #include <stdlib.h> #include <string.h> diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp index cc140b0a9..3811daaa0 100644 --- a/logd/LogAudit.cpp +++ b/logd/LogAudit.cpp @@ -25,7 +25,6 @@ #include <sys/uio.h> #include <syslog.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp index e5de11d92..a9390022d 100644 --- a/logd/LogBufferElement.cpp +++ b/logd/LogBufferElement.cpp @@ -22,7 +22,6 @@ #include <time.h> #include <unistd.h> -#include <log/logger.h> #include <private/android_logger.h> #include "LogBuffer.h" diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp index 61b7fd830..4a30e6dac 100644 --- a/logd/LogListener.cpp +++ b/logd/LogListener.cpp @@ -23,7 +23,6 @@ #include <unistd.h> #include <cutils/sockets.h> -#include <log/logger.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> diff --git a/logd/LogUtils.h b/logd/LogUtils.h index 881f09729..d6b3dc695 100644 --- a/logd/LogUtils.h +++ b/logd/LogUtils.h @@ -20,8 +20,8 @@ #include <sys/cdefs.h> #include <sys/types.h> -#include <android/log.h> #include <sysutils/SocketClient.h> +#include <log/log.h> // Hijack this header as a common include file used by most all sources // to report some utilities defined here and there. diff --git a/logd/libaudit.c b/logd/libaudit.c index 288a052d8..d2b212ee4 100644 --- a/logd/libaudit.c +++ b/logd/libaudit.c @@ -18,26 +18,20 @@ * */ -#define LOG_TAG "libaudit" - #include <errno.h> #include <string.h> #include <unistd.h> -#include <android/log.h> - #include "libaudit.h" /** * Waits for an ack from the kernel * @param fd * The netlink socket fd - * @param seq - * The current sequence number were acking on * @return * This function returns 0 on success, else -errno. */ -static int get_ack(int fd, int16_t seq) +static int get_ack(int fd) { int rc; struct audit_message rep; @@ -60,11 +54,6 @@ static int get_ack(int fd, int16_t seq) } } - if ((int16_t)rep.nlh.nlmsg_seq != seq) { - SLOGW("Expected sequence number between user space and kernel space is out of skew, " - "expected %u got %u", seq, rep.nlh.nlmsg_seq); - } - return 0; } @@ -109,7 +98,6 @@ static int audit_send(int fd, int type, const void *data, size_t size) /* Ensure the message is not too big */ if (NLMSG_SPACE(size) > MAX_AUDIT_MESSAGE_LENGTH) { - SLOGE("netlink message is too large"); return -EINVAL; } @@ -140,7 +128,6 @@ static int audit_send(int fd, int type, const void *data, size_t size) /* Not all the bytes were sent */ if (rc < 0) { rc = -errno; - SLOGE("Error sending data over the netlink socket: %s", strerror(-errno)); goto out; } else if ((uint32_t) rc != req.nlh.nlmsg_len) { rc = -EPROTO; @@ -148,7 +135,7 @@ static int audit_send(int fd, int type, const void *data, size_t size) } /* We sent all the bytes, get the ack */ - rc = get_ack(fd, sequence); + rc = get_ack(fd); /* If the ack failed, return the error, else return the sequence number */ rc = (rc == 0) ? (int) sequence : rc; @@ -156,7 +143,6 @@ static int audit_send(int fd, int type, const void *data, size_t size) out: /* Don't let sequence roll to negative */ if (sequence < 0) { - SLOGW("Auditd to Kernel sequence number has rolled over"); sequence = 0; } @@ -183,7 +169,6 @@ int audit_setup(int fd, uint32_t pid) /* Let the kernel know this pid will be registering for audit events */ rc = audit_send(fd, AUDIT_SET, &status, sizeof(status)); if (rc < 0) { - SLOGE("Could net set pid for audit events, error: %s", strerror(-rc)); return rc; } @@ -241,25 +226,21 @@ int audit_get_reply(int fd, struct audit_message *rep, reply_t block, int peek) /* If request is non blocking and errno is EAGAIN, just return 0 */ return 0; } - SLOGE("Error receiving from netlink socket, error: %s", strerror(-rc)); return rc; } if (nladdrlen != sizeof(nladdr)) { - SLOGE("Protocol fault, error: %s", strerror(EPROTO)); return -EPROTO; } /* Make sure the netlink message was not spoof'd */ if (nladdr.nl_pid) { - SLOGE("Invalid netlink pid received, expected 0 got: %d", nladdr.nl_pid); return -EINVAL; } /* Check if the reply from the kernel was ok */ if (!NLMSG_OK(&rep->nlh, (size_t)len)) { rc = (len == sizeof(*rep)) ? -EFBIG : -EBADE; - SLOGE("Bad kernel response %s", strerror(-rc)); } return rc; @@ -267,9 +248,5 @@ int audit_get_reply(int fd, struct audit_message *rep, reply_t block, int peek) void audit_close(int fd) { - int rc = close(fd); - if (rc < 0) { - SLOGE("Attempting to close invalid fd %d, error: %s", fd, strerror(errno)); - } - return; + close(fd); } diff --git a/trusty/gatekeeper/trusty_gatekeeper_ipc.c b/trusty/gatekeeper/trusty_gatekeeper_ipc.c index ae536c539..45e65a7a0 100644 --- a/trusty/gatekeeper/trusty_gatekeeper_ipc.c +++ b/trusty/gatekeeper/trusty_gatekeeper_ipc.c @@ -17,8 +17,10 @@ #define LOG_TAG "TrustyGateKeeper" #include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <android/log.h> #include <trusty/tipc.h> diff --git a/trusty/keymaster/trusty_keymaster_ipc.c b/trusty/keymaster/trusty_keymaster_ipc.c index 0159bcead..87550936f 100644 --- a/trusty/keymaster/trusty_keymaster_ipc.c +++ b/trusty/keymaster/trusty_keymaster_ipc.c @@ -21,6 +21,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <android/log.h> #include <trusty/tipc.h> diff --git a/trusty/libtrusty/trusty.c b/trusty/libtrusty/trusty.c index ba16bee4a..2398a538b 100644 --- a/trusty/libtrusty/trusty.c +++ b/trusty/libtrusty/trusty.c @@ -22,6 +22,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/ioctl.h> +#include <unistd.h> #include <android/log.h> diff --git a/trusty/nvram/trusty_nvram_implementation.cpp b/trusty/nvram/trusty_nvram_implementation.cpp index caa25abf7..ddaf333d9 100644 --- a/trusty/nvram/trusty_nvram_implementation.cpp +++ b/trusty/nvram/trusty_nvram_implementation.cpp @@ -20,6 +20,7 @@ #include <errno.h> #include <string.h> +#include <unistd.h> #include <android/log.h> #include <hardware/nvram.h> diff --git a/trusty/storage/proxy/ipc.c b/trusty/storage/proxy/ipc.c index b4748e209..57cf600b6 100644 --- a/trusty/storage/proxy/ipc.c +++ b/trusty/storage/proxy/ipc.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <string.h> #include <sys/uio.h> +#include <unistd.h> #include <trusty/tipc.h> diff --git a/trusty/storage/proxy/rpmb.c b/trusty/storage/proxy/rpmb.c index 91304583a..9c7910585 100644 --- a/trusty/storage/proxy/rpmb.c +++ b/trusty/storage/proxy/rpmb.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> +#include <unistd.h> #include <linux/major.h> #include <linux/mmc/ioctl.h> |
