diff options
author | Dan Albert <danalbert@google.com> | 2015-03-20 13:46:28 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-03-23 13:01:21 -0700 |
commit | 7dfb61dcdca8ee597f23b9acc365fb140b353fff (patch) | |
tree | 9a4f01224517df3b3467d8cf4cd77a10bfffc3d8 /base | |
parent | a5e9639cf94aad0ed88ccd1c08d43f5084432f74 (diff) | |
download | system_core-7dfb61dcdca8ee597f23b9acc365fb140b353fff.tar.gz system_core-7dfb61dcdca8ee597f23b9acc365fb140b353fff.tar.bz2 system_core-7dfb61dcdca8ee597f23b9acc365fb140b353fff.zip |
Move gettid() into libcutils.
Change-Id: Ic8a15036833e6d129b7998d954b804be391de399
Diffstat (limited to 'base')
-rw-r--r-- | base/Android.mk | 4 | ||||
-rw-r--r-- | base/logging.cpp | 25 |
2 files changed, 6 insertions, 23 deletions
diff --git a/base/Android.mk b/base/Android.mk index 162c6cb56..7bd317b77 100644 --- a/base/Android.mk +++ b/base/Android.mk @@ -44,6 +44,7 @@ LOCAL_SRC_FILES := $(libbase_src_files) LOCAL_C_INCLUDES := $(LOCAL_PATH)/include LOCAL_CPPFLAGS := $(libbase_cppflags) LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include +LOCAL_STATIC_LIBRARIES := libcutils LOCAL_MULTILIB := both include $(BUILD_STATIC_LIBRARY) @@ -53,6 +54,7 @@ LOCAL_CLANG := true LOCAL_WHOLE_STATIC_LIBRARIES := libbase LOCAL_SHARED_LIBRARIES := liblog LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include +LOCAL_SHARED_LIBRARIES := libcutils LOCAL_MULTILIB := both include $(BUILD_SHARED_LIBRARY) @@ -64,6 +66,7 @@ LOCAL_SRC_FILES := $(libbase_src_files) LOCAL_C_INCLUDES := $(LOCAL_PATH)/include LOCAL_CPPFLAGS := $(libbase_cppflags) LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include +LOCAL_STATIC_LIBRARIES := libcutils LOCAL_MULTILIB := both include $(BUILD_HOST_STATIC_LIBRARY) @@ -72,6 +75,7 @@ LOCAL_MODULE := libbase LOCAL_WHOLE_STATIC_LIBRARIES := libbase LOCAL_SHARED_LIBRARIES := liblog LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include +LOCAL_STATIC_LIBRARIES := libcutils LOCAL_MULTILIB := both include $(BUILD_HOST_SHARED_LIBRARY) diff --git a/base/logging.cpp b/base/logging.cpp index 5b70c7dbb..8bfb20462 100644 --- a/base/logging.cpp +++ b/base/logging.cpp @@ -23,6 +23,7 @@ #include <vector> #include "base/strings.h" +#include "cutils/threads.h" // Headers for LogMessage::LogLine. #ifdef __ANDROID__ @@ -33,15 +34,6 @@ #include <unistd.h> #endif -// For GetTid. -#if defined(__APPLE__) -#include "AvailabilityMacros.h" // For MAC_OS_X_VERSION_MAX_ALLOWED -#include <sys/syscall.h> -#include <sys/time.h> -#elif !defined(__BIONIC__) -#include <syscall.h> -#endif - namespace android { namespace base { @@ -52,19 +44,6 @@ static std::unique_ptr<std::string> gCmdLine; static std::unique_ptr<std::string> gProgramInvocationName; static std::unique_ptr<std::string> gProgramInvocationShortName; -#ifndef __ANDROID__ -static pid_t GetTid() { -#if defined(__APPLE__) - uint64_t owner; - // Requires Mac OS 10.6 - CHECK_PTHREAD_CALL(pthread_threadid_np, (NULL, &owner), __FUNCTION__); - return owner; -#else - return syscall(__NR_gettid); -#endif -} -#endif // __ANDROID__ - const char* GetCmdLine() { return (gCmdLine.get() != nullptr) ? gCmdLine->c_str() : nullptr; } @@ -261,7 +240,7 @@ void LogMessage::LogLine(const char* file, unsigned int line, CHECK_EQ(strlen(log_characters), FATAL + 1U); char severity = log_characters[log_severity]; fprintf(stderr, "%s %c %5d %5d %s:%u] %s\n", ProgramInvocationShortName(), - severity, getpid(), GetTid(), file, line, message); + severity, getpid(), gettid(), file, line, message); #endif } |